gwenhywfar
4.3.3
|
00001 /*************************************************************************** 00002 $RCSfile$ 00003 ------------------- 00004 cvs : $Id$ 00005 begin : Sat Apr 24 2004 00006 copyright : (C) 2004 by Martin Preuss 00007 email : martin@libchipcard.de 00008 00009 *************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2.1 of the License, or (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00019 * Lesser General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00024 * MA 02111-1307 USA * 00025 * * 00026 ***************************************************************************/ 00027 00028 #ifndef GWENHYWFAR_ARGS_H 00029 #define GWENHYWFAR_ARGS_H 00030 00031 #include <gwenhywfar/gwenhywfarapi.h> 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 typedef struct GWEN_ARGS GWEN_ARGS; 00037 #ifdef __cplusplus 00038 } 00039 #endif 00040 00041 #include <gwenhywfar/types.h> 00042 #include <gwenhywfar/buffer.h> 00043 #include <gwenhywfar/db.h> 00044 00045 #ifdef __cplusplus 00046 extern "C" { 00047 #endif 00048 00049 00050 #define GWEN_ARGS_FLAGS_HAS_ARGUMENT 0x00000001 00051 #define GWEN_ARGS_FLAGS_LAST 0x00000002 00052 #define GWEN_ARGS_FLAGS_HELP 0x00000004 00053 00054 #define GWEN_ARGS_MODE_ALLOW_FREEPARAM 0x00000001 00055 #define GWEN_ARGS_MODE_STOP_AT_FREEPARAM 0x00000002 00056 00057 #define GWEN_ARGS_RESULT_ERROR (-1) 00058 #define GWEN_ARGS_RESULT_HELP (-2) 00059 00060 00061 typedef enum { 00062 GWEN_ArgsType_Char=0, 00063 GWEN_ArgsType_Int 00064 } GWEN_ARGS_TYPE; 00065 00066 typedef enum { 00067 GWEN_ArgsOutType_Txt=0, 00068 GWEN_ArgsOutType_Html 00069 } GWEN_ARGS_OUTTYPE; 00070 00071 00078 struct GWEN_ARGS { 00079 uint32_t flags; 00080 GWEN_ARGS_TYPE type; 00081 const char *name; 00082 unsigned int minNum; 00083 unsigned int maxNum; 00084 const char *shortOption; 00085 const char *longOption; 00086 const char *shortDescription; 00087 const char *longDescription; 00088 }; 00089 00090 00097 GWENHYWFAR_API 00098 int GWEN_Args_Check(int argc, char **argv, 00099 int startAt, 00100 uint32_t mode, 00101 const GWEN_ARGS *args, 00102 GWEN_DB_NODE *db); 00103 00109 GWENHYWFAR_API 00110 int GWEN_Args_Usage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf, 00111 GWEN_ARGS_OUTTYPE ot); 00112 00114 GWENHYWFAR_API 00115 int GWEN_Args_ShortUsage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf, 00116 GWEN_ARGS_OUTTYPE ot); 00117 00118 #ifdef __cplusplus 00119 } 00120 #endif 00121 00122 00123 #endif /* GWENHYWFAR_ARGS_H */ 00124 00125 00126