Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1400072

[PATCH 4/9] docproc: add variables for subcommand and filename

From Jani Nikula <jani.nikula@intel.com>
Newsgroups linux.kernel
Subject [PATCH 4/9] docproc: add variables for subcommand and filename
Date 2016-05-12 15:20 +0200
Message-ID <rxYH0-6wa-33@gated-at.bofh.it> (permalink)
References <rxYH0-6wa-19@gated-at.bofh.it>
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

Show all headers | View raw


Improves clarity. No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 scripts/docproc.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/scripts/docproc.c b/scripts/docproc.c
index e267e621431a..48abc01a920e 100644
--- a/scripts/docproc.c
+++ b/scripts/docproc.c
@@ -500,6 +500,7 @@ static void parse_file(FILE *infile)
 
 int main(int argc, char *argv[])
 {
+	const char *subcommand, *filename;
 	FILE * infile;
 	int i;
 
@@ -513,15 +514,19 @@ int main(int argc, char *argv[])
 		usage();
 		exit(1);
 	}
+
+	subcommand = argv[1];
+	filename = argv[2];
+
 	/* Open file, exit on error */
-	infile = fopen(argv[2], "r");
+	infile = fopen(filename, "r");
 	if (infile == NULL) {
 		fprintf(stderr, "docproc: ");
-		perror(argv[2]);
+		perror(filename);
 		exit(2);
 	}
 
-	if (strcmp("doc", argv[1]) == 0) {
+	if (strcmp("doc", subcommand) == 0) {
 		/* Need to do this in two passes.
 		 * First pass is used to collect all symbols exported
 		 * in the various files;
@@ -557,10 +562,10 @@ int main(int argc, char *argv[])
 			fprintf(stderr, "Warning: didn't use docs for %s\n",
 				all_list[i]);
 		}
-	} else if (strcmp("depend", argv[1]) == 0) {
+	} else if (strcmp("depend", subcommand) == 0) {
 		/* Create first part of dependency chain
 		 * file.tmpl */
-		printf("%s\t", argv[2]);
+		printf("%s\t", filename);
 		defaultline       = noaction;
 		internalfunctions = adddep;
 		externalfunctions = adddep;
@@ -571,7 +576,7 @@ int main(int argc, char *argv[])
 		parse_file(infile);
 		printf("\n");
 	} else {
-		fprintf(stderr, "Unknown option: %s\n", argv[1]);
+		fprintf(stderr, "Unknown option: %s\n", subcommand);
 		exit(1);
 	}
 	fclose(infile);
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/9] kernel-doc/docproc prep work for reStructuredText Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 5/9] docproc: reduce unnecessary indentation Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 2/9] kernel-doc: produce RestructuredText output Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 4/9] docproc: add variables for subcommand and filename Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 9/9] docproc: print a comment about autogeneration for rst output Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 3/9] kernel-doc: use rst C domain directives and references for types Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 7/9] docproc: abstract terminating lines at first space Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 6/9] docproc: abstract docproc directive detection Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 1/9] kernel-doc: rewrite usage description, remove duplicated comments Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  Re: [PATCH 0/9] kernel-doc/docproc prep work for reStructuredText Jonathan Corbet <corbet@lwn.net> - 2016-05-14 18:10 +0200

csiph-web