From 9eea3a77fd3d5681137bc5fe3e19c59793199a6e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20=C5=A0kr=C3=A1bal?= Date: Thu, 22 Sep 2005 10:54:21 +0000 Subject: [PATCH] - handle parametrs corectly --- org.glite.jp.client/examples/jpps_upload_files.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/org.glite.jp.client/examples/jpps_upload_files.c b/org.glite.jp.client/examples/jpps_upload_files.c index 81a8d02..3e5da0b 100644 --- a/org.glite.jp.client/examples/jpps_upload_files.c +++ b/org.glite.jp.client/examples/jpps_upload_files.c @@ -10,7 +10,7 @@ static char *myname; void usage(void) { fprintf(stderr, - "Usage: %s [-h][-p user_proxy][-j jobid] files\n" + "Usage: %s [-h][-p user_proxy][-j jobid] file [file ...]\n" " -h show this help\n" " -p path to the proxy filename\n" " -j jobid string\n" @@ -27,7 +27,7 @@ int main(int argc, char **argv) *proxy, *lbmd = NULL, *jpps = NULL; - int i; + int i, j; myname = strrchr(argv[0],'/'); @@ -44,11 +44,14 @@ int main(int argc, char **argv) else {usage();return 1;} } + if ( i >= argc ) { usage(); return 1; } + if ( !(files = calloc(argc-i+1, sizeof(*files))) ) { perror("calloc()"); return 1; } - for ( i = 0; i < argc; i++ ) files[i] = argv[i+1]; + j = 0; + while ( i < argc ) files[j++] = argv[i++]; if ( glite_jpcl_InitContext(&ctx) ) { perror("glite_jpcl_InitContext()"); -- 1.8.2.3