diff options
author | Rob Savoye <rob@cygnus> | 1992-08-19 03:45:36 +0000 |
---|---|---|
committer | Rob Savoye <rob@cygnus> | 1992-08-19 03:45:36 +0000 |
commit | 5c670bc122e86b0f733dc3e3f2f340163c25c582 (patch) | |
tree | ef5306b142fa7b725d2195f21642cab213e2a1b7 /binutils | |
parent | 249c6fc0d6515115ef526e1198be72dc3ea4454a (diff) | |
download | gdb-5c670bc122e86b0f733dc3e3f2f340163c25c582.zip gdb-5c670bc122e86b0f733dc3e3f2f340163c25c582.tar.gz gdb-5c670bc122e86b0f733dc3e3f2f340163c25c582.tar.bz2 |
Added -V option to print version number.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/copy.c | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/binutils/copy.c b/binutils/copy.c index fbf6f05..4bd6b4b 100644 --- a/binutils/copy.c +++ b/binutils/copy.c @@ -39,6 +39,7 @@ extern int is_strip; /* IMPORTS */ extern char *program_name; +extern char *program_version; static @@ -46,19 +47,11 @@ void usage() { fprintf(stderr, - "Usage %s [-S][-s srcfmt] [-d dtfmt] [-b bothfmts] infile [outfile]\n", + "Usage %s [-S][-s srcfmt] [-d dtfmt] [-b bothfmts] infile [outfile] [-V]\n", program_name); exit(1); } -static -void -strip_usage() -{ - fprintf(stderr, "Usage %s [-v] filename ...\n", program_name); - exit(1); -} - /* Create a temp file in the same directory as supplied */ static @@ -392,8 +385,9 @@ main(argc, argv) char *argv[]; { int i; - + int show_version; program_name = argv[0]; + show_version = 0; bfd_init(); @@ -402,36 +396,13 @@ main(argc, argv) is_strip = (i >= 5 && strcmp(program_name+i-5,"strip")); } - if (is_strip) - { - for (i = 1; i < argc; i++) - { - if (argv[i][0] != '-') - break; - if (argv[i][1] == '-') { - i++; - break; - } - switch (argv[i][1]) { - case 'v': - verbose = true; - break; - default: - strip_usage(); - } - } - for ( ; i < argc; i++) { - char *tmpname = make_tempname(argv[i]); - copy_file(argv[i], tmpname); - rename(tmpname, argv[i]); - } - return 0; - } - for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { + case 'V': + show_version = true; + break; case 'v': verbose = true; break; @@ -464,6 +435,9 @@ main(argc, argv) } } + if (show_version) + printf ("%s version %s\n", program_name, program_version); + if (input_filename == (char *) NULL) usage(); |