From f26fb62a6cee10c33726825a4ac86cd515109409 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 27 Aug 2010 12:26:16 +0000 Subject: [PATCH] add more syntax checking git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7274 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/runsqlcmd | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xCAT-server/sbin/runsqlcmd b/xCAT-server/sbin/runsqlcmd index 81ce44b8d..cd597e329 100755 --- a/xCAT-server/sbin/runsqlcmd +++ b/xCAT-server/sbin/runsqlcmd @@ -40,7 +40,6 @@ $::command = "$0 $args"; Getopt::Long::Configure("bundling"); $Getopt::Long::ignorecase = 0; my ($directory, $help, $version, $filelist); -$directory = "$::XCATROOT/lib/perl/xCAT_schema"; # default # parse the options if ( @@ -62,7 +61,6 @@ if ($help) &usage; exit(0); } - # display the version statement if -v or --version is specified if ($version) { @@ -70,6 +68,17 @@ if ($version) xCAT::MsgUtils->message("I", $version); exit 0; } +if (($filelist) && ($directory)) +{ + xCAT::MsgUtils->message("E","Cannot enter both the -f and -d flags."); + exit 1; +} +if (!($filelist)) { # if no file list and no directory set default + if (!($directory)) { + $directory = "$::XCATROOT/lib/perl/xCAT_schema"; + } +} + my @filearray; if ($filelist) { # use filelist