From b37004e2264589bb4a0c85ce6fe9b11548e6e74b Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Tue, 2 Jun 2015 10:37:09 -0700
Subject: [PATCH] Revert "Fix issue where command line options were parsed
 twice in sbatch."

Only going to do this in the master as it may affect scripts.

This reverts commit 454f78e65f74634e2ce7265fba87890db5fdd1a4.

Conflicts:
	NEWS
---
 NEWS             |  1 -
 src/sbatch/opt.c | 16 +++++++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index 0e3cfa97e98..62c436615ba 100644
--- a/NEWS
+++ b/NEWS
@@ -22,7 +22,6 @@ documents those changes that are of interest to users and administrators.
     corruption if thread uses the pointer basing validity off the id.
  -- Fix issue where sbatch would set ntasks-per-node to 0 making any srun
     afterward cause a divide by zero error.
- -- Fix issue where command line options were parsed twice in sbatch.
  -- switch/cray: Refine logic to set PMI_CRAY_NO_SMP_ENV environment variable.
  -- When sacctmgr loads archives with version less than 14.11 set the array
     task id to NO_VAL, so sacct can display the job ids correctly.
diff --git a/src/sbatch/opt.c b/src/sbatch/opt.c
index ee753eeb475..21a15b33878 100644
--- a/src/sbatch/opt.c
+++ b/src/sbatch/opt.c
@@ -1160,7 +1160,8 @@ static void _set_options(int argc, char **argv)
 				       optz, &option_index)) != -1) {
 		switch (opt_char) {
 		case '?':
-			/* handled in process_options_first_pass() */
+			error("Try \"sbatch --help\" for more information");
+			exit(error_exit);
 			break;
 		case 'a':
 			xfree(opt.array_inx);
@@ -1232,8 +1233,8 @@ static void _set_options(int argc, char **argv)
 				exit(error_exit);
 			break;
 		case 'h':
-			/* handled in process_options_first_pass() */
-			break;
+			_help();
+			exit(0);
 		case 'H':
 			opt.hold = true;
 			break;
@@ -1312,7 +1313,7 @@ static void _set_options(int argc, char **argv)
 			opt.dependency = xstrdup(optarg);
 			break;
 		case 'Q':
-			/* handled in process_options_first_pass() */
+			opt.quiet++;
 			break;
 		case 'R':
 			opt.no_rotate = true;
@@ -1328,9 +1329,14 @@ static void _set_options(int argc, char **argv)
 			opt.time_limit_str = xstrdup(optarg);
 			break;
 		case 'u':
+			_usage();
+			exit(0);
 		case 'v':
+			opt.verbose++;
+			break;
 		case 'V':
-			/* handled in process_options_first_pass() */
+			print_slurm_version();
+			exit(0);
 			break;
 		case 'w':
 			xfree(opt.nodelist);
-- 
GitLab