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-- blame download

0123456789101112131415161718192021222324252627282930313233343536
// util/optget.h, version 1.6.2
// optget header file from libutil
// Copyright (C) 2020, Jakob Wakeling
// MIT Licence

#ifndef UTIL_OPTGET_H_W3LIZK1S
#define UTIL_OPTGET_H_W3LIZK1S

#ifdef __cplusplus
extern "C" {
#endif

#define ARG_NUL 0
#define ARG_REQ 1
#define ARG_OPT 2

struct lop {
	char *str;
	int arg, val;
};

struct opt {
	int ind, opt, pos, nop;
	char *arg, *lop, *str;
	struct lop *lops;
};

extern const struct opt OPTGET_INIT;

extern int optget(struct opt *opt, char *av[], int flags);

#ifdef __cplusplus
} // extern "C"
#endif

#endif // UTIL_OPTGET_H_W3LIZK1S