Package: enscript
Version: 1.6.4-7
Severity: normal
Tags: patch

enscript by default silently adds a comment:

%%For: string

where string is the full user's GECOS. This might be an issue for those
willing to publish anonymously (seems a common problem of PS encoders, 
like eg fig2dev).

Attached patch adds option --with-gecos and changes default to _not_
include GECOS into generated PS file. Feel free to revert to current 
default, though I think it's fairer to the user to _not_ include any 
personal info silently.

Note: patch is against 1.6.4-7, so it includes / supersedes patch into
bug#344698 (I've also updated the docs here).
Again, WFM.

-- paolo
 GPG/PGP id:0x21426690 kfp:EDFB 0103 A8D8 4180 8AB5  D59E 9771 0F28 2142 6690
 "Indeed, it does come with warranty: it *will* fail."


-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux npp 2.4.26-ss-fb-lm287 #1 Fri Jul 16 21:26:09 CEST 2004 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages enscript depends on:
ii  libc6                      2.2.5-14.3    GNU C Library: Shared libraries an
ii  libpaper1                  1.1.14-w00dy3 Library for handling paper charact
 
diff -urN enscript-1.6.4/configure.in enscript-1.6.5/configure.in
--- enscript-1.6.4/configure.in Wed Mar  5 08:26:16 2003
+++ enscript-1.6.5/configure.in Sun Dec 25 10:37:37 2005
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(enscript, 1.6.4, [EMAIL PROTECTED])
+AC_INIT(enscript, 1.6.5, [EMAIL PROTECTED])
 AC_CONFIG_SRCDIR([src/gsint.h])
 
 AC_PREREQ(2.57)
diff -urN a/debian/changelog b/debian/changelog
--- enscript-1.6.4/debian/changelog     Sat Dec 24 11:06:32 2005
+++ enscript-1.6.5/debian/changelog     Sun Dec 25 10:19:24 2005
@@ -1,3 +1,17 @@
+enscript (1.6.5-2w00dy1) unstable; urgency=low
+
+  * -B --footer FOOTER allows for printing just FOOTER and no header
+  * new opt --with-gecos: for privacy issues, by default don't print 
+    '%%For: GECOS' but just '%%For: anonymous'
+
+ -- paolo <[EMAIL PROTECTED]>  Sat, 25 Dec 2005 10:08:31 +0100
+
+enscript (1.6.5-1w00dy1) unstable; urgency=low
+
+  * fixed missing footer 
+
+ -- paolo <[EMAIL PROTECTED]>  Sat, 24 Dec 2005 11:08:31 +0100
+
 enscript (1.6.4-7) unstable; urgency=low
 
   * Fixed building with gcc4. Thanks to Andreas Jochens for the patch.
diff -urN a/docs/enscript.man b/docs/enscript.man
--- enscript-1.6.4/docs/enscript.man    Wed Mar  5 08:26:17 2003
+++ enscript-1.6.5/docs/enscript.man    Sun Dec 25 11:35:16 2005
@@ -131,7 +131,8 @@
 the header and the page numbers are printed right justified.
 .TP 8
 .B \-B, \-\-no\-header
-Do not print page headers.
+Do not print page header. 
+But print footer anyway, if \f3\-\-footer\f1 is set.
 .TP 8
 .B \-c, \-\-truncate\-lines
 Cut lines that are too long for the page.  As a default,
@@ -532,6 +533,9 @@
 .B arrow
 print a small arrow to the end of each wrapped line
 .RE
+.TP 8
+.B \-\-with-gecos
+Use GECOS in the '%%For: ...' comment line. Default: print '%%For: anonymous'.
 .TP 8
 .B \-\-non\-printable\-format=\f2format\f3
 Specify how the non-printable characters are printed.  The possible
diff -urN a/lib/simple.hdr b/lib/simple.hdr
--- enscript-1.6.4/lib/simple.hdr       Wed Mar  5 08:26:30 2003
+++ enscript-1.6.5/lib/simple.hdr       Sat Dec 24 17:26:00 2005
@@ -28,23 +28,42 @@
 %Format: pagenumstr    $V$%
 
 /do_header {   % print default simple header
-  gsave
-    d_header_x d_header_y HFpt_h 3 div add translate
+  d_header_h 0 gt {
+    gsave
+      d_header_x d_header_y HFpt_h 3 div add translate
 
-    HF setfont
-    user_header_p {
-      5 0 moveto user_header_left_str show
-
-      d_header_w user_header_center_str stringwidth pop sub 2 div
-      0 moveto user_header_center_str show
-
-      d_header_w user_header_right_str stringwidth pop sub 5 sub
-      0 moveto user_header_right_str show
-    } {
-      5 0 moveto fname show
-      45 0 rmoveto fmodstr show
-      45 0 rmoveto pagenumstr show
-    } ifelse
+      HF setfont
+      user_header_p {
+        5 0 moveto user_header_left_str show
 
-  grestore
+        d_header_w user_header_center_str stringwidth pop sub 2 div
+        0 moveto user_header_center_str show
+
+        d_header_w user_header_right_str stringwidth pop sub 5 sub
+        0 moveto user_header_right_str show
+      } {
+        5 0 moveto fname show
+        d_header_w fmodstr  stringwidth pop sub 2 div
+        0 moveto fmodstr show
+        d_header_w pagenumstr stringwidth pop sub 5 sub
+        0 moveto pagenumstr show
+      } ifelse
+    grestore
+    } if
+
+  user_footer_p d_footer_h 0 gt and {
+    gsave
+      d_footer_x d_footer_y translate
+      HF setfont
+          
+      5 0 moveto user_footer_left_str show
+
+      d_footer_w user_footer_center_str stringwidth pop sub 2 div
+      0 moveto user_footer_center_str show
+
+      d_footer_w user_footer_right_str stringwidth pop sub 5 sub
+      0 moveto user_footer_right_str show
+    grestore
+    } if
+    
 } def
diff -urN a/src/gsint.h b/src/gsint.h
--- enscript-1.6.4/src/gsint.h  Wed Mar  5 08:37:06 2003
+++ enscript-1.6.5/src/gsint.h  Sun Dec 25 11:35:16 2005
@@ -411,6 +411,7 @@
 
 extern char *printer;
 extern int verbose;
+extern int with_gecos;
 extern int num_copies;
 extern char *title;
 extern int num_columns;
@@ -418,6 +419,7 @@
 extern int quiet;
 extern int landscape;
 extern HeaderType header;
+extern int no_header;
 extern char *fancy_header_name;
 extern char *fancy_header_default;
 extern double line_indent;
diff -urN a/src/main.c b/src/main.c
--- enscript-1.6.4/src/main.c   Wed Mar  5 08:36:32 2003
+++ enscript-1.6.5/src/main.c   Sun Dec 25 11:35:16 2005
@@ -259,6 +259,7 @@
  * but the default is 'no fancy header'.
  */
 HeaderType header = HDR_SIMPLE;
+int no_header = 0;
 char *fancy_header_name = NULL;
 char *fancy_header_default = NULL;
 
@@ -306,6 +307,13 @@
  */
 
 /*
+ * --with-gecos
+ *
+ * print '%%For: <gecos>.
+ */
+int with_gecos = 0;
+
+/*
  * -k, --page-prefeed
  * -K, --no-page-prefeed
  *
@@ -876,7 +884,7 @@
   {"no-formfeed",              no_argument,            0, 'z'},
   {"pass-through",             no_argument,            0, 'Z'},
 
-  /* Long options without short counterparts.  Next free is 157. */
+  /* Long options without short counterparts.  Next free is 158. */
   {"color",                    optional_argument,      0, 142},
   {"continuous-page-numbers",  no_argument,            0, 156},
   {"download-font",            required_argument,      0, 131},
@@ -903,6 +911,7 @@
   {"swap-even-page-margins",   no_argument,            0, 153},
   {"toc",                      no_argument,            &toc, 1},
   {"word-wrap",                        no_argument,            0, 147},
+  {"with-gecos",                       no_argument,            0, 157},
   {"ul-angle",                 required_argument,      0, 132},
   {"ul-font",                  required_argument,      0, 128},
   {"ul-gray",                  required_argument,      0, 129},
@@ -1452,14 +1461,17 @@
     {
     case HDR_NONE:
       d_header_h = 0;
+      d_footer_h = 0;
       break;
 
     case HDR_SIMPLE:
-      d_header_h = HFpt.h * 1.5;
+      if (no_header == 0) d_header_h = HFpt.h * 1.5;
+      if (page_footer != NULL) d_footer_h = HFpt.h * 1.5;
       break;
 
     case HDR_FANCY:
-      d_header_h = 36;
+      if (no_header == 0) d_header_h = 36;
+      if (page_footer != NULL) d_footer_h = 36;
       break;
     }
 
@@ -2083,7 +2095,7 @@
          break;
 
        case 'B':               /* no page headers */
-         header = HDR_NONE;
+         no_header = 1;
          break;
 
        case 'c':               /* truncate (cut) long lines */
@@ -2485,6 +2497,10 @@
          continuous_page_numbers = 1;
          break;
 
+       case 157:               /* with gecos */
+         with_gecos = 1;
+         break;
+
        case '?':               /* Errors found during getopt_long(). */
        option_error:
          fprintf (stderr, _("Try `%s --help' for more information.\n"),
@@ -2501,6 +2517,17 @@
          break;
        }
     }
+  /* A kludge so that -B --footer ... will print just the footer.
+    -B doesn't set header = HDR_NONE anymore, but does set no_header = 1
+     this is so that -B won't suppress --footer as well. It's a bit screwy
+     because of the choice of having a default header anyway.
+     With no header/footer at all as default, it'd be better:
+     if you want a header, say -b ... _and/or_ if you want a footer, say 
+     --footer ... else you get nothing; like --borders.
+     I'd rather do that way, but guess that would break something for
+     someone.
+   */
+  if (no_header == 1 && page_footer == NULL) header = HDR_NONE;
 }
 
 
@@ -2517,7 +2544,7 @@
   -a, --pages=PAGES          specify which pages are printed\n\
   -A, --file-align=ALIGN     align separate input files to ALIGN\n\
   -b, --header=HEADER        set page header\n\
-  -B, --no-header            no page headers\n\
+  -B, --no-header            no page header (and no footer if none given) \n\
   -c, --truncate-lines       cut long lines (default is to wrap)\n\
   -C, --line-numbers[=START]\n\
                              precede each line with its line number\n\
@@ -2590,6 +2617,7 @@
   --extended-return-values   enable extended return values\n\
   --filter-stdin=NAME        specify how stdin is shown to the input filter\n\
   --footer=FOOTER            set page footer\n\
+  --with-gecos               do print full GECOS in '%%%%For:' comment\n\
   --h-column-height=HEIGHT   set the horizontal column height to HEIGHT\n\
   --help                     print this help and exit\n"));
 
diff -urN a/src/psgen.c b/src/psgen.c
--- enscript-1.6.4/src/psgen.c  Wed Mar  5 08:36:53 2003
+++ enscript-1.6.5/src/psgen.c  Sun Dec 25 11:35:16 2005
@@ -294,7 +294,10 @@
   OUTPUT ((cofp, "%%%%BoundingBox: %d %d %d %d\n", media->llx, media->lly,
           media->urx, media->ury));
   OUTPUT ((cofp, "%%%%Title: %s\n", title));
-  OUTPUT ((cofp, "%%%%For: %s\n", passwd->pw_gecos));
+  if (with_gecos == 1)
+    OUTPUT ((cofp, "%%%%For: %s\n", passwd->pw_gecos));
+  else
+    OUTPUT ((cofp, "%%%%For: anonymous\n"));
   OUTPUT ((cofp, "%%%%Creator: %s\n", version_string));
   OUTPUT ((cofp, "%%%%CreationDate: %s\n", date_string));
   OUTPUT ((cofp, "%%%%Orientation: %s\n",

Reply via email to