1 /****************************************************************************/ 2 /* getopts.h */ 3 /****************************************************************************/ 4 /* */ 5 /* GET OPTionS from the command line */ 6 /* */ 7 /* Copyright (C) 1992-1994 Tomas Skalicky. All rights reserved. */ 8 /* */ 9 /****************************************************************************/ 10 11 #ifndef GETOPTS_H 12 #define GETOPTS_H 13 14 #include <stddef.h> 15 16 typedef enum { 17 BoolOptType, 18 CharOptType, 19 IntOptType, 20 SizeOptType, 21 StrOptType 22 } OptType; /* option type */ 23 24 typedef struct { 25 char KeyChar; 26 OptType Type; 27 void *Variable; 28 } OptDescrType; /* option description type */ 29 30 typedef struct { 31 int No; 32 OptDescrType *Descr; 33 } OptTabType; /* options table type */ 34 35 typedef enum { 36 OptOK, 37 OptNotDefErr, 38 OptSyntaxErr, 39 OptDescrErr 40 } OptErrType; /* error type for options analysis */ 41 42 void GetOpts(int *argc, char **argv, OptTabType *OptTab); 43 void SetMaxStrLen(size_t Len); 44 OptErrType OptResult(void); 45 46 #endif /* GETOPTS_H */ 47