From: Zdeněk Šustr Date: Thu, 7 Dec 2006 12:49:54 +0000 (+0000) Subject: job_status example modified to allow for any position of the -fasthist or -fullhist... X-Git-Tag: glite-lb-server_generic2_start~3 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=f69af109e64e0e8866e0db2a0cfda2196a282603;p=jra1mw.git job_status example modified to allow for any position of the -fasthist or -fullhist argument ;-) --- diff --git a/org.glite.lb.client/examples/job_status.c b/org.glite.lb.client/examples/job_status.c index 48e8e3b..2a55424 100644 --- a/org.glite.lb.client/examples/job_status.c +++ b/org.glite.lb.client/examples/job_status.c @@ -26,7 +26,7 @@ int main(int argc,char *argv[]) { edg_wll_Context sctx[MAX_SERVERS]; char *servers[MAX_SERVERS]; - int i, result=0, nsrv=0, wasaflag, histflags = 0; + int i, result=0, nsrv=0, histflags = 0; myname = argv[0]; @@ -89,6 +89,17 @@ int main(int argc,char *argv[]) return result; } + for ( i = 1; i < argc; i++ ) { + if ( !strcmp(argv[i], "-fullhist") ) { + histflags = EDG_WLL_STAT_CHILDHIST_THOROUGH; + printf("\nFound a FULLHIST flag\n\n"); + } + + if ( !strcmp(argv[i], "-fasthist") ) { + histflags = EDG_WLL_STAT_CHILDHIST_FAST; + printf("\nFound a FASTHIST flag\n\n"); + } + } for ( i = 1; i < argc; i++ ) { int j; @@ -97,20 +108,8 @@ int main(int argc,char *argv[]) edg_wll_JobStat status; memset(&status,0,sizeof status); - - wasaflag = 0; // Indicates that the argument was a flag - - if ( !strcmp(argv[i], "-fullhist") ) { - wasaflag = 1; - histflags = EDG_WLL_STAT_CHILDHIST_THOROUGH; - } - - if ( !strcmp(argv[i], "-fasthist") ) { - wasaflag = 1; - histflags = EDG_WLL_STAT_CHILDHIST_FAST; - } - - if (!wasaflag) { + + if ((strcmp(argv[i], "-fullhist"))&&(strcmp(argv[i], "-fasthist"))) { if (edg_wlc_JobIdParse(argv[i],&job)) { fprintf(stderr,"%s: %s: cannot parse jobId\n", myname,argv[i]); continue;