Avoid global variables for version strings. - enscript - GNU Enscript
 (HTM) git clone git://thinkerwim.org/enscript.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 29a03491ca822d25ed6eadbaf009945460d3713a
 (DIR) parent 8292547f80c4311052b11cb62a621aaa1b3ea355
 (HTM) Author: Tim Retout <diocles@gnu.org>
       Date:   Sun,  7 Mar 2010 02:42:33 +0000
       
       Avoid global variables for version strings.
       
       Signed-off-by: Tim Retout <diocles@gnu.org>
       
       Diffstat:
         M ChangeLog                           |       8 ++++++++
         M src/gsint.h                         |       2 --
         M src/main.c                          |      29 ++++++++---------------------
         M src/psgen.c                         |       9 ++++++++-
       
       4 files changed, 24 insertions(+), 24 deletions(-)
       ---
 (DIR) diff --git 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.
 (DIR) diff --git a/src/gsint.h b/src/gsint.h
       @@ -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;
 (DIR) diff --git a/src/main.c b/src/main.c
       @@ -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);
        }
 (DIR) diff --git a/src/psgen.c b/src/psgen.c
       @@ -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)