libnet: getopt.h Source File

Main Page | Data Structures | File List | Data Fields | Globals

# getopt.h

    00001 /*
    00002  * Copyright (c) 1987, 1993, 1994, 1996
    00003  *  The Regents of the University of California.  All rights reserved.
    00004  *
    00005  * Redistribution and use in source and binary forms, with or without
    00006  * modification, are permitted provided that the following conditions
    00007  * are met:
    00008  * 1. Redistributions of source code must retain the above copyright
    00009  *    notice, this list of conditions and the following disclaimer.
    00010  * 2. Redistributions in binary form must reproduce the above copyright
    00011  *    notice, this list of conditions and the following disclaimer in the
    00012  *    documentation and/or other materials provided with the distribution.
    00013  * 3. All advertising materials mentioning features or use of this software
    00014  *    must display the following acknowledgement:
    00015  *  This product includes software developed by the University of
    00016  *  California, Berkeley and its contributors.
    00017  * 4. Neither the name of the University nor the names of its contributors
    00018  *    may be used to endorse or promote products derived from this software
    00019  *    without specific prior written permission.
    00020  *
    00021  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    00022  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    00024  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    00025  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    00026  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    00027  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00028  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    00029  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    00030  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    00031  * SUCH DAMAGE.
    00032  */
    00033
    00034 #ifndef __GETOPT_H__
    00035 #define __GETOPT_H__
    00036
    00037 #ifdef __cplusplus
    00038 extern "C" {
    00039 #endif
    00040
    00041 extern int   opterr;      /* if error message should be printed */
    00042 extern int   optind;      /* index into parent argv vector */
    00043 extern int   optopt;      /* character checked for validity */
    00044 extern int   optreset;    /* reset getopt */
    00045 extern char *optarg;      /* argument associated with option */
    00046
    00047 int getopt (int, char * const *, const char *);
    00048
    00049 #ifdef __cplusplus
    00050 }
    00051 #endif
    00052
    00053 #endif /* __GETOPT_H__ */
    00054
    00055 #ifndef __UNISTD_GETOPT__
    00056 #ifndef __GETOPT_LONG_H__
    00057 #define __GETOPT_LONG_H__
    00058
    00059 #ifdef __cplusplus
    00060 extern "C" {
    00061 #endif
    00062
    00063 struct option {
    00064     const char *name;
    00065     int  has_arg;
    00066     int *flag;
    00067     int val;
    00068 };
    00069
    00070 int getopt_long (int, char *const *, const char *, const struct option *, int *);
    00071 #ifndef HAVE_DECL_GETOPT
    00072 #define HAVE_DECL_GETOPT 1
    00073 #endif
    00074
    00075 #define no_argument             0
    00076 #define required_argument       1
    00077 #define optional_argument       2
    00078
    00079 #ifdef __cplusplus
    00080 }
    00081 #endif
    00082
    00083 #endif /* __GETOPT_LONG_H__ */
    00084 #endif /* __UNISTD_GETOPT__ */