Package: enscript
Version: 1.6.4-7
Severity: normal

I wanted to print both header and footer, but no way to get the latter.
Actually, I found the footer is completely missing from .hdr lib files,
and code isn't ready to deal with that (or I just screwed uo a lot ;) ).

Anyway, also the opts logic wouldn't allow to print just the footer, 
either (default)header, (default)header+footer or nothing at all.

I needed the 3rd option, ie just the footer, hence hacked up a solution
which WFM (and bumped up version to 1.6.5-1 for my own ref).

I'd rather change the logic for -b/-B/--footer, ie 
  default = no hdr,no ftr
  -b = default header
  -b header
  --footer footer
thus dropping -B, but guess some flame would arise ;)

So I tried to keep the same logic, ie 
  default = default header in .hdr
  -b header = user's header
  --footer footer = default header in .hdr + user's footer
  -B --footer footer = just user's footer

pls see diff against 1.6.4-7 below - I set the footer proc in simple.hdr
only, since that's the one I use. Doing the same for the other/fancy one
should be nearly a matter of c&p (nearly what I did from header proc).
I did not define a do_footer so that other .hdr need no mods.

-- paolo


-- System Information
Debian Release: 3.0
Kernel Version: Linux npp 2.4.26-ss-fb-lm287 #1 Fri Jul 16 21:26:09 CEST 2004 
i686 unknown

Versions of the packages enscript depends on:
ii  libc6          2.2.5-14.3     GNU C Library: Shared libraries and Timezone
ii  libpaper1      1.1.14-w00dy3  Library for handling paper characteristics


diff -urN enscript-1.6.4/ enscript-1.6.5/
--- enscript-1.6.4/debian/changelog     Sat Dec 24 11:06:32 2005
+++ enscript-1.6.5/debian/changelog     Sat Dec 24 11:32:52 2005
@@ -1,3 +1,9 @@
+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.
--- enscript-1.6.4/src/gsint.h  Wed Mar  5 08:37:06 2003
+++ enscript-1.6.5/src/gsint.h  Sat Dec 24 16:24:00 2005
@@ -418,6 +418,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;
--- enscript-1.6.4/src/main.c   Wed Mar  5 08:36:32 2003
+++ enscript-1.6.5/src/main.c   Sat Dec 24 16:24:00 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;
 
@@ -1452,14 +1453,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 +2087,7 @@
          break;
 
        case 'B':               /* no page headers */
-         header = HDR_NONE;
+         no_header = 1;
          break;
 
        case 'c':               /* truncate (cut) long lines */
@@ -2501,6 +2505,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 +2532,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\
--- enscript-1.6.4/lib/simple.hdr       Wed Mar  5 08:26:30 2003
+++ enscript-1.6.5/lib/simple.hdr       Sat Dec 24 16:22:37 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


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to