libutil

C Utility Library
git clone http://git.omkov.net/libutil
Log | Tree | Refs | README | LICENCE | Download

libutil/src/optget.h (37 lines, 582 B) -rw-r--r-- file download

8a5f06f Jamozed 2022-02-09 20:04:50
0
// util/optget.h, version 1.6.2
98e5939 Jamozed 2021-11-27 17:53:46
1
// optget header file from libutil
eb8174b Jamozed 2020-10-26 12:53:02
2
// Copyright (C) 2020, Jakob Wakeling
7f427d9 Jamozed 2022-03-06 12:55:13
3
// MIT Licence
eb8174b Jamozed 2020-10-26 12:53:02
4
98e5939 Jamozed 2021-11-27 17:53:46
5
#ifndef UTIL_OPTGET_H_W3LIZK1S
98e5939 Jamozed 2021-11-27 17:53:46
6
#define UTIL_OPTGET_H_W3LIZK1S
eb8174b Jamozed 2020-10-26 12:53:02
7
8a5f06f Jamozed 2022-02-09 20:04:50
8
#ifdef __cplusplus
8a5f06f Jamozed 2022-02-09 20:04:50
9
extern "C" {
8a5f06f Jamozed 2022-02-09 20:04:50
10
#endif
8a5f06f Jamozed 2022-02-09 20:04:50
11
eb8174b Jamozed 2020-10-26 12:53:02
12
#define ARG_NUL 0
eb8174b Jamozed 2020-10-26 12:53:02
13
#define ARG_REQ 1
eb8174b Jamozed 2020-10-26 12:53:02
14
#define ARG_OPT 2
eb8174b Jamozed 2020-10-26 12:53:02
15
eb8174b Jamozed 2020-10-26 12:53:02
16
struct lop {
eb8174b Jamozed 2020-10-26 12:53:02
17
	char *str;
eb8174b Jamozed 2020-10-26 12:53:02
18
	int arg, val;
eb8174b Jamozed 2020-10-26 12:53:02
19
};
eb8174b Jamozed 2020-10-26 12:53:02
20
eb8174b Jamozed 2020-10-26 12:53:02
21
struct opt {
eb8174b Jamozed 2020-10-26 12:53:02
22
	int ind, opt, pos, nop;
eb8174b Jamozed 2020-10-26 12:53:02
23
	char *arg, *lop, *str;
eb8174b Jamozed 2020-10-26 12:53:02
24
	struct lop *lops;
eb8174b Jamozed 2020-10-26 12:53:02
25
};
eb8174b Jamozed 2020-10-26 12:53:02
26
eb8174b Jamozed 2020-10-26 12:53:02
27
extern const struct opt OPTGET_INIT;
eb8174b Jamozed 2020-10-26 12:53:02
28
eb8174b Jamozed 2020-10-26 12:53:02
29
extern int optget(struct opt *opt, char *av[], int flags);
8a5f06f Jamozed 2022-02-09 20:04:50
30
8a5f06f Jamozed 2022-02-09 20:04:50
31
#ifdef __cplusplus
8a5f06f Jamozed 2022-02-09 20:04:50
32
} // extern "C"
8a5f06f Jamozed 2022-02-09 20:04:50
33
#endif
eb8174b Jamozed 2020-10-26 12:53:02
34
98e5939 Jamozed 2021-11-27 17:53:46
35
#endif // UTIL_OPTGET_H_W3LIZK1S
36