chiark / gitweb /
Adjust --version output to more closely match GNU standards
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 9 Mar 2008 10:21:58 +0000 (10:21 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 9 Mar 2008 10:21:58 +0000 (10:21 +0000)
19 files changed:
.bzrignore
clients/disorder.c
clients/disorderfm.c
clients/playrtp.c
disobedience/disobedience.c
lib/Makefile.am
lib/defs.c
lib/version.c [new file with mode: 0644]
lib/version.h [new file with mode: 0644]
scripts/make-version-string
server/dbupgrade.c
server/deadlock.c
server/decode.c
server/disorderd.c
server/dump.c
server/normalize.c
server/rescan.c
server/speaker.c
server/trackname.c

index ffea199b86fb8c9572aa1a9b46274d82e0e03ecb..a08805f1c5f2f90bc77c2b658f71de1c12fe1ebc 100644 (file)
@@ -140,7 +140,7 @@ server/index.html
 .DS_Store
 tests/disorder-udplog
 lib/version-string
-lib/version.h
+lib/versionstring.h
 scripts/setup
 examples/disorder.rc
 scripts/teardown
index 15bd1075f20bbe9d7b8c736b32927ae888804e2d..caeac1821c84356988e6505ae3dae1a5f34dba09 100644 (file)
@@ -53,6 +53,7 @@
 #include "defs.h"
 #include "authorize.h"
 #include "vector.h"
+#include "version.h"
 
 static disorder_client *client;
 
@@ -84,13 +85,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 static disorder_client *getclient(void) {
   if(!client) {
     if(!(client = disorder_new(1))) exit(EXIT_FAILURE);
@@ -622,7 +616,7 @@ int main(int argc, char **argv) {
     switch(n) {
     case 'h': help();
     case 'H': help_commands();
-    case 'V': version();
+    case 'V': version("disorder");
     case 'c': configfile = optarg; break;
     case 'd': debugging = 1; break;
     case 'l': local = 1; break;
index d8dffb62c959aba1522523b86596acc650c32304..a55cc447ef47d0e43a72696322cb50c4ab903a9a 100644 (file)
@@ -38,6 +38,7 @@
 #include "charset.h"
 #include "defs.h"
 #include "mem.h"
+#include "version.h"
 
 /* Arguments etc ----------------------------------------------------------- */
 
@@ -127,13 +128,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 /* Utilities --------------------------------------------------------------- */
 
 /* Copy FROM to TO.  Has the same signature as link/symlink. */
@@ -356,7 +350,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hVdf:t:i:e:ET:u:wlscn", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disorderfm");
     case 'd': debugging = 1; break;
     case 'f': fromencoding = optarg; break;
     case 't': toencoding = optarg; break;
index 484d265110470dc7fd9b200f874ee9e41ec50e4b..4f6e57a257f423e4660332ebff6080e4f4eba5dc 100644 (file)
@@ -85,6 +85,7 @@
 #include "client.h"
 #include "playrtp.h"
 #include "inputline.h"
+#include "version.h"
 
 #define readahead linux_headers_are_borked
 
@@ -531,13 +532,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 int main(int argc, char **argv) {
   int n, err;
   struct addrinfo *res;
@@ -574,7 +568,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hVdD:m:b:x:L:R:M:aocC:r", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disorder-playrtp");
     case 'd': debugging = 1; break;
     case 'D': device = optarg; break;
     case 'm': minbuffer = 2 * atol(optarg); break;
index 338b5afb63bef845d74adae9994a6f7ae7d55e74..42eb190cf8b4c715fd704d2b60830c02aa141a8e 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "disobedience.h"
 #include "mixer.h"
+#include "version.h"
 
 #include <getopt.h>
 #include <locale.h>
@@ -407,13 +408,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 /* reset state */
 void reset(void) {
   struct reset_callback_node *r;
@@ -454,7 +448,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hVc:dtHC", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disobedience");
     case 'c': configfile = optarg; break;
     case 'd': debugging = 1; break;
     case 't': goesupto = 11; break;
index d28a3b002282f03cc195fd91d2a3c1d04328af20..8715bb0710d295130622f813888313344d662d6f 100644 (file)
@@ -74,6 +74,7 @@ libdisorder_a_SOURCES=charset.c charset.h             \
        unidata.h unidata.c                             \
        vacopy.h                                        \
        vector.c vector.h                               \
+       version.c version.h                             \
        wav.h wav.c                                     \
        wstat.c wstat.h                                 \
        disorder.h
@@ -84,7 +85,7 @@ version-string: ../config.status ${top_srcdir}/scripts/make-version-string
                echo rm -f $@.new; rm -f $@.new; else \
                echo mv $@.new $@; mv $@.new $@; fi
 
-version.h: version-string ${top_srcdir}/scripts/text2c
+versionstring.h: version-string ${top_srcdir}/scripts/text2c
        ${top_srcdir}/scripts/text2c -extern disorder_version_string \
                version-string > $@.new
        @if cmp $@.new $@; then \
@@ -104,8 +105,8 @@ definitions.h: Makefile
        @if cmp $@.new $@; then \
                echo rm -f $@.new; rm -f $@.new; else \
                echo mv $@.new $@; mv $@.new $@; fi
-defs.o: definitions.h version.h
-defs.lo: definitions.h version.h
+defs.o: definitions.h versionstring.h
+defs.lo: definitions.h versionstring.h
 
 test_SOURCES=test.c memgc.c test.h t-addr.c t-basen.c t-cache.c                \
        t-casefold.c t-cookies.c t-filepart.c t-hash.c t-heap.c         \
index 19987cb675f9c08ad68b71befb422bee187ed223..fd323ad552c775f3de88091e1603b76b3797d290 100644 (file)
@@ -59,7 +59,7 @@ const char finkbindir[] = FINKBINDIR;
 /** @brief Package documentation directory */
 const char docdir[] = DOCDIR;
 
-#include "version.h"
+#include "versionstring.h"
 
 /*
 Local Variables:
diff --git a/lib/version.c b/lib/version.c
new file mode 100644 (file)
index 0000000..f92e0c7
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * This file is part of DisOrder
+ * Copyright (C) 2008 Richard Kettlewell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include <config.h>
+#include "types.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "syscalls.h"
+#include "version.h"
+#include "defs.h"
+
+/** @brief Display version string and exit
+ * @param name Name of this program
+ */
+void version(const char *name) {
+  xprintf(disorder_version_string, name);
+  xfclose(stdout);
+  exit(0);
+}
+
+/*
+Local Variables:
+c-basic-offset:2
+comment-column:40
+fill-column:79
+indent-tabs-mode:nil
+End:
+*/
diff --git a/lib/version.h b/lib/version.h
new file mode 100644 (file)
index 0000000..4930bfd
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * This file is part of DisOrder
+ * Copyright (C) 2008 Richard Kettlewell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+#ifndef VERSION_H
+#define VERSION_H
+
+void version(const char *name);
+
+#endif /* VERSION_H */
+
+/*
+Local Variables:
+c-basic-offset:2
+comment-column:40
+fill-column:79
+indent-tabs-mode:nil
+End:
+*/
index 210e84fdda572cd157fc4f9dbb107af45799124d..dfcca410158dcde9ef04f1a1ad7f776ba5889a11 100755 (executable)
@@ -24,8 +24,14 @@ if(exists $ENV{CC}) {
     $compiler = $cv[0];
 }
 die "no version found\n" unless defined $version;
-output("DisOrder $version\n");
+output("%s (DisOrder) $version\n");
 output(" configure options: $options\n") if defined $options;
 output(" compiler: $cc\n") if defined $compiler;
 output(" version: $compiler\n") if defined $cc;
+output("Copyright (C) 2003-2008 Richard Kettlewell et al\n");
+output("License GPLv2+: GNU GPL version 2 or later:\n");
+output("        http://www.gnu.org/licenses/old-licenses/gpl-2.0.html\n");
+output("This is free software: you are free to change and redistribute it.\n");
+output("There is NO WARRANTY, to the extent permitted by law.\n");
+
 close STDOUT or die "$0: stdout: $!\n";
index 0d8600d7e8ab8b93cfe8dad1f41b696552ce0102..7f4eeac897d71bf57b53060aaf5d13bb8ff96362 100644 (file)
@@ -40,6 +40,7 @@
 #include "mem.h"
 #include "configuration.h"
 #include "unicode.h"
+#include "version.h"
 
 static DB_TXN *global_tid;
 
@@ -85,13 +86,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 /** @brief Visit each key in a database and call @p callback
  * @return 0 or DB_LOCK_DEADLOCK
  *
@@ -343,7 +337,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hVc:dDSsxX", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disorder-dbupgrade");
     case 'c': configfile = optarg; break;
     case 'd': debugging = 1; break;
     case 'D': debugging = 0; break;
index 99359b261b5980100fab439710a0f5a87755d06d..6aa130cb6d80a4984b1325f54e706a5293e828a0 100644 (file)
@@ -42,6 +42,7 @@
 #include "rights.h"
 #include "trackdb.h"
 #include "trackdb-int.h"
+#include "version.h"
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
@@ -71,13 +72,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 int main(int argc, char **argv) {
   int n, err, aborted, logsyslog = !isatty(2);
 
@@ -86,7 +80,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hVc:dDSs", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disorder-deadlock");
     case 'c': configfile = optarg; break;
     case 'd': debugging = 1; break;
     case 'D': debugging = 0; break;
index b609d4e6eab48491f3dd2905878bb65ef310b755..36d98ca5ec06c947bdaa0bfe8d940d967e271499 100644 (file)
@@ -50,6 +50,7 @@
 #include "defs.h"
 #include "wav.h"
 #include "speaker-protocol.h"
+#include "version.h"
 
 /** @brief Encoding lookup table type */
 struct decoder {
@@ -444,13 +445,6 @@ static void help(void) {
   exit(0);
 }
 
-/* Display version number and terminate. */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 int main(int argc, char **argv) {
   int n;
   const char *e;
@@ -460,7 +454,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hV", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disorder-decode");
     default: fatal(0, "invalid option");
     }
   }
index e03e4d777dc665f994d3a5129f910edb031bc05f..913721bdecc87915a24943a755306c9e76004c5d 100644 (file)
@@ -57,6 +57,7 @@
 #include "mixer.h"
 #include "eventlog.h"
 #include "printf.h"
+#include "version.h"
 
 static ev_source *ev;
 
@@ -93,13 +94,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 /* SIGHUP callback */
 static int handle_sighup(ev_source attribute((unused)) *ev_,
                         int attribute((unused)) sig,
@@ -217,7 +211,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hVc:dfP:Ns", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disorderd");
     case 'c': configfile = optarg; break;
     case 'd': debugging = 1; break;
     case 'f': background = 0; break;
index 3be14be56f9daaf1485f5bdbd10bc38f937afa38..64a3d8d7e3c5c91f3b16f07a3a9bd33674336723 100644 (file)
@@ -46,6 +46,7 @@
 #include "trackdb.h"
 #include "trackdb-int.h"
 #include "charset.h"
+#include "version.h"
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
@@ -82,13 +83,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 /* dump prefs to FP, return nonzero on error */
 static void do_dump(FILE *fp, const char *tag,
                    int tracksdb, int searchdb) {
@@ -454,7 +448,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hVc:dDutsrRaP", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disorder-dump");
     case 'c': configfile = optarg; break;
     case 'd': dump = 1; break;
     case 'u': undump = 1; break;
index 28faa8168ba9d55ef95fbd1c16ceb34fce592110..8b871c8a497bf1f160b19d1db2273a18a3e2d90b 100644 (file)
@@ -42,6 +42,7 @@
 #include "configuration.h"
 #include "speaker-protocol.h"
 #include "defs.h"
+#include "version.h"
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
@@ -71,13 +72,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 /** @brief Copy bytes from one file descriptor to another
  * @param infd File descriptor read from
  * @param outfd File descriptor to write to
@@ -157,7 +151,7 @@ int main(int argc, char attribute((unused)) **argv) {
   while((n = getopt_long(argc, argv, "hVc:dDSs", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disorder-normalize");
     case 'c': configfile = optarg; break;
     case 'd': debugging = 1; break;
     case 'D': debugging = 0; break;
index e1193c9f9a50cb65db71885ec482197c536c6a55..c715e9190c5987eb83384c594c8ff6995f46256b 100644 (file)
@@ -52,6 +52,7 @@
 #include "trackdb-int.h"
 #include "trackname.h"
 #include "unicode.h"
+#include "version.h"
 
 static DB_TXN *global_tid;
 
@@ -86,13 +87,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 static volatile sig_atomic_t signalled;
 
 static void signal_handler(int sig) {
@@ -398,7 +392,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hVc:dDSsKC", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disorder-rescan");
     case 'c': configfile = optarg; break;
     case 'd': debugging = 1; break;
     case 'D': debugging = 0; break;
index 7411a8eff08e6475966712bb9cb06d74850a449a..4a8966d644b6a8148ea32d3fe18bdb589cf53c46 100644 (file)
@@ -35,7 +35,7 @@
  * this is arranged by the @c disorder-normalize program (see @ref
  * server/normalize.c).
  *
- * @b Garbage @b Collection.  This program deliberately does not use the
+7 * @b Garbage @b Collection.  This program deliberately does not use the
  * garbage collector even though it might be convenient to do so.  This is for
  * two reasons.  Firstly some sound APIs use thread threads and we do not want
  * to have to deal with potential interactions between threading and garbage
@@ -80,6 +80,7 @@
 #include "user.h"
 #include "speaker.h"
 #include "printf.h"
+#include "version.h"
 
 /** @brief Linked list of all prepared tracks */
 struct track *tracks;
@@ -142,13 +143,6 @@ static void help(void) {
   exit(0);
 }
 
-/* Display version number and terminate. */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 /** @brief Return the number of bytes per frame in @p format */
 static size_t bytes_per_frame(const struct stream_header *format) {
   return format->channels * format->bits / 8;
@@ -620,7 +614,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hVc:dDSs", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("disorder-speaker");
     case 'c': configfile = optarg; break;
     case 'd': debugging = 1; break;
     case 'D': debugging = 0; break;
index b14e9e5a12903d5f2e4a4a77eb7cd8492e51ce70..87774755dc03cbd0d904f52631efe27bd5ecd163 100644 (file)
@@ -33,6 +33,7 @@
 #include "mem.h"
 #include "charset.h"
 #include "defs.h"
+#include "version.h"
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
@@ -55,13 +56,6 @@ static void help(void) {
   exit(0);
 }
 
-/* display version number and terminate */
-static void version(void) {
-  xprintf("%s", disorder_version_string);
-  xfclose(stdout);
-  exit(0);
-}
-
 int main(int argc, char **argv) {
   int n;
   const char *s;
@@ -70,7 +64,7 @@ int main(int argc, char **argv) {
   while((n = getopt_long(argc, argv, "hVc:d", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
-    case 'V': version();
+    case 'V': version("trackname");
     case 'c': configfile = optarg; break;
     case 'd': debugging = 1; break;
     default: fatal(0, "invalid option");