getopt.h

Go to the documentation of this file.
00001 /*      $NetBSD: getopt.h,v 1.7 2005/02/03 04:39:32 perry Exp $ */
00002 
00003 /*-
00004  * Copyright (c) 2000 The NetBSD Foundation, Inc.
00005  * All rights reserved.
00006  *
00007  * This code is derived from software contributed to The NetBSD Foundation
00008  * by Dieter Baron and Thomas Klausner.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. All advertising materials mentioning features or use of this software
00019  *    must display the following acknowledgement:
00020  *        This product includes software developed by the NetBSD
00021  *        Foundation, Inc. and its contributors.
00022  * 4. Neither the name of The NetBSD Foundation nor the names of its
00023  *    contributors may be used to endorse or promote products derived
00024  *    from this software without specific prior written permission.
00025  *
00026  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
00027  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00028  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
00030  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00031  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00032  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00033  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00034  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00035  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00036  * POSSIBILITY OF SUCH DAMAGE.
00037  */
00038 
00039 #ifndef _GETOPT_H_
00040 #define _GETOPT_H_
00041 
00042 #include <unistd.h>
00043 
00044 #define no_argument        0
00045 #define required_argument  1
00046 #define optional_argument  2
00047 
00048 extern char *optarg;
00049 extern int optind, opterr, optopt;
00050 
00051 struct option {
00052         /* name of long option */
00053         const char *name;
00054         /*
00055          * one of no_argument, required_argument, and optional_argument:
00056          * whether option takes an argument
00057          */
00058         int has_arg;
00059         /* if not NULL, set *flag to val when option found */
00060         int *flag;
00061         /* if flag not NULL, value to set *flag to; else return value */
00062         int val;
00063 };
00064 
00065 int getopt_long(int, char * const *, const char *,
00066     const struct option *, int *);
00067 
00068 #endif /* !_GETOPT_H_ */

Generated on Sat Jun 30 23:12:16 2007 for pspsdk-1.0+beta2 by  doxygen 1.5.1