summaryrefslogtreecommitdiff
path: root/Libraries/LibC/getopt.h
blob: caad05366e8edb53a94c21bdb49a9155130a1548 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include <sys/cdefs.h>

#define no_argument        0
#define required_argument  1
#define optional_argument  2

struct option {
    const char *name;
    int has_arg;
    int* flag;
    int val;
};

__BEGIN_DECLS

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;
extern int optind;
extern int opterr;
extern int optopt;
#endif

#ifndef _OPTRESET_DECLARED
#define	_OPTRESET_DECLARED
extern int optreset;
#endif

__END_DECLS