Ignore:
Timestamp:
Mar 6, 2006 3:14:59 PM (18 years ago)
Author:
bennylp
Message:

Renamed getopt() to pj_getopt(), and fixed misc Linux warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/getopt.h

    r238 r300  
    11/* $Id$ */ 
    22/* This file has now become GPL. */ 
    3 /* Declarations for getopt. 
     3/* Declarations for pj_getopt. 
    44   Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. 
    55   This file is part of the GNU C Library. 
     
    2020   Boston, MA 02111-1307, USA.  */ 
    2121 
    22 #ifndef _GETOPT_H 
    23 #define _GETOPT_H 1 
     22#ifndef __PJ_GETOPT_H__ 
     23#define __PJ_GETOPT_H__ 1 
    2424 
    2525#ifdef  __cplusplus 
     
    2727#endif 
    2828 
    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, 
    3131   the argument value is returned here. 
    3232   Also, when `ordering' is RETURN_IN_ORDER, 
    3333   each non-option ARGV-element is returned here.  */ 
    3434 
    35 extern char *optarg; 
     35extern char *pj_optarg; 
    3636 
    3737/* Index in ARGV of the next element to be scanned. 
    3838   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'. 
    4040 
    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. 
    4242 
    43    When `getopt' returns -1, this is the index of the first of the 
     43   When `pj_getopt' returns -1, this is the index of the first of the 
    4444   non-option elements that the caller should itself scan. 
    4545 
    46    Otherwise, `optind' communicates from one call to the next 
     46   Otherwise, `pj_optind' communicates from one call to the next 
    4747   how much of ARGV has been scanned so far.  */ 
    4848 
    49 extern int optind; 
     49extern int pj_optind; 
    5050 
    51 /* Callers store zero here to inhibit the error message `getopt' prints 
     51/* Callers store zero here to inhibit the error message `pj_getopt' prints 
    5252   for unrecognized options.  */ 
    5353 
    54 extern int opterr; 
     54extern int pj_opterr; 
    5555 
    5656/* Set to an option character which was unrecognized.  */ 
    5757 
    58 extern int optopt; 
     58extern int pj_optopt; 
    5959 
    6060/* Describe the long-named options requested by the application. 
    61    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector 
    62    of `struct option' terminated by an element containing a name which is 
     61   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 
    6363   zero. 
    6464 
     
    7373 
    7474   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 the 
     75   a compiled-in constant, such as set a value from `pj_optarg', set the 
    7676   option's `flag' field to zero and its `val' field to a nonzero 
    7777   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' 
    7979   returns the contents of the `val' field.  */ 
    8080 
    81 struct option 
     81struct pj_getopt_option 
    8282{ 
    8383  const char *name; 
     
    8989}; 
    9090 
    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'.  */ 
    9292 
    9393# define no_argument            0 
     
    102102   Return the option character from OPTS just read.  Return -1 when 
    103103   there are no more options.  For unrecognized options, or options 
    104    missing arguments, `optopt' is set to the option letter, and '?' is 
     104   missing arguments, `pj_optopt' is set to the option letter, and '?' is 
    105105   returned. 
    106106 
    107107   The OPTS string is a list of characters which are recognized option 
    108108   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'. 
    110110 
    111111   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'. 
    113113 
    114114   The argument `--' causes premature termination of argument 
    115    scanning, explicitly telling `getopt' that there are no more 
     115   scanning, explicitly telling `pj_getopt' that there are no more 
    116116   options. 
    117117 
    118118   If OPTS begins with `--', then non-option arguments are treated as 
    119119   arguments to the option '\0'.  This behavior is specific to the GNU 
    120    `getopt'.  */ 
     120   `pj_getopt'.  */ 
    121121 
    122 int getopt (int argc, char *const *argv, const char *shortopts); 
     122int pj_getopt (int argc, char *const *argv, const char *shortopts); 
    123123 
    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, 
     124int pj_getopt_long (int argc, char *const *argv, const char *options, 
     125                        const struct pj_getopt_option *longopts, int *longind); 
     126int pj_getopt_long_only (int argc, char *const *argv, 
    127127                             const char *shortopts, 
    128                              const struct option *longopts, int *longind); 
     128                             const struct pj_getopt_option *longopts, int *longind); 
    129129 
    130130 
     
    133133#endif 
    134134 
    135 #endif /* getopt.h */ 
     135#endif /* pj_getopt.h */ 
    136136 
Note: See TracChangeset for help on using the changeset viewer.