1 /* 2 * This file is part of the flashrom project. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 */ 14 15 #ifndef CLI_CLASSIC_H 16 #define CLI_CLASSIC_H 17 18 #ifdef HAVE_GETOPT_H 19 #include <getopt.h> 20 #else 21 22 #define no_argument 0 23 #define required_argument 1 24 #define optional_argument 2 25 26 extern char *optarg; 27 extern int optind, opterr, optopt; 28 29 struct option { 30 const char *name; 31 int has_arg; 32 int *flag; 33 int val; 34 }; 35 36 int getopt (int argc, char *const *argv, const char *shortopts); 37 int getopt_long (int argc, char *const *argv, const char *shortopts, 38 const struct option *longopts, int *longind); 39 int getopt_long_only (int argc, char *const *argv, const char *shortopts, 40 const struct option *longopts, int *longind); 41 42 #endif /* HAVE_GETOPT_H */ 43 #endif /* CLI_CLASSIC_H */ 44