blob: 770e1e04a39ec378b9798b1528c5c34383590771 [file] [log] [blame] [raw]
/* A getopt implementation with GNU extensions
Copyright 2007-2015 PC GO Ld.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*/
#ifndef _GETOPT_H
#define _GETOPT_H
#ifdef __cplusplus
extern "C" {
#endif
extern char *optarg; /* pointer to argument of current option */
extern int optind; /* index of first non-option in argv */
extern int optopt; /* single option character, as parsed */
extern int opterr; /* flag to enable built-in diagnostics... */
/* (user may set to zero, to suppress) */
struct option {
const char *name;
int has_arg;
int *flag;
int val;
};
#define no_argument 0
#define required_argument 1
#define optional_argument 2
extern int getopt(int, char *const *, const char *);
extern int getopt_long(int, char *const *, const char *, const struct option *, int *);
extern int getopt_long_only(int, char *const *, const char *, const struct option *, int *);
#ifdef __cplusplus
}
#endif
#endif