summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog5
-rw-r--r--Build/source/texk/web2c/lib/printversion.c19
2 files changed, 17 insertions, 7 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
index 00ddce68bef..66a33f23c4d 100644
--- a/Build/source/texk/web2c/lib/ChangeLog
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-17 Andreas Scherer <https://ascherer.github.io>
+
+ * printversion.c (printversionandexit): Search for PROGNAME
+ in banner independent of 'This is' prefix.
+
2018-11-19 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* texmfmp.c: Remove unused functions for XeTeX.
diff --git a/Build/source/texk/web2c/lib/printversion.c b/Build/source/texk/web2c/lib/printversion.c
index 5849ce23f45..1aa9c09894b 100644
--- a/Build/source/texk/web2c/lib/printversion.c
+++ b/Build/source/texk/web2c/lib/printversion.c
@@ -28,22 +28,27 @@ printversionandexit (const_string banner,
{
string prog_name;
unsigned len;
+ const_string prog_name_start;
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");
+ len = prog_name_end - banner;
prog_name = xmalloc (len + 1);
- strncpy (prog_name, banner + sizeof ("This is"), len);
+ strncpy (prog_name, banner, len);
prog_name[len] = 0;
+ prog_name_start = strrchr (prog_name, ' ');
+ assert (prog_name_start);
+ prog_name_start++;
+
/* The Web2c version string starts with a space. */
#ifdef PTEX
- printf ("%s %s (%s)%s\n", prog_name, prog_version, get_enc_string(),
+ printf ("%s %s (%s)%s\n", prog_name_start, prog_version, get_enc_string(),
versionstring);
#else
- printf ("%s %s%s\n", prog_name, prog_version, versionstring);
+ printf ("%s %s%s\n", prog_name_start, prog_version, versionstring);
#endif
puts (kpathsea_version_string);
#ifdef PTEX
@@ -58,11 +63,11 @@ printversionandexit (const_string banner,
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);
+ printf ("both the %s copyright and\n", prog_name_start);
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);
+ printf ("named COPYING and the %s source.\n", prog_name_start);
+ printf ("Primary author of %s: %s.\n", prog_name_start, author);
if (extra_info)
fputs (extra_info, stdout);