Strip whitespace around '!', '=', '+=' and '-=' in Defaults entries.

This commit is contained in:
Todd C. Miller
2015-12-08 15:06:00 -07:00
parent 96201a275e
commit e2add4ae20

View File

@@ -58,12 +58,12 @@ while (<>){
# ignore blank lines # ignore blank lines
next if /^\s*$/; next if /^\s*$/;
if (/^Defaults\s+/i) { if (s/^Defaults\s+//) {
my $opt=$'; s/\s+$//; # remove trailing whitespace
$opt=~s/\s+$//; # remove trailing whitespace # remove spaces between '!', '=', '+=' and '-='
push @options,$opt; s/^(\S+)\s*([\+-]?=)\s*(\S.*)$/$1$2$3/ unless s/^!\s*(\S.*)$/!$1/;
push @options, $_;
} elsif (/^(\S+)\s+([^=]+)=\s*(.*)/) { } elsif (/^(\S+)\s+([^=]+)=\s*(.*)/) {
# Aliases or Definitions # Aliases or Definitions
my ($p1,$p2,$p3)=($1,$2,$3); my ($p1,$p2,$p3)=($1,$2,$3);
$p2=~s/\s+$//; # remove trailing whitespace $p2=~s/\s+$//; # remove trailing whitespace
@@ -117,7 +117,6 @@ while (<>){
printf "sudoOrder: %d\n", ++$order; printf "sudoOrder: %d\n", ++$order;
print "\n"; print "\n";
} }
} else { } else {
print "parse error: $_\n"; print "parse error: $_\n";
} }