From e6a5bcc31cd6d46a84367ba734475308f4295270 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 7 Apr 2008 19:24:28 +0000 Subject: [PATCH] Change use library to require git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@993 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client-2.0/bin/xdsh | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/xCAT-client-2.0/bin/xdsh b/xCAT-client-2.0/bin/xdsh index 519e9d42d..22f497bbc 100644 --- a/xCAT-client-2.0/bin/xdsh +++ b/xCAT-client-2.0/bin/xdsh @@ -1,5 +1,4 @@ -#!/usr/bin/perl -# !/usr/bin/env perl +#!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html BEGIN { @@ -43,18 +42,24 @@ This program is the client interface for xdsh/xdcp. my $cmdref; my $arg; +my @SaveARGV = @ARGV; $cmdref->{command}->[0] = $bname; # save my command name +my $arg = shift(@SaveARGV); -# Pull out the 1st non-hyphen arg as the noderange -for (my $i=0; $i{noderange}->[0] = splice(@ARGV, $i, 1); # removes and returns the noderange - last; - } +if ($arg =~ /^-/) # no noderange +{ + push @{$cmdref->{arg}}, $arg; + foreach (@SAVEARGV) + { + push(@{$cmdref->{arg}}, $_); + } + @ARGV = @{$cmdref->{arg}}; # save just the argument to parse +} +else +{ + $cmdref->{noderange}->[0] = $arg; # save noderange + @ARGV = @SaveARGV; # noderange removed for parsing } - -# Put all the rest of the args in the structure -push (@{$cmdref->{arg}}, @ARGV); # check for help, bypass, other client flags if ($bname eq "xdsh") @@ -66,6 +71,11 @@ else &parse_args_xdcp; } +foreach (@SaveARGV) +{ + push(@{$cmdref->{arg}}, $_); +} + # add environment variables, if they have not already been assigned with # command line flags if (!($::NODE_RSH))