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