gwenhywfar  4.7.0beta
args.h
Go to the documentation of this file.
1 /***************************************************************************
2  $RCSfile$
3  -------------------
4  cvs : $Id$
5  begin : Sat Apr 24 2004
6  copyright : (C) 2004 by Martin Preuss
7  email : martin@libchipcard.de
8 
9  ***************************************************************************
10  * *
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU Lesser General Public *
13  * License as published by the Free Software Foundation; either *
14  * version 2.1 of the License, or (at your option) any later version. *
15  * *
16  * This library is distributed in the hope that it will be useful, *
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
19  * Lesser General Public License for more details. *
20  * *
21  * You should have received a copy of the GNU Lesser General Public *
22  * License along with this library; if not, write to the Free Software *
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
24  * MA 02111-1307 USA *
25  * *
26  ***************************************************************************/
27 
28 #ifndef GWENHYWFAR_ARGS_H
29 #define GWENHYWFAR_ARGS_H
30 
31 #include <gwenhywfar/gwenhywfarapi.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 typedef struct GWEN_ARGS GWEN_ARGS;
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #include <gwenhywfar/types.h>
42 #include <gwenhywfar/buffer.h>
43 #include <gwenhywfar/db.h>
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 
50 #define GWEN_ARGS_FLAGS_HAS_ARGUMENT 0x00000001
51 #define GWEN_ARGS_FLAGS_LAST 0x00000002
52 #define GWEN_ARGS_FLAGS_HELP 0x00000004
53 
54 #define GWEN_ARGS_MODE_ALLOW_FREEPARAM 0x00000001
55 #define GWEN_ARGS_MODE_STOP_AT_FREEPARAM 0x00000002
56 
57 #define GWEN_ARGS_RESULT_ERROR (-1)
58 #define GWEN_ARGS_RESULT_HELP (-2)
59 
60 
61 typedef enum {
65 
66 typedef enum {
70 
71 
78 struct GWEN_ARGS {
79  uint32_t flags;
81  const char *name;
82  unsigned int minNum;
83  unsigned int maxNum;
84  const char *shortOption;
85  const char *longOption;
86  const char *shortDescription;
87  const char *longDescription;
88 };
89 
90 
98 int GWEN_Args_Check(int argc, char **argv,
99  int startAt,
100  uint32_t mode,
101  const GWEN_ARGS *args,
102  GWEN_DB_NODE *db);
103 
110 int GWEN_Args_Usage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf,
111  GWEN_ARGS_OUTTYPE ot);
112 
115 int GWEN_Args_ShortUsage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf,
116  GWEN_ARGS_OUTTYPE ot);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 
123 #endif /* GWENHYWFAR_ARGS_H */
124 
125 
126