From: Jiří Škrábal Date: Thu, 22 Sep 2005 10:54:21 +0000 (+0000) Subject: - handle parametrs corectly X-Git-Tag: merge_rc1_dst_2~20 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=9eea3a77fd3d5681137bc5fe3e19c59793199a6e;p=jra1mw.git - handle parametrs corectly --- 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()");