Avoid global variables for version strings.
authorTim Retout <diocles@gnu.org>
Sun, 7 Mar 2010 02:42:33 +0000 (02:42 +0000)
committerTim Retout <diocles@gnu.org>
Sun, 7 Mar 2010 02:53:14 +0000 (02:53 +0000)
Signed-off-by: Tim Retout <diocles@gnu.org>
ChangeLog
src/gsint.h
src/main.c
src/psgen.c

index 50a7138..5fd7fdd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-07  Tim Retout  <diocles@gnu.org>
+
+       * src/gsint.h: Remove version_string and ps_version_string.
+       * src/main.c: Likewise.
+       * src/main.c (version): Update copyright and licensing
+       information. Use autoconf variables instead of hardcoded strings.
+       * src/psgen.c (dump_ps_header): Set ps_version_string here.
+
 2010-03-06  Tim Retout  <diocles@gnu.org>
 
        * configure.ac: Set version to 1.6.5.1.
index b89d3b7..0d57a51 100644 (file)
@@ -326,8 +326,6 @@ typedef struct cached_font_info_st CachedFontInfo;
 
 extern char *program;
 extern FILE *ofp;
-extern char *version_string;
-extern char *ps_version_string;
 extern char *date_string;
 extern struct tm run_tm;
 extern struct tm mod_tm;
index 136b293..ebd086f 100644 (file)
@@ -58,8 +58,6 @@ static void version ();
 char *program;                 /* Program's name, used for messages. */
 FILE *ofp = NULL;              /* Output file. */
 void *printer_context;         /* Context for the printer. */
-char *version_string = NULL;   /* Enscript's version string. */
-char *ps_version_string = NULL;        /* Version string for PS procsets. */
 char *date_string = NULL;      /* Preformatted time string. */
 struct tm run_tm;              /* Time when program is run. */
 struct tm mod_tm;              /* Last modification time for current file. */
@@ -946,19 +944,6 @@ main (int argc, char *argv[])
   /* Make getopt_long() to use our modified programname. */
   argv[0] = program;
 
-  /* Create version strings. */
-
-  buffer_clear (&buffer);
-  buffer_append (&buffer, "GNU ");
-  buffer_append (&buffer, PACKAGE);
-  buffer_append (&buffer, " ");
-  buffer_append (&buffer, VERSION);
-  version_string = buffer_copy (&buffer);
-
-  ps_version_string = xstrdup (VERSION);
-  cp = strrchr (ps_version_string, '.');
-  *cp = ' ';
-
   /* Create the default TOC format string.  Wow, this is cool! */
   /* xgettext:no-c-format */
   toc_fmt_string = _("$3v $-40N $3% pages $4L lines  $E $C");
@@ -2651,10 +2636,12 @@ static void
 version ()
 {
   printf ("%s\n\
-Copyright (C) 2003 Markku Rossi.\n\
-GNU enscript comes with NO WARRANTY, to the extent permitted by law.\n\
-You may redistribute copies of GNU enscript under the terms of the GNU\n\
-General Public License.  For more information about these matters, see\n\
-the files named COPYING.\n",
-         version_string);
+Copyright (C) 1995-2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.\n\
+%s comes with NO WARRANTY, to the extent permitted by law.\n\
+You may redistribute copies of %s under the terms of the GNU\n\
+General Public License, version 3 or, at your option, any later version.\n\
+For more information about these matters, see the files named COPYING.\n",
+         PACKAGE_STRING,
+         PACKAGE_NAME,
+         PACKAGE_NAME);
 }
index a55cc8b..21e4c75 100644 (file)
@@ -280,12 +280,19 @@ dump_ps_header ()
 {
   char *cp, *cp2;
   int i, j, got;
+  char *ps_version_string;     /* Version string for PS procsets. */
+
 
   /* Dump PS header only once. */
   if (ps_header_dumped)
     return;
   ps_header_dumped = 1;
 
+  /* Create version string. */
+  ps_version_string = xstrdup (VERSION);
+  cp = strrchr (ps_version_string, '.');
+  *cp = ' ';
+
   /*
    * Header.
    */
@@ -295,7 +302,7 @@ dump_ps_header ()
           media->urx, media->ury));
   OUTPUT ((cofp, "%%%%Title: %s\n", title));
   OUTPUT ((cofp, "%%%%For: %s\n", passwd->pw_gecos));
-  OUTPUT ((cofp, "%%%%Creator: %s\n", version_string));
+  OUTPUT ((cofp, "%%%%Creator: %s\n", PACKAGE_STRING));
   OUTPUT ((cofp, "%%%%CreationDate: %s\n", date_string));
   OUTPUT ((cofp, "%%%%Orientation: %s\n",
           ((nup > 1) && nup_landscape)