forked from balika011/prxtool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getargs.h
42 lines (35 loc) · 789 Bytes
/
getargs.h
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
37
38
39
40
41
42
/***************************************************************
* PRXTool : Utility for PSP executables.
* (c) TyRaNiD 2k5
*
* getargs.h - Argument parser
***************************************************************/
#ifndef __GET_ARGS_H__
#define __GET_ARGS_H__
/* Replacement for getopt_long as I think it sucks ;P */
typedef int (*ArgFunc)(const char *opt);
enum ArgTypes
{
ARG_TYPE_INT,
ARG_TYPE_BOOL,
ARG_TYPE_STR,
ARG_TYPE_FUNC,
};
enum ArgOpts
{
ARG_OPT_NONE,
ARG_OPT_REQUIRED,
};
struct ArgEntry
{
const char *full;
char ch;
enum ArgTypes type;
enum ArgOpts opt;
void *argvoid;
int val;
const char *help;
};
#define ARG_COUNT(x) (sizeof(x) / sizeof(struct ArgEntry))
char** GetArgs(int *argc, char **argv, struct ArgEntry *entry, int argcount);
#endif