Commit | Line | Data |
01e8c204 |
1 | # newgetopt.pl -- new options parsing. |
2 | # Now just a wrapper around the Getopt::Long module. |
01d0d956 |
3 | # $Id: newgetopt.pl,v 1.16 1996/03/16 11:46:08 jv Exp $ |
352d5a3a |
4 | |
ee0007ab |
5 | { package newgetopt; |
ee0007ab |
6 | |
01e8c204 |
7 | # Values for $order. See GNU getopt.c for details. |
8 | $REQUIRE_ORDER = 0; |
9 | $PERMUTE = 1; |
10 | $RETURN_IN_ORDER = 2; |
11 | |
12 | # Handle POSIX compliancy. |
13 | if ( defined $ENV{"POSIXLY_CORRECT"} ) { |
14 | $autoabbrev = 0; # no automatic abbrev of options (???) |
15 | $getopt_compat = 0; # disallow '+' to start options |
16 | $option_start = "(--|-)"; |
17 | $order = $REQUIRE_ORDER; |
01d0d956 |
18 | $bundling = 0; |
ee0007ab |
19 | } |
01e8c204 |
20 | else { |
21 | $autoabbrev = 1; # automatic abbrev of options |
22 | $getopt_compat = 1; # allow '+' to start options |
23 | $option_start = "(--|-|\\+)"; |
24 | $order = $PERMUTE; |
01d0d956 |
25 | $bundling = 0; |
ee0007ab |
26 | } |
27 | |
01e8c204 |
28 | # Other configurable settings. |
29 | $debug = 0; # for debugging |
30 | $ignorecase = 1; # ignore case when matching options |
31 | $argv_end = "--"; # don't change this! |
32 | } |
352d5a3a |
33 | |
01e8c204 |
34 | use Getopt::Long; |
352d5a3a |
35 | |
01e8c204 |
36 | ################ Subroutines ################ |
352d5a3a |
37 | |
01e8c204 |
38 | sub NGetOpt { |
352d5a3a |
39 | |
01e8c204 |
40 | $Getopt::Long::debug = $newgetopt::debug |
41 | if defined $newgetopt::debug; |
42 | $Getopt::Long::autoabbrev = $newgetopt::autoabbrev |
43 | if defined $newgetopt::autoabbrev; |
44 | $Getopt::Long::getopt_compat = $newgetopt::getopt_compat |
45 | if defined $newgetopt::getopt_compat; |
46 | $Getopt::Long::option_start = $newgetopt::option_start |
47 | if defined $newgetopt::option_start; |
48 | $Getopt::Long::order = $newgetopt::order |
49 | if defined $newgetopt::order; |
01d0d956 |
50 | $Getopt::Long::bundling = $newgetopt::bundling |
51 | if defined $newgetopt::bundling; |
01e8c204 |
52 | $Getopt::Long::ignorecase = $newgetopt::ignorecase |
53 | if defined $newgetopt::ignorecase; |
54 | |
55 | &GetOptions; |
56 | } |
352d5a3a |
57 | |
01e8c204 |
58 | ################ Package return ################ |
352d5a3a |
59 | |
352d5a3a |
60 | 1; |
01e8c204 |
61 | |
62 | ################ End of newgetopt.pl ################ |