1 /* 2 getopt_long.h - definition of getopt_long() for systems that lack it 3 4 Copyright (C) 2002 Arthur de Jong 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 22 #ifndef _GETOPT_LONG_H 23 #define _GETOPT_LONG_H 1 24 25 26 #define no_argument 0 27 #define required_argument 1 28 #define optional_argument 2 29 30 31 struct option { 32 const char *name; 33 int has_arg; 34 int *flag; 35 int val; 36 }; 37 38 39 /* this is a (poor) getopt_long() replacement for systems that don't have it 40 (this is generaly a GNU extention) 41 this implementation is by no meens flawless, especialy the optional arguments 42 to options and options following filenames is not quite right, allso 43 minimal error checking 44 */ 45 int getopt_long(int argc,char * const argv[], 46 const char *optstring, 47 const struct option *longopts,int *longindex); 48 49 50 #endif /* _GETOPT_LONG_H */ 51