[NTG-pdftex] [ pdftex-Bugs-113 ] \pdftexbanner identifies pdfetex and pdfxtex as pdftex

Hartmut Henkel hartmut_henkel at gmx.de
Thu Sep 16 00:53:02 CEST 2004


Here is a patch against this bug. No warranty. It uses the fact, that
the main() program in texmfmp.c does well know the right banner, only
utils.c from libpdf.a doesn't. So one can transfer the banner (a
pointer) from texmfmp.c to utils.c via some simple function
setpdftexbanner(BANNER). Two things are patched:

1. The banners look now like:

/PTEX.Fullbanner (This is pdfTeX, Version 3.141592-1.20a (Web2C 7.5.3)
kpathsea version 3.5.3)

/PTEX.Fullbanner (This is pdfeTeX, Version 3.141592-1.20a-2.2 (Web2C
7.5.3) kpathsea version 3.5.3)

/PTEX.Fullbanner (This is pdfxTeX, Version 3.141592-1.20a-2.2 (Web2C
7.5.3) kpathsea version 3.5.3)

Similar appears when calling \pdftexbanner.

Function setpdftexbanner(BANNER) is called right at begin of the main()
program (only for a "pdf..." engine). This function is part of utils.c
which goes into the libpdf.a. File utils.c does not anymore require the
BANNER from pdftexextra.h; the banner is now a static pointer in
utils.c. I also replaced the double-blank in front of (Web2C 7.5.3) by a
single one :-)

2. The producer keys look like:

/Producer (pdfTeX-1.20a)
/Producer (pdfeTeX-1.20a)
/Producer (pdfxTeX-1.20a)

This is simply tweaking the change files pdfetex.ch2 and pdfxtex.ch2.

Below are the diffs. Have fun!

Best Regards

Hartmut


========================================================================

--- /usr/local/src/tex/pdftex-1.20a/src/texk/web2c/pdftexdir/utils.c.orig	Mon Jun  7 09:51:34 2004
+++ /usr/local/src/tex/pdftex-1.20a/src/texk/web2c/pdftexdir/utils.c	Wed Sep 15 22:45:21 2004
@@ -25,7 +25,6 @@
 #include "md5.h"
 #include <kpathsea/c-vararg.h>
 #include <kpathsea/c-proto.h>
-#include "pdftexextra.h" /* define BANNER */
 #include <time.h>

 static const char perforce_id[] =
@@ -36,6 +35,7 @@
 static char print_buf[PRINTF_BUF_SIZE];
 static char *jobname_cstr = NULL;
 static char *job_id_string = NULL;
+static char *banner = NULL; /* from web2c/lib/texmfmp.c via setpdftexbanner() */
 extern string versionstring; /* from web2c/lib/version.c */
 extern KPSEDLL string kpathsea_version_string; /* from kpathsea/version.c */

@@ -266,12 +266,13 @@
     s = xtalloc(SMALL_BUF_SIZE +
                 strlen(name_string) +
                 strlen(format_string) +
-                strlen(BANNER) +
+                strlen(banner) +
                 strlen(versionstring) +
                 strlen(kpathsea_version_string), char);
-    sprintf(s, "%.4d/%.2d/%.2d %.2d:%.2d %s %s %s %s %s",
+    /* The Web2c version string starts with a space.  */
+    sprintf(s, "%.4d/%.2d/%.2d %.2d:%.2d %s %s %s%s %s",
             year, month, day, time/60, time%60,
-            name_string, format_string, BANNER,
+            name_string, format_string, banner,
             versionstring, kpathsea_version_string);
     job_id_string = xstrdup(s);
     xfree(s);
@@ -279,6 +280,17 @@
     xfree(format_string);
 }

+/*
+setpdftexbanner() is called at program start from main() in texmfmp.c. One
+can't use makepdftexbanner() at that time directly, since maketexstring()
+isn't set up yet.
+*/
+
+void setpdftexbanner(char * b)
+{
+    banner = b;
+}
+
 void makepdftexbanner(void)
 {
     static boolean pdftexbanner_init = false;
@@ -288,10 +300,11 @@
         return;

     s = xtalloc(SMALL_BUF_SIZE +
-                strlen(BANNER) +
+                strlen(banner) +
                 strlen(versionstring) +
                 strlen(kpathsea_version_string), char);
-    sprintf(s, "%s %s %s", BANNER, versionstring, kpathsea_version_string);
+    /* The Web2c version string starts with a space.  */
+    sprintf(s, "%s%s %s", banner, versionstring, kpathsea_version_string);
     pdftexbanner = maketexstring(s);
     xfree(s);
     pdftexbanner_init = true;

========================================================================

--- /usr/local/src/tex/pdftex-1.20a/src/texk/web2c/lib/texmfmp.c.orig	Sat Aug 28 22:49:59 2004
+++ /usr/local/src/tex/pdftex-1.20a/src/texk/web2c/lib/texmfmp.c	Wed Sep 15 23:58:10 2004
@@ -150,6 +150,10 @@
 static int eightbitp;
 #endif /* Omega || eOmega || Aleph */

+#if defined(pdfTeX) || defined(pdfeTeX) || defined(pdfxTeX)
+void setpdftexbanner(char *);
+#endif
+
 #ifdef MP
 /* name of TeX program to pass to makempx */
 static string mpost_tex_program = "";
@@ -169,6 +173,10 @@

   /* Must be initialized before options are parsed.  */
   interactionoption = 4;
+
+#if defined(pdfTeX) || defined(pdfeTeX) || defined(pdfxTeX)
+  setpdftexbanner(BANNER); /* needed by makepdftexbanner() in utils.c */
+#endif

   /* If the user says --help or --version, we need to notice early.  And
      since we want the --ini option, have to do it before getting into

========================================================================

--- /usr/local/src/tex/pdftex-1.20a/src/texk/web2c/pdfetexdir/pdfetex.ch2.orig	Thu Aug 26 23:46:31 2004
+++ /usr/local/src/tex/pdftex-1.20a/src/texk/web2c/pdfetexdir/pdfetex.ch2	Thu Sep 16 00:15:15 2004
@@ -200,6 +200,12 @@
 if eTeX_ex then @<Check for LR anomalies at the end of |ship_out|@>;
 @z

+ at x
+pdf_print("/Producer (pdfTeX-");
+ at y
+pdf_print("/Producer (pdfeTeX-");
+ at z
+
 @x [33.649] l.12912
 exit: {|hpack|}
 @y

========================================================================

--- /usr/local/src/tex/pdftex-1.20a/src/texk/web2c/pdfxtexdir/pdfxtex.ch2.orig	Wed Aug 25 19:16:54 2004
+++ /usr/local/src/tex/pdftex-1.20a/src/texk/web2c/pdfxtexdir/pdfxtex.ch2	Wed Sep 15 23:36:06 2004
@@ -33,3 +33,9 @@
 @y
 @d banner==pdfxTeX_banner
 @z
+
+ at x
+pdf_print("/Producer (pdfeTeX-");
+ at y
+pdf_print("/Producer (pdfxTeX-");
+ at z

========================================================================



More information about the ntg-pdftex mailing list