Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.4 KiB

  1. /*** parsearg.h - Exported definitions for parsearg.c
  2. *
  3. * Copyright (c) 1996,1997 Microsoft Corporation
  4. * Author: Michael Tsang (MikeTs)
  5. * Created: 09/05/96
  6. *
  7. * MODIFICATION HISTORY
  8. */
  9. #ifndef _PARSEARG_H
  10. #define _PARSEARG_H
  11. // Error codes
  12. #define ARGERR_NONE 0
  13. #define ARGERR_UNKNOWN_SWITCH 1
  14. #define ARGERR_NO_SEPARATOR 2
  15. #define ARGERR_INVALID_NUM 3
  16. #define ARGERR_INVALID_TAIL 4
  17. #define DEF_SWITCHCHARS "/-"
  18. #define DEF_SEPARATORS ":="
  19. typedef struct argtype_s ARGTYPE;
  20. typedef ARGTYPE * PARGTYPE;
  21. typedef int (*PFNARG)(char **, PARGTYPE);
  22. // Argument types
  23. #define AT_STRING 1
  24. #define AT_NUM 2
  25. #define AT_ENABLE 3
  26. #define AT_DISABLE 4
  27. #define AT_ACTION 5
  28. //Parse flags
  29. #define PF_NOI 0x0001 //No-Ignore-Case
  30. #define PF_SEPARATOR 0x0002 //parse for separator
  31. struct argtype_s
  32. {
  33. char *pszArgID; //argument ID string
  34. unsigned uArgType; //see argument types defined above
  35. unsigned uParseFlags; //see parse flags defined above
  36. VOID *pvArgData; //ARG_STRING: (char **) - ptr to string ptr
  37. //ARG_NUM: (int *) - ptr to integer number
  38. //ARG_ENABLE: (unsigned *) - ptr to flags
  39. //ARG_DISABLE: (unsigned *) - ptr to flags
  40. //ARG_ACTION: ptr to function
  41. unsigned uArgParam; //ARG_STRING: none
  42. //ARG_NUM: base
  43. //ARG_ENABLE: flag bit mask
  44. //ARG_DISABLE: flag bit mask
  45. //ARG_ACTION: none
  46. PFNARG pfnArgVerify; //pointer to argument verification function
  47. //this will be ignored for ARG_ACTION
  48. };
  49. typedef struct proginfo_s
  50. {
  51. char *pszSwitchChars; //if null, DEF_SWITCHCHARS is used
  52. char *pszSeparators; //if null, DEF_SEPARATORS is used
  53. char *pszProgPath; //ParseProgInfo set this ptr to prog. path
  54. char *pszProgName; //ParseProgInfo set this ptr to prog. name
  55. } PROGINFO;
  56. typedef PROGINFO *PPROGINFO;
  57. //Export function prototypes
  58. VOID EXPORT ParseProgInfo(char *, PPROGINFO);
  59. int EXPORT ParseSwitches(int *, char ***, PARGTYPE, PPROGINFO);
  60. #endif //ifndef _PARSEARG_H