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.

102 lines
2.9 KiB

  1. # NOTE: Derived from ../LIB\Getopt\Long.pm.
  2. # Changes made here will be lost when autosplit is run again.
  3. # See AutoSplit.pm.
  4. package Getopt::Long;
  5. #line 920 "../LIB\Getopt\Long.pm (autosplit into ..\lib\auto\Getopt\Long\Configure.al)"
  6. # Getopt::Long Configuration.
  7. sub Configure (@) {
  8. my (@options) = @_;
  9. my $prevconfig =
  10. [ $error, $debug, $major_version, $minor_version,
  11. $autoabbrev, $getopt_compat, $ignorecase, $bundling, $order,
  12. $gnu_compat, $passthrough, $genprefix ];
  13. if ( ref($options[0]) eq 'ARRAY' ) {
  14. ( $error, $debug, $major_version, $minor_version,
  15. $autoabbrev, $getopt_compat, $ignorecase, $bundling, $order,
  16. $gnu_compat, $passthrough, $genprefix ) = @{shift(@options)};
  17. }
  18. my $opt;
  19. foreach $opt ( @options ) {
  20. my $try = lc ($opt);
  21. my $action = 1;
  22. if ( $try =~ /^no_?(.*)$/s ) {
  23. $action = 0;
  24. $try = $+;
  25. }
  26. if ( ($try eq 'default' or $try eq 'defaults') && $action ) {
  27. ConfigDefaults ();
  28. }
  29. elsif ( ($try eq 'posix_default' or $try eq 'posix_defaults') ) {
  30. local $ENV{POSIXLY_CORRECT};
  31. $ENV{POSIXLY_CORRECT} = 1 if $action;
  32. ConfigDefaults ();
  33. }
  34. elsif ( $try eq 'auto_abbrev' or $try eq 'autoabbrev' ) {
  35. $autoabbrev = $action;
  36. }
  37. elsif ( $try eq 'getopt_compat' ) {
  38. $getopt_compat = $action;
  39. }
  40. elsif ( $try eq 'gnu_getopt' ) {
  41. if ( $action ) {
  42. $gnu_compat = 1;
  43. $bundling = 1;
  44. $getopt_compat = 0;
  45. $permute = 1;
  46. }
  47. }
  48. elsif ( $try eq 'gnu_compat' ) {
  49. $gnu_compat = $action;
  50. }
  51. elsif ( $try eq 'ignorecase' or $try eq 'ignore_case' ) {
  52. $ignorecase = $action;
  53. }
  54. elsif ( $try eq 'ignore_case_always' ) {
  55. $ignorecase = $action ? 2 : 0;
  56. }
  57. elsif ( $try eq 'bundling' ) {
  58. $bundling = $action;
  59. }
  60. elsif ( $try eq 'bundling_override' ) {
  61. $bundling = $action ? 2 : 0;
  62. }
  63. elsif ( $try eq 'require_order' ) {
  64. $order = $action ? $REQUIRE_ORDER : $PERMUTE;
  65. }
  66. elsif ( $try eq 'permute' ) {
  67. $order = $action ? $PERMUTE : $REQUIRE_ORDER;
  68. }
  69. elsif ( $try eq 'pass_through' or $try eq 'passthrough' ) {
  70. $passthrough = $action;
  71. }
  72. elsif ( $try =~ /^prefix=(.+)$/ && $action ) {
  73. $genprefix = $1;
  74. # Turn into regexp. Needs to be parenthesized!
  75. $genprefix = "(" . quotemeta($genprefix) . ")";
  76. eval { '' =~ /$genprefix/; };
  77. Croak ("Getopt::Long: invalid pattern \"$genprefix\"") if $@;
  78. }
  79. elsif ( $try =~ /^prefix_pattern=(.+)$/ && $action ) {
  80. $genprefix = $1;
  81. # Parenthesize if needed.
  82. $genprefix = "(" . $genprefix . ")"
  83. unless $genprefix =~ /^\(.*\)$/;
  84. eval { '' =~ /$genprefix/; };
  85. Croak ("Getopt::Long: invalid pattern \"$genprefix\"") if $@;
  86. }
  87. elsif ( $try eq 'debug' ) {
  88. $debug = $action;
  89. }
  90. else {
  91. Croak ("Getopt::Long: unknown config parameter \"$opt\"")
  92. }
  93. }
  94. $prevconfig;
  95. }
  96. # end of Getopt::Long::Configure
  97. 1;