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.

71 lines
2.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2001.
  5. //
  6. // File: cmdkey: command.h
  7. //
  8. // Contents: Command line parsing functions header
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 07-09-01 georgema Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef __COMMAND_H__
  18. #define __COMMAND_H__
  19. /*
  20. CLInit() passes in an array of switch characters and a count of same. The return value
  21. is FALSE if memory could not be allocated. A default CLInit(void) may be called which
  22. defines all 26 letters, 10 digits, and '?' as permissible switches.
  23. CLParse() parses the command line, locating switches and associating argument strings
  24. with them where appropriate. The return value is FALSE if duplicate switches are found
  25. on the command line. The order of the switches is unimportant to this process, but
  26. read on...
  27. The switch array may be ordered with the principal command switches first to allow
  28. the caller to determine which of these appeared first on the command line. This hack was
  29. inserted to allow differentiation of the diagnostic message that appears if command line
  30. validation fails -- what is the command that the user most likely could use help with?
  31. CLSetMaxPrincipalSwitch() allows the callser to pass in an integer index to define the
  32. set of principal command switches. CLGetPrincipalSwitch will return the index of the
  33. first principal switch found on the command line, or -1 of none. Principal switches are defined
  34. as those of index 0 through the max index defined above. The return value is the previous
  35. set value, initally -1.
  36. CLExtra() returns TRUE if unidentified switches were found on the command line.
  37. CLFlag() returns TRUE if the indexed switch was found
  38. CLPtr() returns the string argument associated with the switch, or NULL if none.
  39. CLUnInit() must be called sometime after CLInit() to release memory allocated by CLInit().
  40. */
  41. BOOL CLInit(void); // with no known good switches array
  42. BOOL CLInit(INT ccSwitches, WCHAR *prgc); // with passed valid switch array and count
  43. BOOL CLParse(void);
  44. INT CLSetMaxPrincipalSwitch(INT);
  45. INT CLGetPrincipalSwitch(void);
  46. BOOL CLExtra(void);
  47. BOOL CLFlag(INT i);
  48. WCHAR *CLPtr(INT i);
  49. void CLUnInit(void);
  50. int CLTokens(void);
  51. WCHAR *CLFirstString(WCHAR *pc);
  52. WCHAR *CLLastString(WCHAR *pc);
  53. // Security export for destroying the command line information
  54. void StompCommandLine(INT argc, char **argv);
  55. // Internal APIs for use within command.cpp
  56. WCHAR *TestSwitch(WCHAR *pCmdLine,WCHAR cin);
  57. WCHAR *FetchSwitchString(WCHAR *origin);
  58. #endif