00001 /*********************************************************************/ 00002 // dar - disk archive - a backup/restoration program 00003 // Copyright (C) 2002-2052 Denis Corbin 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program 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 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00019 // to contact the author : dar.linux@free.fr 00020 /*********************************************************************/ 00021 // $Id: my_getopt_long.h,v 1.2 2004/03/15 14:31:52 edrusb Rel $ 00022 // 00023 /*********************************************************************/ 00024 00025 #ifndef MY_GETOPT_LONG_H 00026 #define MY_GETOPT_LONG_H 00027 00028 // getopt may be declated in <unistd.h> on systems like FreeBSD. 00029 // if you want to use libgnugetopt you need to include <getopt.h> 00030 // on this system. Thus a conflict appear because the getopt is 00031 // declared twice. To avoid you either have not to include <unistd.h> 00032 // or not to include <getopt.h>. But neither the first nor the 00033 // second is acceptable, because we need other stuf declared in 00034 // <unistd.h> (open() & so on) and stuf declared in <getopt.h> 00035 // (like getopt_long which is gnu typical). 00036 // 00037 // to solve this problem, I have extracted the gnu getopt_long 00038 // as declared under Linux in the present file. When getopt is 00039 // declared in <unistd.h> it is still possible to include the 00040 // current file in place of <getopt.h>, to get getopt_long available 00041 // 00042 // at linking time, if libgnugetopt is available we use it 00043 // 00044 // see getopt_decision.hpp 00045 00046 # define no_argument 0 00047 # define required_argument 1 00048 # define optional_argument 2 00049 00050 struct option 00051 { 00052 # if defined __STDC__ && __STDC__ 00053 const char *name; 00054 # else 00055 char *name; 00056 # endif 00057 /* has_arg can't be an enum because some compilers complain about 00058 type mismatches in all the code that assumes it is an int. */ 00059 int has_arg; 00060 int *flag; 00061 int val; 00062 }; 00063 00064 extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, 00065 const struct option *__longopts, int *__longind); 00066 00067 00068 #endif