From bc7cfd30b8fddfb00bcf0358c762edd9c9848758 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Mula=C4=8D?= Date: Wed, 6 Jun 2007 15:13:27 +0000 Subject: [PATCH] merge from head - remove dependency on option order --- org.glite.lb.client/examples/job_reg.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/org.glite.lb.client/examples/job_reg.c b/org.glite.lb.client/examples/job_reg.c index b9300eb..f8dd497 100644 --- a/org.glite.lb.client/examples/job_reg.c +++ b/org.glite.lb.client/examples/job_reg.c @@ -14,7 +14,7 @@ extern int opterr,optind; static void usage(char *me) { - fprintf(stderr,"usage: %s [-m bkserver] [-x] [-j dg_jobid] [-s source_id] [-n num_subjobs [-S][-C]] [-l jdl_file] [-e seed]\n", me); + fprintf(stderr,"usage: %s [-m bkserver] [-x] [-j dg_jobid] [-s source_id] [-n num_subjobs [-S][-C]] [-P] [-l jdl_file] [-e seed]\n", me); } int main(int argc, char *argv[]) @@ -36,8 +36,8 @@ int main(int argc, char *argv[]) case 'j': job = (char *) strdup(optarg); break; case 'm': server = strdup(optarg); break; case 'n': num_subjobs = atoi(optarg); break; - case 'S': if (num_subjobs>0) { reg_subjobs = 1; break; } - case 'C': if (num_subjobs>0) { collection = 1; break; } + case 'S': reg_subjobs = 1; break; + case 'C': collection = 1; break; case 'P': pbs = 1; break; case 'l': jdl = (char *) strdup(optarg); break; case 'e': seed = strdup(optarg); break; @@ -46,6 +46,11 @@ int main(int argc, char *argv[]) } } while (!done); + if ((num_subjobs <= 0) && (reg_subjobs || collection) ) { + usage(argv[0]); + exit(EINVAL); + } + if (!job && !server) { fprintf(stderr,"%s: either -m server or -j jobid has to be specified\n",argv[0]); exit(1); -- 1.8.2.3