Disk ARchive
2.4.5
|
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 : http://dar.linux.free.fr/email.html 00020 /*********************************************************************/ 00021 // $Id$ 00022 // 00023 /*********************************************************************/ 00024 00028 00029 00030 #ifndef MY_GETOPT_LONG_H 00031 #define MY_GETOPT_LONG_H 00032 00033 // getopt may be declated in <unistd.h> on systems like FreeBSD. 00034 // if you want to use libgnugetopt you need to include <getopt.h> 00035 // on this system. Thus a conflict appear because the getopt is 00036 // declared twice. To avoid you either have not to include <unistd.h> 00037 // or not to include <getopt.h>. But neither the first nor the 00038 // second is acceptable, because we need other stuf declared in 00039 // <unistd.h> (open() & so on) and stuf declared in <getopt.h> 00040 // (like getopt_long which is gnu typical). 00041 // 00042 // to solve this problem, I have extracted the gnu getopt_long 00043 // as declared under Linux in the present file. When getopt is 00044 // declared in <unistd.h> it is still possible to include the 00045 // current file in place of <getopt.h>, to get getopt_long available 00046 // 00047 // at linking time, if libgnugetopt is available we use it 00048 // 00049 // see getopt_decision.hpp 00050 00051 # define no_argument 0 00052 # define required_argument 1 00053 # define optional_argument 2 00054 00055 struct option 00056 { 00057 # if defined __STDC__ && __STDC__ 00058 const char *name; 00059 # else 00060 char *name; 00061 # endif 00062 /* has_arg can't be an enum because some compilers complain about 00063 type mismatches in all the code that assumes it is an int. */ 00064 int has_arg; 00065 int *flag; 00066 int val; 00067 }; 00068 00069 extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, 00070 const struct option *__longopts, int *__longind); 00071 00072 00073 #endif