summaryrefslogtreecommitdiff
path: root/nls/nlsinfo
diff options
context:
space:
mode:
Diffstat (limited to 'nls/nlsinfo')
-rw-r--r--nls/nlsinfo38
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
122if (scalar(@ARGV) == 0) { 122if (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
131my $dir = $ARGV[0]; 128my @args = @ARGV;
132my $file; 129if (!defined($opts{"f"})) {
133if (!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
151my %sets; 151my %sets;
152 152
153if (defined($dir)) { 153if (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