## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# csutil/getopt.h

Go to the documentation of this file.

    00001 /* Declarations for getopt.
    00002    Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
    00003    This file is part of the GNU C Library.
    00004
    00005    The GNU C Library is free software; you can redistribute it and/or
    00006    modify it under the terms of the GNU Library General Public License as
    00007    published by the Free Software Foundation; either version 2 of the
    00008    License, or (at your option) any later version.
    00009
    00010    The GNU C Library is distributed in the hope that it will be useful,
    00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013    Library General Public License for more details.
    00014
    00015    You should have received a copy of the GNU Library General Public
    00016    License along with the GNU C Library; see the file COPYING.LIB.  If not,
    00017    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018    Boston, MA 02111-1307, USA.  */
    00019
    00020 #ifndef __CS_GETOPT_H__
    00021 #define __CS_GETOPT_H__
    00022
    00023 #ifndef __STDC__
    00024 #  define __STDC__ 1
    00025 #endif
    00026
    00027 #include "csextern.h"
    00028
    00033 #if defined(CS_PLATFORM_MACOSX)
    00034 // MacOS/X already has a valid getopt; avoid link errors.
    00035 #define getopt __getopt
    00036 #define optarg __optarg
    00037 #define opterr __opterr
    00038 #define optind __optind
    00039 #define optopt __optopt
    00040 #endif
    00041
    00048 extern CS_CRYSTALSPACE_EXPORT char *optarg;
    00049
    00062 extern CS_CRYSTALSPACE_EXPORT int optind;
    00063
    00067 extern CS_CRYSTALSPACE_EXPORT int opterr;
    00068
    00071 extern CS_CRYSTALSPACE_EXPORT int optopt;
    00072
    00096 struct CS_CRYSTALSPACE_EXPORT getopt_option
    00097 {
    00098 #if defined (__STDC__) && __STDC__
    00099   const char *name;
    00100 #else
    00101   char *name;
    00102 #endif
    00103   /* has_arg can't be an enum because some compilers complain about
    00104      type mismatches in all the code that assumes it is an int.  */
    00105   int has_arg;
    00106   int *flag;
    00107   int val;
    00108 };
    00113 #define option getopt_option
    00114
    00115 /* Names for the values of the `has_arg' field of `struct option'.  */
    00116
    00117 #define no_argument             0
    00118 #define required_argument       1
    00119 #define optional_argument       2
    00120
    00121 extern CS_CRYSTALSPACE_EXPORT int getopt (int argc, char *const *argv,
    00122         const char *shortopts);
    00123 extern CS_CRYSTALSPACE_EXPORT int getopt_long (int argc, char *const *argv,
    00124         const char *shortopts, const struct getopt_option *longopts,
    00125         int *longind);
    00126 extern CS_CRYSTALSPACE_EXPORT int getopt_long_only (int argc,
    00127         char *const *argv, const char *shortopts,
    00128         const struct getopt_option *longopts, int *longind);
    00129
    00130 /* Internal only.  Users should not call this directly.  */
    00131 extern int _getopt_internal (int argc, char *const *argv,
    00132         const char *shortopts,
    00133         const struct getopt_option *longopts, int *longind,
    00134         int long_only);
    00135
    00136 #endif // __CS_GETOPT_H__