1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License as
4 * published by the Free Software Foundation; either version 2 of
5 * the License, or (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
15 * MA 02111-1307 USA
16 */
17/*	$NetBSD: getopt.h,v 1.7 2005/02/03 04:39:32 perry Exp $	*/
18
19/*-
20 * Copyright (c) 2000 The NetBSD Foundation, Inc.
21 * All rights reserved.
22 *
23 * This code is derived from software contributed to The NetBSD Foundation
24 * by Dieter Baron and Thomas Klausner.
25 *
26 * Redistribution and use in source and binary forms, with or without
27 * modification, are permitted provided that the following conditions
28 * are met:
29 * 1. Redistributions of source code must retain the above copyright
30 *    notice, this list of conditions and the following disclaimer.
31 * 2. Redistributions in binary form must reproduce the above copyright
32 *    notice, this list of conditions and the following disclaimer in the
33 *    documentation and/or other materials provided with the distribution.
34 * 3. All advertising materials mentioning features or use of this software
35 *    must display the following acknowledgement:
36 *        This product includes software developed by the NetBSD
37 *        Foundation, Inc. and its contributors.
38 * 4. Neither the name of The NetBSD Foundation nor the names of its
39 *    contributors may be used to endorse or promote products derived
40 *    from this software without specific prior written permission.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
43 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
44 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
45 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
46 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
47 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
48 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
49 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
50 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
52 * POSSIBILITY OF SUCH DAMAGE.
53 */
54
55/*
56 * modified May 12, 2005 by Jim Basney <jbasney@ncsa.uiuc.edu>
57 *
58 * removed #include of non-POSIX <sys/cdefs.h> and <sys/featuretest.h>
59 * removed references to _NETBSD_SOURCE and HAVE_NBTOOL_CONFIG_H
60 * added #if !HAVE_GETOPT_LONG
61 * removed __BEGIN_DECLS and __END_DECLS
62 */
63
64#ifndef _MYPROXY_GETOPT_H_
65#define _MYPROXY_GETOPT_H_
66
67#if !HAVE_GETOPT_LONG
68
69#include <unistd.h>
70
71/*
72 * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
73 */
74#define no_argument        0
75#define required_argument  1
76#define optional_argument  2
77
78struct option {
79	/* name of long option */
80	const char *name;
81	/*
82	 * one of no_argument, required_argument, and optional_argument:
83	 * whether option takes an argument
84	 */
85	int has_arg;
86	/* if not NULL, set *flag to val when option found */
87	int *flag;
88	/* if flag not NULL, value to set *flag to; else return value */
89	int val;
90};
91
92int getopt_long(int, char * const *, const char *,
93    const struct option *, int *);
94
95#endif /* !HAVE_GETOPT_LONG */
96
97#endif /* !_MYPROXY_GETOPT_H_ */
98