summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib/printversion.c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/web2c/lib/printversion.c
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib/printversion.c')
-rw-r--r--Build/source/texk/web2c/lib/printversion.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/lib/printversion.c b/Build/source/texk/web2c/lib/printversion.c
new file mode 100644
index 00000000000..cbcf5d56a00
--- /dev/null
+++ b/Build/source/texk/web2c/lib/printversion.c
@@ -0,0 +1,58 @@
+/* printversion.c: Output for the standard GNU option --version.
+
+ Written in 1996 by K. Berry. Public domain. */
+
+#include "config.h"
+
+/* We're passed in the original WEB banner string, which has the form
+This is PROGRAM, Version VERSION-NUMBER
+ We parse the PROGRAM and VERSION-NUMBER out of this.
+
+ If COPYRIGHT_HOLDER is specified and AUTHOR isn't, then use the
+ former for the latter. If AUTHOR is specified and COPYRIGHT_HOLDER
+ isn't, it means the original program is public domain.
+
+ Maybe I should have just done it all inline in each individual
+ program, but tangle doesn't allow multiline string constants ... */
+
+void
+printversionandexit P3C(const_string, banner,
+ const_string, copyright_holder, const_string, author)
+{
+ extern string versionstring; /* from web2c/lib/version.c */
+ extern KPSEDLL string kpathsea_version_string;/* from kpathsea/version.c */
+ string prog_name;
+ unsigned len;
+ const_string prog_name_end = strchr (banner, ',');
+ const_string prog_version = strrchr (banner, ' ');
+ assert (prog_name_end && prog_version);
+ prog_version++;
+
+ len = prog_name_end - banner - sizeof ("This is");
+ prog_name = (string)xmalloc (len + 1);
+ strncpy (prog_name, banner + sizeof ("This is"), len);
+ prog_name[len] = 0;
+
+ /* The Web2c version string starts with a space. */
+ printf ("%s %s%s\n", prog_name, prog_version, versionstring);
+ puts (kpathsea_version_string);
+
+ if (copyright_holder) {
+ printf ("Copyright 2005 %s.\n", copyright_holder);
+ if (!author)
+ author = copyright_holder;
+ }
+
+ puts ("Kpathsea is copyright 2005 Karl Berry and Olaf Weber.");
+
+ puts ("There is NO warranty. Redistribution of this software is");
+ fputs ("covered by the terms of ", stdout);
+ printf ("both the %s copyright and\n", prog_name);
+ puts ("the Lesser GNU General Public License.");
+ puts ("For more information about these matters, see the file");
+ printf ("named COPYING and the %s source.\n", prog_name);
+ printf ("Primary author of %s: %s.\n", prog_name, author);
+ puts ("Kpathsea written by Karl Berry, Olaf Weber, and others.\n");
+
+ uexit (0);
+}