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.

45 lines
626 B

  1. #include "stdafx.h"
  2. #include "cmd.h"
  3. CCmd::CCmd()
  4. {
  5. m_argc = 0;
  6. m_argv = NULL;
  7. }
  8. CCmd::~CCmd()
  9. {
  10. }
  11. CCmd::bInit(int argc, LPSTR argv[])
  12. {
  13. m_argc = argc;
  14. m_argv = argv;
  15. return ParseCmdLine();
  16. }
  17. BOOL CCmd::ParseCmdLine()
  18. {
  19. int argc;
  20. LPTSTR *argv;
  21. argc = m_argc;
  22. argv = m_argv;
  23. if (argc > 1) {
  24. argc--;
  25. argv++;
  26. } else {
  27. return FALSE;
  28. }
  29. while(argc) {
  30. if (ProcessToken(*argv)) {
  31. argc--;
  32. argv++;
  33. } else {
  34. return FALSE;
  35. }
  36. }
  37. return TRUE;
  38. }