1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-20 21:54:20 +01:00

check if $argv[1] is set before trying to access it

This commit is contained in:
Klas Lindfors 2012-05-14 12:50:10 +02:00
parent dd2cdb542c
commit fb01829487

View File

@ -1,19 +1,22 @@
#!/usr/bin/php
<?php
if ($argv[1] == "-h" || $argv[1] == "--help") {
print "Usage: " . $argv[0] . " [-h|--help] [-v]\n";
exit(1);
$verbose = 0;
if (isset($argv[1])) {
if ($argv[1] == "-h" || $argv[1] == "--help") {
print "Usage: " . $argv[0] . " [-h|--help] [-v]\n";
exit(1);
}
if ($argv[1] && $argv[1] != "-v") {
print $argv[0] . ": invalid option -- '" . $argv[0] . "'\n";
print "Try `" . $argv[0] . " --help' for more information.\n";
exit(1);
}
$verbose = $argv[1] == "-v";
}
if ($argv[1] && $argv[1] != "-v") {
print $argv[0] . ": invalid option -- '" . $argv[0] . "'\n";
print "Try `" . $argv[0] . " --help' for more information.\n";
exit(1);
}
$verbose = $argv[1] == "-v";
set_include_path(get_include_path() . PATH_SEPARATOR .
"/usr/share/ykval:/etc/ykval");