os/ossrv/genericopenlibs/openenvcore/include/getopt.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/getopt.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,99 @@
     1.4 +/*	$NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $	*/
     1.5 +/*	$FreeBSD: src/include/getopt.h,v 1.6 2004/02/24 08:09:20 ache Exp $ */
     1.6 +
     1.7 +/*-
     1.8 + * Copyright (c) 2000 The NetBSD Foundation, Inc.
     1.9 + * All rights reserved.
    1.10 + *
    1.11 + * This code is derived from software contributed to The NetBSD Foundation
    1.12 + * by Dieter Baron and Thomas Klausner.
    1.13 + *
    1.14 + * Redistribution and use in source and binary forms, with or without
    1.15 + * modification, are permitted provided that the following conditions
    1.16 + * are met:
    1.17 + * 1. Redistributions of source code must retain the above copyright
    1.18 + *    notice, this list of conditions and the following disclaimer.
    1.19 + * 2. Redistributions in binary form must reproduce the above copyright
    1.20 + *    notice, this list of conditions and the following disclaimer in the
    1.21 + *    documentation and/or other materials provided with the distribution.
    1.22 + * 4. Neither the name of The NetBSD Foundation nor the names of its
    1.23 + *    contributors may be used to endorse or promote products derived
    1.24 + *    from this software without specific prior written permission.
    1.25 + *
    1.26 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    1.27 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    1.28 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    1.29 + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    1.30 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    1.31 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    1.32 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    1.33 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    1.34 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.35 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.36 + * POSSIBILITY OF SUCH DAMAGE.
    1.37 +* Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
    1.38 + */
    1.39 +
    1.40 +#ifndef _GETOPT_H_
    1.41 +#define _GETOPT_H_
    1.42 +
    1.43 +#include <sys/cdefs.h>
    1.44 +
    1.45 +/*
    1.46 + * GNU-like getopt_long()/getopt_long_only() with 4.4BSD optreset extension.
    1.47 + * getopt() is declared here too for GNU programs.
    1.48 + */
    1.49 +#define no_argument        0
    1.50 +#define required_argument  1
    1.51 +#define optional_argument  2
    1.52 +
    1.53 +struct option {
    1.54 +	/* name of long option */
    1.55 +	const char *name;
    1.56 +	/*
    1.57 +	 * one of no_argument, required_argument, and optional_argument:
    1.58 +	 * whether option takes an argument
    1.59 +	 */
    1.60 +	int has_arg;
    1.61 +	/* if not NULL, set *flag to val when option found */
    1.62 +	int *flag;
    1.63 +	/* if flag not NULL, value to set *flag to; else return value */
    1.64 +	int val;
    1.65 +};
    1.66 +
    1.67 +__BEGIN_DECLS
    1.68 +IMPORT_C int	getopt_long(int, char * const *, const char *,
    1.69 +	const struct option *, int *);
    1.70 +#ifndef _GETOPT_DECLARED
    1.71 +#define	_GETOPT_DECLARED
    1.72 +IMPORT_C int	 getopt(int, char * const [], const char *);
    1.73 +
    1.74 +#ifndef __SYMBIAN32__
    1.75 +extern char *optarg;			/* getopt(3) external variables */
    1.76 +extern int optind, opterr, optopt;
    1.77 +#else
    1.78 +IMPORT_C int *__optopt(void);
    1.79 +IMPORT_C int *__opterr(void);
    1.80 +IMPORT_C int *__optind(void);
    1.81 +IMPORT_C char **__optarg(void);
    1.82 +#define optopt	  (*__optopt())
    1.83 +#define opterr	  (*__opterr())
    1.84 +#define optind	  (*__optind())
    1.85 +#define optarg	  (*__optarg())
    1.86 +#endif /* __SYMBIAN32__ */
    1.87 +
    1.88 +#endif /* _GETOPT_DECLARED */
    1.89 +#ifndef _OPTRESET_DECLARED
    1.90 +#define	_OPTRESET_DECLARED
    1.91 +
    1.92 +#ifndef __SYMBIAN32__
    1.93 +extern int optreset;			/* getopt(3) external variable */
    1.94 +#else
    1.95 +IMPORT_C int *__optreset(void);
    1.96 +#define optreset  (*__optreset())
    1.97 +#endif /* __SYMBIAN32__ */
    1.98 +
    1.99 +#endif /*_OPTRESET_DECLARED */
   1.100 +__END_DECLS
   1.101 + 
   1.102 +#endif /* !_GETOPT_H_ */