diff options
Diffstat (limited to 'nls/nlsinfo')
-rw-r--r-- | nls/nlsinfo | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/nls/nlsinfo b/nls/nlsinfo index c7e5772..2a3eec7 100644 --- a/nls/nlsinfo +++ b/nls/nlsinfo | |||
@@ -120,27 +120,27 @@ if (defined($opts{"r"})) { | |||
120 | 120 | ||
121 | 121 | ||
122 | if (scalar(@ARGV) == 0) { | 122 | if (scalar(@ARGV) == 0) { |
123 | print STDERR "Must give one more argument - the directory to scan\n"; | 123 | print STDERR "Must give at least one more argument - the directory to scan\n"; |
124 | exit(1); | ||
125 | } elsif (scalar(@ARGV) > 1) { | ||
126 | print STDERR "Too many arguments, none expected after directory to scan\n"; | ||
127 | exit(1); | 124 | exit(1); |
128 | } | 125 | } |
129 | 126 | ||
130 | 127 | ||
131 | my $dir = $ARGV[0]; | 128 | my @args = @ARGV; |
132 | my $file; | 129 | if (!defined($opts{"f"})) { |
133 | if (!defined($opts{"f"}) && ! -d $dir ) { | 130 | foreach my $dir (@args) { |
134 | print STDERR "$dir is not a directory, aborting\n"; | 131 | if (! -d $dir) { |
135 | exit(2); | 132 | print STDERR "$dir is not a directory, aborting\n"; |
133 | exit(2); | ||
134 | } | ||
135 | } | ||
136 | } elsif (defined($opts{"f"})) { | 136 | } elsif (defined($opts{"f"})) { |
137 | $file = $dir; | ||
138 | undef $dir; | ||
139 | $recurse = 0; | 137 | $recurse = 0; |
140 | 138 | ||
141 | if (! -r $file) { | 139 | foreach my $file (@args) { |
142 | print STDERR "$file is not a readable file, aborting\n"; | 140 | if (! -r $file) { |
143 | exit(2); | 141 | print STDERR "$file is not a readable file, aborting\n"; |
142 | exit(2); | ||
143 | } | ||
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
@@ -150,10 +150,14 @@ if (!defined($opts{"f"}) && ! -d $dir ) { | |||
150 | 150 | ||
151 | my %sets; | 151 | my %sets; |
152 | 152 | ||
153 | if (defined($dir)) { | 153 | if (defined($opts{"f"})) { |
154 | process_dir($dir); | 154 | foreach my $file (@args) { |
155 | process_file($file); | ||
156 | } | ||
155 | } else { | 157 | } else { |
156 | process_file($file); | 158 | foreach my $dir (@args) { |
159 | process_dir($dir); | ||
160 | } | ||
157 | } | 161 | } |
158 | 162 | ||
159 | # Now we have the data, we need to print it out | 163 | # Now we have the data, we need to print it out |