00001 #ifndef _OPTSET_H 00002 #define _OPTSET_H 00003 00004 enum { 00005 OPT_BOOL, 00006 OPT_STRING, 00007 OPT_INT 00008 }; 00009 00010 /* An entry for the parser of an options set. The 'os_name' field must point 00011 * to a string, which is treated case-insensitively; the last entry of a table 00012 * must have NULL name. The 'os_type' field must be set to one of the OPT_ 00013 * values defined above. The 'os_ptr' field must point to the field that is to 00014 * receive the value of a recognized option. For OPT_STRING, it must point to a 00015 * string of a size set in 'os_val'; the resulting string may be truncated, but 00016 * will always be null-terminated. For OPT_BOOL, it must point to an int which 00017 * will be set to the value in 'os_val' if the option is present. For OPT_INT, 00018 * it must point to an int which will be set to the provided option value; 00019 * 'os_val' is then a base passed to strtol(). 00020 */ 00021 struct optset { 00022 char *os_name; 00023 int os_type; 00024 void *os_ptr; 00025 int os_val; 00026 }; 00027 00028 _PROTOTYPE( void optset_parse, (struct optset *table, char *string) ); 00029 00030 #endif /* _OPTSET_H */
1.5.8