Skip to content

Commit 42d4e35

Browse files
committed
MFH: improve the script
1 parent 935b0c8 commit 42d4e35

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

scripts/dev/check_parameters.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,4 +333,36 @@ function recurse($path)
333333
}
334334
}
335335

336-
recurse(PHPDIR);
336+
$dirs = array();
337+
338+
if (isset($argc) && $argc > 1) {
339+
if ($argv[1] == '-h' || $argv[1] == '-help' || $argv[1] == '--help') {
340+
echo <<<HELP
341+
Synopsis:
342+
php check_parameters.php [directories]
343+
344+
HELP;
345+
exit(0);
346+
}
347+
for ($i = 1; $i < $argc; $i++) {
348+
$dirs[] = $argv[$i];
349+
}
350+
} else {
351+
$dirs[] = PHPDIR;
352+
}
353+
354+
foreach($dirs as $dir) {
355+
if (is_dir($dir)) {
356+
if (!is_readable($dir)) {
357+
echo "ERROR: directory '", $dir ,"' is not readable\n";
358+
exit(1);
359+
}
360+
} else {
361+
echo "ERROR: bogus directory '", $dir ,"'\n";
362+
exit(1);
363+
}
364+
}
365+
366+
foreach ($dirs as $dir) {
367+
recurse($dir);
368+
}

0 commit comments

Comments
 (0)