tw1333.pp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. uses
  2. getopts;
  3. function ParseCmdOptions : boolean;
  4. var
  5. Opts : array [1..3] of POption;
  6. C : char;
  7. Index : Longint;
  8. begin
  9. { assume success }
  10. ParseCmdOptions := true;
  11. { logfile }
  12. New(Opts[1]);
  13. with Opts[1]^ do
  14. begin
  15. name := 'log';
  16. has_arg := 1;
  17. flag := nil;
  18. end;
  19. { debug flag }
  20. New(Opts[2]);
  21. with Opts[2]^ do
  22. begin
  23. name := 'debug';
  24. has_arg := 0;
  25. flag := nil;
  26. end;
  27. { end-of-array }
  28. New(Opts[3]);
  29. with Opts[3]^ do
  30. begin
  31. name := '';
  32. has_arg := 0;
  33. flag := nil
  34. end;
  35. { parse }
  36. repeat
  37. C := GetLongOpts('l:d',Opts[1],Index);
  38. case C of
  39. #0: begin
  40. if Opts[Index]^.name = Opts[1]^.name then { .. };
  41. if Opts[Index]^.name = Opts[2]^.name then { .. };
  42. { handle this properly -- else ParseCmdOptions := false; }
  43. end;
  44. 'l': { .. };
  45. 'd': { .. };
  46. else ParseCmdOptions := false;
  47. end; { case }
  48. until C = endofoptions;
  49. end;
  50. begin
  51. end.