1/* $NetBSD: getopt.h,v 1.1.1.1 2021/04/07 02:43:15 christos Exp $ */ 2#ifndef __GETOPT_H__ 3#define __GETOPT_H__ 4 5#ifdef __cplusplus 6extern "C" { 7#endif 8 9extern int opterr; /* if error message should be printed */ 10extern int optind; /* index into parent argv vector */ 11extern int optopt; /* character checked for validity */ 12extern int optreset; /* reset getopt */ 13extern char *optarg; /* argument associated with option */ 14 15struct option 16{ 17 const char *name; 18 int has_arg; 19 int *flag; 20 int val; 21}; 22 23#define no_argument 0 24#define required_argument 1 25#define optional_argument 2 26 27int getopt(int, char**, const char*); 28int getopt_long(int, char**, const char*, const struct option*, int*); 29 30#ifdef __cplusplus 31} 32#endif 33 34#endif /* __GETOPT_H__ */ 35