jv@mh.nl (Johan Vromans) (09/20/90)
This is a mandatory patch to newgetopt.pl 1.5. Please apply it. Fixes: # Set options w/o argument to 1. # Correct the dreadful semicolon/require bug. After patching, newgetopt.pl will be at 1.6. Index: newgetopt.pl Require: 1.5 *** newgetopt.pl~ Thu Sep 20 10:11:31 1990 --- newgetopt.pl Thu Sep 20 10:10:21 1990 *************** *** 1,6 # newgetopt.pl -- new options parsing ! # SCCS Status : @(#)@ newgetopt.pl 1.5 # Author : Johan Vromans # Created On : Tue Sep 11 15:00:12 1990 # Last Modified By: Johan Vromans --- 1,6 ----- # newgetopt.pl -- new options parsing ! # SCCS Status : @(#)@ newgetopt.pl 1.6 # Author : Johan Vromans # Created On : Tue Sep 11 15:00:12 1990 # Last Modified By: Johan Vromans *************** *** 4,11 # Author : Johan Vromans # Created On : Tue Sep 11 15:00:12 1990 # Last Modified By: Johan Vromans ! # Last Modified On: Wed Sep 12 17:06:01 1990 ! # Update Count : 28 # Status : Okay # This package implements a new getopt function. This function adheres --- 4,11 ----- # Author : Johan Vromans # Created On : Tue Sep 11 15:00:12 1990 # Last Modified By: Johan Vromans ! # Last Modified On: Thu Sep 20 10:08:35 1990 ! # Update Count : 33 # Status : Okay # This package implements a new getopt function. This function adheres *************** *** 29,34 # # Upon return, the option variables, prefixed with "opt_", are defined # and set to the respective option arguments, if any. # A return status of 0 (false) indicates that the function detected # one or more errors. # --- 29,37 ----- # # Upon return, the option variables, prefixed with "opt_", are defined # and set to the respective option arguments, if any. + # Options that do not take an argument are set to 1. Note that an + # option with an optional argument will be defined, but set to '' if + # no actual argument has been supplied. # A return status of 0 (false) indicates that the function detected # one or more errors. # *************** *** 47,52 # -foo -- -> $opt_foo = '--' # package newgetopt; $debug = 0; # for debugging --- 50,61 ----- # -foo -- -> $opt_foo = '--' # + # HISTORY + # 20-Sep-1990 Johan Vromans + # Set options w/o argument to 1. + # Correct the dreadful semicolon/require bug. + + package newgetopt; $debug = 0; # for debugging *************** *** 114,120 print STDERR ("=> found \"$hits[0]\" for ", $opt, "\n") if $debug; # If it is an option w/o argument, we're almost finished with it. ! next unless defined $type; # Get mandatory status and type info. ($mand, $type) = $type =~ /^(.)(.)$/; --- 123,132 ----- print STDERR ("=> found \"$hits[0]\" for ", $opt, "\n") if $debug; # If it is an option w/o argument, we're almost finished with it. ! if ( ! defined $type ) { ! $arg = 1; # supply explicit value ! next; ! } # Get mandatory status and type info. ($mand, $type) = $type =~ /^(.)(.)$/; *************** *** 182,188 } continue { print STDERR ("=> \$main'opt_$opt = $arg\n") if $debug; ! eval ("\$main'opt_$opt = \$arg";); } return ($error == 0); --- 194,200 ----- } continue { print STDERR ("=> \$main'opt_$opt = $arg\n") if $debug; ! eval ("\$main'opt_$opt = \$arg"); } return ($error == 0); -- Johan Vromans jv@mh.nl via internet backbones Multihouse Automatisering bv uucp: ..!{uunet,hp4nl}!mh.nl!jv Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62911/62500 ------------------------ "Arms are made for hugging" -------------------------