--- popt-20020315.orig/popt.3 2001-09-19 14:35:47 +0400 +++ popt-20020315/popt.3 2003-05-01 14:01:41 +0400 @@ -1,48 +1,83 @@ -.TH POPT 3 "June 30, 1998" "" "Linux Programmer's Manual" +.TH POPT 3 "April 30, 2003" "ALT Linux" "Linux Programmer's Manual" .SH NAME popt \- Parse command line options .SH SYNOPSIS .nf .B #include .sp -.BI "poptContext poptGetContext(const char * " name ", int " argc , -.BI " const char ** "argv , -.BI " const struct poptOption * " options , -.BI " int " flags ); -.sp -.BI "void poptFreeContext(poptContext " con ); -.sp -.BI "void poptResetContext(poptContext " con ); -.sp -.BI "int poptGetNextOpt(poptContext " con ); -.sp -.BI "const char * poptGetOptArg(poptContext " con ); -.sp -.BI "const char * poptGetArg(poptContext " con ); -.sp -.BI "const char * poptPeekArg(poptContext " con ); -.sp -.BI "const char ** poptGetArgs(poptContext " con ); -.sp -.BI "const char *const poptStrerror(const int " error ); -.sp -.BI "const char * poptBadOption(poptContext " con ", int " flags ); -.sp -.BI "int poptReadDefaultConfig(poptContext " con ", int " flags ); -.sp -.BI "int poptReadConfigFile(poptContext " con ", char * " fn ); -.sp -.BI "int poptAddAlias(poptContext " con ", struct poptAlias " alias , -.BI " int " flags ); -.sp -.BI "int poptParseArgvString(char * " s ", int * " argcPtr , -.BI " const char *** " argvPtr ); -.sp -.BI "int poptDupArgv(int " argc ", const char ** " argv ", int * " argcPtr ", -.BI " const char *** " argvPtr ");" -.sp -.BI "int poptStuffArgs(poptContext " con ", const char ** " argv ); -.sp +.SS "Functions" + +.in +1c +.ti -1c +.RI "\fBpoptContext\fP \fBpoptGetContext\fP (const char *name, int argc, const char **argv, const struct \fBpoptOption\fP *options, int flags)" +.br +.ti -1c +.RI "void \fBpoptResetContext\fP (\fBpoptContext\fP con)" +.br +.ti -1c +.RI "int \fBpoptGetNextOpt\fP (\fBpoptContext\fP con)" +.br +.ti -1c +.RI "const char * \fBpoptGetOptArg\fP (\fBpoptContext\fP con)" +.br +.ti -1c +.RI "const char * \fBpoptGetArg\fP (\fBpoptContext\fP con)" +.br +.ti -1c +.RI "const char * \fBpoptPeekArg\fP (\fBpoptContext\fP con)" +.br +.ti -1c +.RI "const char ** \fBpoptGetArgs\fP (\fBpoptContext\fP con)" +.br +.ti -1c +.RI "const char * \fBpoptBadOption\fP (\fBpoptContext\fP con, int flags)" +.br +.ti -1c +.RI "\fBpoptContext\fP \fBpoptFreeContext\fP (\fBpoptContext\fP con)" +.br +.ti -1c +.RI "int \fBpoptStuffArgs\fP (\fBpoptContext\fP con, const char **argv)" +.br +.ti -1c +.RI "int \fBpoptAddAlias\fP (\fBpoptContext\fP con, struct \fBpoptAlias\fP alias, int flags)" +.br +.ti -1c +.RI "int \fBpoptAddItem\fP (\fBpoptContext\fP con, \fBpoptItem\fP newItem, int flags)" +.br +.ti -1c +.RI "int \fBpoptReadConfigFile\fP (\fBpoptContext\fP con, const char *fn)" +.br +.ti -1c +.RI "int \fBpoptReadDefaultConfig\fP (\fBpoptContext\fP con, int useEnv)" +.br +.ti -1c +.RI "int \fBpoptDupArgv\fP (int argc, const char **argv, int *argcPtr, const char ***argvPtr)" +.br +.ti -1c +.RI "int \fBpoptParseArgvString\fP (const char *s, int *argcPtr, const char ***argvPtr)" +.br +.ti -1c +.RI "const char *const \fBpoptStrerror\fP (const int error)" +.br +.ti -1c +.RI "void \fBpoptSetExecPath\fP (\fBpoptContext\fP con, const char *path, int allowAbsolute)" +.br +.ti -1c +.RI "void \fBpoptPrintHelp\fP (\fBpoptContext\fP con, FILE *fp, int flags)" +.br +.ti -1c +.RI "void \fBpoptPrintUsage\fP (\fBpoptContext\fP con, FILE *fp, int flags)" +.br +.ti -1c +.RI "void \fBpoptSetOtherOptionHelp\fP (\fBpoptContext\fP con, const char *text)" +.br +.ti -1c +.RI "const char * \fBpoptGetInvocationName\fP (\fBpoptContext\fP con)" +.br +.ti -1c +.RI "int \fBpoptStrippedArgv\fP (\fBpoptContext\fP con, int argc, char **argv)" +.br +.in -1c .fi .SH DESCRIPTION The popt library exists essentially for parsing command-line @@ -235,15 +270,14 @@ the table. Instead, options information must be retained via the callback or by having popt set a variable through the option's \fIarg\fR field. Option callbacks should match the following prototype: -.sp -.nf -.BI "void poptCallbackType(poptContext con, -.BI " const struct poptOption * opt, -.BI " const char * arg, void * data); -.fi -.sp +.PP +.in +1c +.ti -1c +.RI "typedef void(* poptCallbackType)(\fBpoptContext\fP con, enum \fBpoptCallbackReason\fP reason, const struct \fBpoptOption\fP * opt, const char * arg, const void * data)" +.PP The first parameter is the context which is being parsed (see the next -section for information on contexts), \fIopt\fR points to the option +section for information on contexts), \fIreason\fP is the reason for callback, +\fIopt\fR points to the option which triggered this callback, and \fIarg\fR is the option's argument. If the option does not take an argument, \fIarg\fR is \fBNULL\fR. The final parameter, \fIdata\fR is taken from the \fIdescrip\fR field @@ -743,7 +777,13 @@ various ways. If a feature isn't working for you, the popt test code is the first place to look. .SH BUGS -None presently known. +The popt implementation is dirty. Avoid it. Use +.B argp +instead. +.sp +This manpage is quite outdated. See +.BR popt.h (3) +for more up-to-date information. .SH AUTHOR Erik W. Troan .PP @@ -754,8 +794,11 @@ permission of the Publisher and the appreciation of the Authors. .PP Thanks to Robert Lynch for his extensive work on this man page. -.SH "SEE ALSO" -.BR getopt (3) +.SH SEE ALSO +.BR getopt (3), +inf +.BR argp , +.BR popt.h (3) .sp .IR "Linux Application Development" ", by Michael K. Johnson and " Erik W. Troan (Addison-Wesley, 1998; ISBN 0-201-30821-5), Chapter 24.