예제 #1
0
            			array_push($args['include'], $shifted = array_shift($cliargs));
            			break;
            		case '-e':
            			array_push($args['exclude'], $shifted = array_shift($cliargs));
            			break;*/
        /*case '-i':
        			array_push($args['include'], $shifted = array_shift($cliargs));
        			break;
        		case '-e':
        			array_push($args['exclude'], $shifted = array_shift($cliargs));
        			break;*/
        case '-d':
            $find->setDelim($shifted = array_shift($cliargs));
            break;
        case '-ds':
            $find->setDS($shifted = array_shift($cliargs));
            break;
        default:
            $directory = $cliarg;
            //$cliargs = array();
    }
    if (is_null($shifted)) {
        fwrite($STDERR, "Missing value after argument {$cliarg}\n" . $syntax);
        exit(1);
    }
}
// ==============================
// Validate and clean arguments
// ==============================
if (is_null($directory)) {
    fwrite($STDERR, "<directory-to-scan> argument is missing.\n" . $syntax);
예제 #2
0
 case '-d':
     if (!is_null($cliarg = array_shift($cliargs))) {
         if ($cliarg != "null" && strlen($cliarg) != 1) {
             fwrite($STDERR, "The field delimiter must be exactly one character long.\n" . $syntax);
             exit(1);
         }
         $find->setDelim($cliarg == "null" ? "" : $cliarg);
     }
     break;
 case '-ds':
     if (!is_null($cliarg = array_shift($cliargs))) {
         if (strlen($cliarg) != 1) {
             fwrite($STDERR, "The directory separator must be exactly one character long.\n" . $syntax);
             exit(1);
         }
         $find->setDS($cliarg);
     }
     break;
 case '--force32bit':
     $force32Bit = true;
     break;
 case '-':
     if (is_null($cliarg = array_shift($cliargs))) {
         continue;
     }
 default:
     if (!is_null($directory)) {
         fwrite($STDERR, "Unexpected argument: {$cliarg}\n" . $syntax);
         exit(1);
     }
     $directory = $cliarg;