0
|
1 /*
|
|
2 * Simple commandline argument processing functions
|
|
3 * Programmed and designed by Matti 'ccr' Hamalainen
|
|
4 * (C) Copyright 2002-2008 Tecnic Software productions (TNSP)
|
|
5 *
|
|
6 * Please read file 'COPYING' for information on license and distribution.
|
|
7 */
|
|
8 #ifndef DMARGS_H
|
|
9 #define DMARGS_H
|
|
10
|
|
11 #include "dmlib.h"
|
|
12 #include <stdio.h>
|
|
13
|
|
14 #ifdef __cplusplus
|
|
15 extern "C" {
|
|
16 #endif
|
|
17
|
|
18 /* Option flags
|
|
19 */
|
|
20 #define OPT_NONE (0) // Simple option with no arguments
|
|
21 #define OPT_ARGREQ (1) // Option's argument is required
|
|
22 #define OPT_ARGOPT (3) // Option's argument is optional
|
|
23 #define OPT_ARGMASK (3) // Mask for option argument flags
|
|
24 #define OPT_REQUIRED (4) // This option is required to be given
|
|
25
|
|
26 typedef struct {
|
|
27 int id;
|
|
28 char optShort;
|
|
29 char *optLong;
|
|
30 char *desc;
|
|
31 int flags;
|
|
32 } DMOptArg;
|
|
33
|
|
34 BOOL dmArgsProcess(int argc, char *argv[],
|
|
35 DMOptArg argList[], int argListN,
|
|
36 BOOL (*handleOpt)(int, char *, char *),
|
|
37 BOOL (*handleFile)(char *), BOOL);
|
|
38
|
|
39 void dmArgsPrintHelp(FILE *, DMOptArg optList[], int optListN);
|
|
40
|
|
41 #ifdef __cplusplus
|
|
42 }
|
|
43 #endif
|
|
44 #endif // DMARGS_H
|