diff options
author | Jani Nikula <jani.nikula@intel.com> | 2016-05-12 16:15:39 +0300 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2016-05-14 09:56:37 -0600 |
commit | 568fb2dec9c68bb38c2a1ad01fb3d4dd41488115 (patch) | |
tree | 40f773190580708d4fc9d99b849e05cb4305c173 /scripts | |
parent | 6285097654725f39357527b553d03b70bfbaf4d2 (diff) | |
download | op-kernel-dev-568fb2dec9c68bb38c2a1ad01fb3d4dd41488115.zip op-kernel-dev-568fb2dec9c68bb38c2a1ad01fb3d4dd41488115.tar.gz |
docproc: add variables for subcommand and filename
Improves clarity. No functional changes.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/docproc.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/docproc.c b/scripts/docproc.c index e267e621..48abc01a9 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); |