Changeset 300 for pjproject/trunk/pjsip/include/pjsua-lib/getopt.h
- Timestamp:
- Mar 6, 2006 3:14:59 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/getopt.h
r238 r300 1 1 /* $Id$ */ 2 2 /* This file has now become GPL. */ 3 /* Declarations for getopt.3 /* Declarations for pj_getopt. 4 4 Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. 5 5 This file is part of the GNU C Library. … … 20 20 Boston, MA 02111-1307, USA. */ 21 21 22 #ifndef _ GETOPT_H23 #define _ GETOPT_H122 #ifndef __PJ_GETOPT_H__ 23 #define __PJ_GETOPT_H__ 1 24 24 25 25 #ifdef __cplusplus … … 27 27 #endif 28 28 29 /* For communication from ` getopt' to the caller.30 When ` getopt' finds an option that takes an argument,29 /* For communication from `pj_getopt' to the caller. 30 When `pj_getopt' finds an option that takes an argument, 31 31 the argument value is returned here. 32 32 Also, when `ordering' is RETURN_IN_ORDER, 33 33 each non-option ARGV-element is returned here. */ 34 34 35 extern char * optarg;35 extern char *pj_optarg; 36 36 37 37 /* Index in ARGV of the next element to be scanned. 38 38 This is used for communication to and from the caller 39 and for communication between successive calls to ` getopt'.39 and for communication between successive calls to `pj_getopt'. 40 40 41 On entry to ` getopt', zero means this is the first call; initialize.41 On entry to `pj_getopt', zero means this is the first call; initialize. 42 42 43 When ` getopt' returns -1, this is the index of the first of the43 When `pj_getopt' returns -1, this is the index of the first of the 44 44 non-option elements that the caller should itself scan. 45 45 46 Otherwise, ` optind' communicates from one call to the next46 Otherwise, `pj_optind' communicates from one call to the next 47 47 how much of ARGV has been scanned so far. */ 48 48 49 extern int optind;49 extern int pj_optind; 50 50 51 /* Callers store zero here to inhibit the error message ` getopt' prints51 /* Callers store zero here to inhibit the error message `pj_getopt' prints 52 52 for unrecognized options. */ 53 53 54 extern int opterr;54 extern int pj_opterr; 55 55 56 56 /* Set to an option character which was unrecognized. */ 57 57 58 extern int optopt;58 extern int pj_optopt; 59 59 60 60 /* Describe the long-named options requested by the application. 61 The LONG_OPTIONS argument to getopt_long orgetopt_long_only is a vector62 of `struct option' terminated by an element containing a name which is61 The LONG_OPTIONS argument to pj_getopt_long or pj_getopt_long_only is a vector 62 of `struct pj_getopt_option' terminated by an element containing a name which is 63 63 zero. 64 64 … … 73 73 74 74 To have a long-named option do something other than set an `int' to 75 a compiled-in constant, such as set a value from ` optarg', set the75 a compiled-in constant, such as set a value from `pj_optarg', set the 76 76 option's `flag' field to zero and its `val' field to a nonzero 77 77 value (the equivalent single-letter option character, if there is 78 one). For long options that have a zero `flag' field, ` getopt'78 one). For long options that have a zero `flag' field, `pj_getopt' 79 79 returns the contents of the `val' field. */ 80 80 81 struct option81 struct pj_getopt_option 82 82 { 83 83 const char *name; … … 89 89 }; 90 90 91 /* Names for the values of the `has_arg' field of `struct option'. */91 /* Names for the values of the `has_arg' field of `struct pj_getopt_option'. */ 92 92 93 93 # define no_argument 0 … … 102 102 Return the option character from OPTS just read. Return -1 when 103 103 there are no more options. For unrecognized options, or options 104 missing arguments, ` optopt' is set to the option letter, and '?' is104 missing arguments, `pj_optopt' is set to the option letter, and '?' is 105 105 returned. 106 106 107 107 The OPTS string is a list of characters which are recognized option 108 108 letters, optionally followed by colons, specifying that that letter 109 takes an argument, to be placed in ` optarg'.109 takes an argument, to be placed in `pj_optarg'. 110 110 111 111 If a letter in OPTS is followed by two colons, its argument is 112 optional. This behavior is specific to the GNU ` getopt'.112 optional. This behavior is specific to the GNU `pj_getopt'. 113 113 114 114 The argument `--' causes premature termination of argument 115 scanning, explicitly telling ` getopt' that there are no more115 scanning, explicitly telling `pj_getopt' that there are no more 116 116 options. 117 117 118 118 If OPTS begins with `--', then non-option arguments are treated as 119 119 arguments to the option '\0'. This behavior is specific to the GNU 120 ` getopt'. */120 `pj_getopt'. */ 121 121 122 int getopt (int argc, char *const *argv, const char *shortopts);122 int pj_getopt (int argc, char *const *argv, const char *shortopts); 123 123 124 int getopt_long (int argc, char *const *argv, const char *options,125 const struct option *longopts, int *longind);126 int getopt_long_only (int argc, char *const *argv,124 int pj_getopt_long (int argc, char *const *argv, const char *options, 125 const struct pj_getopt_option *longopts, int *longind); 126 int pj_getopt_long_only (int argc, char *const *argv, 127 127 const char *shortopts, 128 const struct option *longopts, int *longind);128 const struct pj_getopt_option *longopts, int *longind); 129 129 130 130 … … 133 133 #endif 134 134 135 #endif /* getopt.h */135 #endif /* pj_getopt.h */ 136 136
Note: See TracChangeset
for help on using the changeset viewer.