OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael van Elst
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-re Date: 21-Nov-2002 11:11:03
Branch: HEAD Handle: 2002112110110300
Modified files:
openpkg-re openpkg-build
Log:
option parser now allows collated parameter-less options like getopt(2)
Summary:
Revision Changes Path
1.41 +17 -13 openpkg-re/openpkg-build
____________________________________________________________________________
Index: openpkg-re/openpkg-build
============================================================
$ cvs diff -u -r1.40 -r1.41 openpkg-build
--- openpkg-re/openpkg-build 21 Nov 2002 09:56:54 -0000 1.40
+++ openpkg-re/openpkg-build 21 Nov 2002 10:11:03 -0000 1.41
@@ -49,26 +49,30 @@
$opts{$optarg} = $_;
}
$optarg = undef;
- } elsif (/^-(\w)(.*)/) {
- if (exists $optf{$1}) {
- if (length($optf{$1}) > 1) {
- if ($2 ne '') {
- if (exists $opts{$1}) {
- $opts{$1} .= " $2";
+ } elsif (!/^[-]/) {
+ push @argv, $_;
+ } else {
+ while (/^\-(\w)(.*)/) {
+ if (exists $optf{$1}) {
+ if (length($optf{$1}) > 1) {
+ if ($2 ne '') {
+ if (exists $opts{$1}) {
+ $opts{$1} .= " $2";
+ } else {
+ $opts{$1} = $2;
+ }
} else {
- $opts{$1} = $2;
+ $optarg = $1;
}
+ last;
} else {
- $optarg = $1;
+ $opts{$1} = 1;
}
} else {
- $opts{$1} = 1;
+ warn "warning: unknown option $_\n";
}
- } else {
- warn "warning: unknown option $_\n";
+ $_ = "-$2";
}
- } else {
- push @argv, $_;
}
}
if (defined $optarg) {
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]