Index: trunk/src/cmds/qsub.c =================================================================== --- trunk/src/cmds/qsub.c (revision 1418) +++ trunk/src/cmds/qsub.c (working copy) @@ -2730,81 +2730,84 @@ case 'l': - l_opt = passet; + if_cmd_line(l_opt) + { + l_opt = passet; - /* defer evaluation of resources in interactive submission. */ + /* defer evaluation of resources in interactive submission. */ /* ORNL WRAPPER */ - if (Interact_opt == 1) - { - char tmpLine[4096]; + if (Interact_opt == 1) + { + char tmpLine[4096]; - /* Queue interactive resources to temp file. */ + /* Queue interactive resources to temp file. */ - strcpy(tmpLine,tmpResources); + strcpy(tmpLine,tmpResources); - sprintf(tmpResources,"%s#PBS -l %s\n", - tmpLine, - optarg); - } - else - { - /* Normal evaluation of batch job resources. */ - - if (set_resources(&attrib,optarg,(pass == 0)) != 0) + sprintf(tmpResources,"%s#PBS -l %s\n", + tmpLine, + optarg); + } + else { - fprintf(stderr,"qsub: illegal -l value\n"); + /* Normal evaluation of batch job resources. */ - errflg++; - } + if (set_resources(&attrib,optarg,(pass == 0)) != 0) + { + fprintf(stderr,"qsub: illegal -l value\n"); + + errflg++; + } - if (strstr(optarg,"walltime") != NULL) - { - struct attrl *attr; - char *ptr; + if (strstr(optarg,"walltime") != NULL) + { + struct attrl *attr; + char *ptr; - /* if walltime range specified, break into minwclimit and walltime resources */ + /* if walltime range specified, break into minwclimit and walltime resources */ - for (attr = attrib;attr != NULL;attr = attr->next) - { - if (!strcmp(attr->name,"walltime")) + for (attr = attrib;attr != NULL;attr = attr->next) { - if ((ptr = strchr(attr->value,'-'))) + if (!strcmp(attr->name,"walltime")) { - char tmpLine[1024]; + if ((ptr = strchr(attr->value,'-'))) + { + char tmpLine[1024]; - *ptr = '\0'; + *ptr = '\0'; - ptr++; + ptr++; - /* set minwclimit to min walltime range value */ + /* set minwclimit to min walltime range value */ - snprintf(tmpLine,sizeof(tmpLine),"minwclimit=%s", - attr->value); + snprintf(tmpLine,sizeof(tmpLine),"minwclimit=%s", + attr->value); - if (set_resources(&attrib,tmpLine,(pass == 0)) != 0) - { - fprintf(stderr,"qsub: illegal -l value\n"); + if (set_resources(&attrib,tmpLine,(pass == 0)) != 0) + { + fprintf(stderr,"qsub: illegal -l value\n"); - errflg++; - } + errflg++; + } - /* set walltime to max walltime range value */ + /* set walltime to max walltime range value */ - strcpy(tmpLine,ptr); + strcpy(tmpLine,ptr); - strcpy(attr->value,tmpLine); + strcpy(attr->value,tmpLine); + } + + break; } + } /* END for (attr) */ + } + } /* END else (Interact_opt == 1) */ - break; - } - } /* END for (attr) */ - } - } /* END else (Interact_opt == 1) */ - /* END ORNL WRAPPER */ + } break; case 'm': @@ -3114,8 +3117,14 @@ break; } - i = parse_equal_string(optarg,&keyword,&valuewd); + { + char tmpLine[65536]; + strncpy(tmpLine, optarg, sizeof(tmpLine) - 1); + tmpLine[sizeof(tmpLine - 1)] = '\0'; + i = parse_equal_string(tmpLine,&keyword,&valuewd); + } + if (i != 1) { char tmpLine[65536]; @@ -3652,23 +3661,6 @@ } } - errflg = process_opts(argc,argv,0); /* get cmd-line options */ - - if (errflg || ((optind + 1) < argc)) - { - static char usage[] = -"usage: qsub [-a date_time] [-A account_string] [-b secs]\n\ -[-c { c[=] | s | n }] [-C directive_prefix] [-d path] [-D path]\n\ -[-e path] [-h] [-I] [-j oe] [-k {oe}] [-l resource_list] [-m {abe}]\n\ -[-M user_list] [-N jobname] [-o path] [-p priority] [-q queue] [-r y|n]\n\ -[-S path] [-t number_to_submit] [-u user_list] [-X] [-W otherattributes=value...]\n\ -[-v variable_list] [-V ] [-z] [script]\n"; - - fprintf(stderr,usage); - - exit(2); - } - /* check TORQUE config settings */ strncpy(PBS_Filter,SUBMIT_FILTER_PATH,255); @@ -3748,7 +3740,36 @@ { strncpy(PBS_Filter,DefaultFilterPath,255); } - + /* only process cmd-lie options if PBS_Filter doesn't exist. Otherwise, we let the + filter deal with the options */ + if (stat(PBS_Filter, &statbuf) == -1) + { + errflg = process_opts(argc,argv,0); /* get cmd-line options */ + + if (errflg || ((optind + 1) < argc)) + { + static char usage[] = + "usage: qsub [-a date_time] [-A account_string] [-b secs]\n\ +[-c { c[=] | s | n }] [-C directive_prefix] [-d path] [-D path]\n\ +[-e path] [-h] [-I] [-j oe] [-k {oe}] [-l resource_list] [-m {abe}]\n\ +[-M user_list] [-N jobname] [-o path] [-p priority] [-q queue] [-r y|n]\n\ +[-S path] [-t number_to_submit] [-u user_list] [-X] [-W otherattributes=value...]\n\ +[-v variable_list] [-V ] [-z] [script]\n"; + + fprintf(stderr,usage); + + exit(2); + } + } + else + { + /* run through the args so we can grab the script name - if there is one */ + int c; + + while ((c = getopt(argc,argv,GETOPT_ARGS)) != EOF); + } + + if (optind < argc) strcpy(script,argv[optind]);