changed included getopt to https://github.com/freebsd/freebsd/blob/master/include/getopt.h (getopt from freebsd with simplified BSD license)

This commit is contained in:
merlokk 2018-08-21 13:53:35 +03:00
commit 71a5a1c066

View file

@ -166,11 +166,12 @@ void dbg_printf(const char *fmt, ...)
va_end(args); va_end(args);
} }
/* $Id: getopt.h,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $ */
/* $OpenBSD: getopt.h,v 1.1 2002/12/03 20:24:29 millert Exp $ */
/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */ /* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */
/* $FreeBSD$ */
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
*
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
* *
@ -185,13 +186,6 @@ void dbg_printf(const char *fmt, ...)
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@ -209,12 +203,11 @@ void dbg_printf(const char *fmt, ...)
#ifndef _GETOPT_H_ #ifndef _GETOPT_H_
#define _GETOPT_H_ #define _GETOPT_H_
#if 0
#include <sys/cdefs.h> #include <sys/cdefs.h>
#endif
/* /*
* GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions * GNU-like getopt_long()/getopt_long_only() with 4.4BSD optreset extension.
* getopt() is declared here too for GNU programs.
*/ */
#define no_argument 0 #define no_argument 0
#define required_argument 1 #define required_argument 1
@ -234,30 +227,24 @@ struct option {
int val; int val;
}; };
#ifdef __cplusplus __BEGIN_DECLS
extern "C" { int getopt_long(int, char * const *, const char *,
const struct option *, int *);
int getopt_long_only(int, char * const *, const char *,
const struct option *, int *);
#ifndef _GETOPT_DECLARED
#define _GETOPT_DECLARED
int getopt(int, char * const [], const char *);
extern char *optarg; /* getopt(3) external variables */
extern int optind, opterr, optopt;
#endif #endif
#ifndef _OPTRESET_DECLARED
int getopt_long(int, char * const *, const char *, #define _OPTRESET_DECLARED
const struct option *, int *); extern int optreset; /* getopt(3) external variable */
int getopt_long_only(int, char * const *, const char *,
const struct option *, int *);
#ifndef _GETOPT_DEFINED
#define _GETOPT_DEFINED
int getopt(int, char * const *, const char *);
int getsubopt(char **, char * const *, char **);
extern char *optarg; /* getopt(3) external variables */
extern int opterr;
extern int optind;
extern int optopt;
extern int optreset;
extern char *suboptarg; /* getsubopt(3) external variable */
#endif /* _GETOPT_DEFINED */
#ifdef __cplusplus
}
#endif #endif
__END_DECLS
#endif /* !_GETOPT_H_ */ #endif /* !_GETOPT_H_ */
/* $Id: getopt_long.c,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $ */ /* $Id: getopt_long.c,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $ */
/* $OpenBSD: getopt_long.c,v 1.23 2007/10/31 12:34:57 chl Exp $ */ /* $OpenBSD: getopt_long.c,v 1.23 2007/10/31 12:34:57 chl Exp $ */