]> sourceware.org Git - dwz.git/commitdiff
Add --version/-v support. Patch by Matt Newsome.
authorJakub Jelinek <jakub@redhat.com>
Tue, 17 Jul 2012 08:08:17 +0000 (10:08 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 17 Jul 2012 08:08:17 +0000 (10:08 +0200)
Makefile
VERSION [new file with mode: 0644]
dwz.1
dwz.c

index c8275a1210528fac96976d3128a7ac084280ec6c..fbac9b5e088d277355dde4fae826c34463834660 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
 CFLAGS = -O2 -g
-override CFLAGS += -Wall -W -D_FILE_OFFSET_BITS=64
+DWZ_VERSION := $(shell cat VERSION)
+override CFLAGS += -Wall -W -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"$(DWZ_VERSION)"'
 prefix = /usr
 exec_prefix = $(prefix)
 bindir = $(exec_prefix)/bin
diff --git a/VERSION b/VERSION
new file mode 100644 (file)
index 0000000..2eb3c4f
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.5
diff --git a/dwz.1 b/dwz.1
index 345605e26d062d863c9d1ca42ce89e5ce5b76a48..f3c38fc2067c0acb86c7171c170c431e6c18ccca 100644 (file)
--- a/dwz.1
+++ b/dwz.1
@@ -89,6 +89,9 @@ containing more than
 .TP
 .B \-? \-\-help
 Print short help and exit.
+.TP
+.B \-v \-\-version
+Print version number and short licensing notice and exit.
 .SH ARGUMENTS
 Command-line arguments should be the executables, shared libraries
 or their stripped to file separate debug information objects.
diff --git a/dwz.c b/dwz.c
index 932760af702271c2c6dbbd2c81f768b6b70ce697..6db55aca26ee19f9ef91df0613b8afdd221c82f8 100644 (file)
--- a/dwz.c
+++ b/dwz.c
@@ -11582,6 +11582,7 @@ static struct option dwz_options[] =
   { "max-die-limit",    required_argument, 0, 'L' },
   { "multifile-name",   required_argument, 0, 'M' },
   { "relative",                 no_argument,       0, 'r' },
+  { "version",          no_argument,       0, 'v' },
   { NULL,               no_argument,       0, 0 }
 };
 
@@ -11591,8 +11592,22 @@ usage (void)
 {
   error (1, 0,
         "Usage:\n"
-        "  dwz [-q] [-h] [-l COUNT] [-L COUNT] [-m COMMONFILE] [-M NAME] [-r] [FILES]\n"
-        "  dwz [-q] [-l COUNT] [-L COUNT] -o OUTFILE FILE\n");
+        "  dwz [-v] [-q] [-h] [-l COUNT] [-L COUNT] [-m COMMONFILE] [-M NAME] [-r] [FILES]\n"
+        "  dwz [-v] [-q] [-l COUNT] [-L COUNT] -o OUTFILE FILE\n");
+}
+
+/* Print version and exit.  */
+static void
+version (void)
+{
+  fprintf (stderr,
+          "dwz version " DWZ_VERSION "\n"
+          "Copyright (C) 2001-2012 Red Hat, Inc.\n"
+          "Copyright (C) 2003 Free Software Foundation, Inc.\n"
+          "This program is free software; you may redistribute it under the terms of\n"
+          "the GNU General Public License version 3 or (at your option) any later version.\n"
+          "This program has absolutely no warranty.\n");
+  exit (0);
 }
 
 int
@@ -11612,7 +11627,7 @@ main (int argc, char *argv[])
   while (1)
     {
       int option_index;
-      int c = getopt_long (argc, argv, "m:o:qhl:L:M:r?", dwz_options, &option_index);
+      int c = getopt_long (argc, argv, "m:o:qhl:L:M:r?v", dwz_options, &option_index);
       if (c == -1)
        break;
       switch (c)
@@ -11659,6 +11674,10 @@ main (int argc, char *argv[])
            error (1, 0, "invalid argument -L %s", optarg);
          max_die_limit = l;
          break;
+
+       case 'v':
+         version ();
+         break;
        }
     }
 
This page took 0.040378 seconds and 5 git commands to generate.