source: mainline/uspace/lib/c/include/getopt.h@ cd1e3fc0

Last change on this file since cd1e3fc0 was cd1e3fc0, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Manually update getopt() license

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 * SPDX-FileCopyrightText: 2000 The NetBSD Foundation, Inc.
3 * SPDX-FileCopyrightText: 2008 Tim Post
4 *
5 * SPDX-License-Identifier: BSD-3-Clause AND LicenseRef-GetOptLicense
6 */
7
8/* $NetBSD: getopt.h,v 1.10.6.1 2008/05/18 12:30:09 yamt Exp $ */
9
10/* Ported to HelenOS August 2008 by Tim Post <echo@echoreply.us> */
11
12#ifndef _GETOPT_H_
13#define _GETOPT_H_
14
15/*
16 * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
17 */
18#define no_argument 0
19#define required_argument 1
20#define optional_argument 2
21
22struct option {
23 /* name of long option */
24 const char *name;
25 /*
26 * one of no_argument, required_argument, and optional_argument:
27 * whether option takes an argument
28 */
29 int has_arg;
30 /* if not NULL, set *flag to val when option found */
31 int *flag;
32 /* if flag not NULL, value to set *flag to; else return value */
33 int val;
34};
35
36/* HelenOS Port - These need to be exposed for legacy getopt() */
37extern char *optarg;
38extern int optind, opterr, optopt;
39extern int optreset;
40
41int getopt_long(int, char *const *, const char *,
42 const struct option *, int *);
43
44/* HelenOS Port : Expose legacy getopt() */
45int getopt(int, char *const [], const char *);
46
47#endif /* !_GETOPT_H_ */
Note: See TracBrowser for help on using the repository browser.