| OLD | NEW | 
|   1 /* |   1 /* | 
|   2 Copyright (C) 1997 Gregory Pietsch |   2 Copyright (C) 1997 Gregory Pietsch | 
|   3  |   3  | 
|   4 [These files] are hereby placed in the public domain without restrictions. Just |   4 [These files] are hereby placed in the public domain without restrictions. Just | 
|   5 give the author credit, don't claim you wrote it or prevent anyone else from |   5 give the author credit, don't claim you wrote it or prevent anyone else from | 
|   6 using it. |   6 using it. | 
|   7 */ |   7 */ | 
|   8  |   8  | 
|   9 #ifndef GETOPT_H |   9 #ifndef GETOPT_H | 
|  10 #define GETOPT_H |  10 #define GETOPT_H | 
|  11  |  11  | 
|  12 /* include files needed by this include file */ |  12 /* include files needed by this include file */ | 
|  13  |  13  | 
|  14 /* macros defined by this include file */ |  14 /* macros defined by this include file */ | 
|  15 #define no_argument       0 |  15 #define no_argument       0 | 
|  16 #define required_argument 1 |  16 #define required_argument 1 | 
|  17 #define OPTIONAL_ARG      2 |  17 #define OPTIONAL_ARG      2 | 
|  18  |  18  | 
|  19 /* types defined by this include file */ |  19 /* types defined by this include file */ | 
|  20  |  20  | 
 |  21 namespace crashpad { | 
 |  22  | 
|  21 /* GETOPT_LONG_OPTION_T: The type of long option */ |  23 /* GETOPT_LONG_OPTION_T: The type of long option */ | 
|  22 typedef struct GETOPT_LONG_OPTION_T |  24 typedef struct GETOPT_LONG_OPTION_T | 
|  23 { |  25 { | 
|  24   const char *name;             /* the name of the long option */ |  26   const char *name;             /* the name of the long option */ | 
|  25   int has_arg;                  /* one of the above macros */ |  27   int has_arg;                  /* one of the above macros */ | 
|  26   int *flag;                    /* determines if getopt_long() returns a |  28   int *flag;                    /* determines if getopt_long() returns a | 
|  27                                  * value for a long option; if it is |  29                                  * value for a long option; if it is | 
|  28                                  * non-NULL, 0 is returned as a function |  30                                  * non-NULL, 0 is returned as a function | 
|  29                                  * value and the value of val is stored in |  31                                  * value and the value of val is stored in | 
|  30                                  * the area pointed to by flag.  Otherwise, |  32                                  * the area pointed to by flag.  Otherwise, | 
|  31                                  * val is returned. */ |  33                                  * val is returned. */ | 
|  32   int val;                      /* determines the value to return if flag is |  34   int val;                      /* determines the value to return if flag is | 
|  33                                  * NULL. */ |  35                                  * NULL. */ | 
|  34 } GETOPT_LONG_OPTION_T; |  36 } GETOPT_LONG_OPTION_T; | 
|  35  |  37  | 
|  36 typedef GETOPT_LONG_OPTION_T option; |  38 typedef GETOPT_LONG_OPTION_T option; | 
|  37  |  39  | 
|  38 #ifdef __cplusplus |  40 /* externally-defined variables */ | 
|  39 extern "C" |  41 extern char *optarg; | 
|  40 { |  42 extern int optind; | 
|  41 #endif |  43 extern int opterr; | 
 |  44 extern int optopt; | 
|  42  |  45  | 
|  43   /* externally-defined variables */ |  46 /* function prototypes */ | 
|  44   extern char *optarg; |  47 int getopt(int argc, char** argv, char* optstring); | 
|  45   extern int optind; |  48 int getopt_long(int argc, | 
|  46   extern int opterr; |  49                 char** argv, | 
|  47   extern int optopt; |  50                 const char* shortopts, | 
 |  51                 const GETOPT_LONG_OPTION_T* longopts, | 
 |  52                 int* longind); | 
 |  53 int getopt_long_only(int argc, | 
 |  54                      char** argv, | 
 |  55                      const char* shortopts, | 
 |  56                      const GETOPT_LONG_OPTION_T* longopts, | 
 |  57                      int* longind); | 
|  48  |  58  | 
|  49   /* function prototypes */ |  59 }  // namespace crashpad | 
|  50   int getopt (int argc, char **argv, char *optstring); |  | 
|  51   int getopt_long (int argc, char **argv, const char *shortopts, |  | 
|  52                    const GETOPT_LONG_OPTION_T * longopts, int *longind); |  | 
|  53   int getopt_long_only (int argc, char **argv, const char *shortopts, |  | 
|  54                         const GETOPT_LONG_OPTION_T * longopts, int *longind); |  | 
|  55  |  | 
|  56 #ifdef __cplusplus |  | 
|  57 }; |  | 
|  58  |  | 
|  59 #endif |  | 
|  60  |  60  | 
|  61 #endif /* GETOPT_H */ |  61 #endif /* GETOPT_H */ | 
|  62  |  62  | 
|  63 /* END OF FILE getopt.h */ |  63 /* END OF FILE getopt.h */ | 
| OLD | NEW |