🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #4097

Patch to nenscript-1.12 to override the filename in default headers

#4097
From: Rod Whitby
Date: Wed, 07 Oct 1992 03:20
136 lines
5066 bytes
[Craig Southeren: Your mail contact address <geoffw@extro.ucc.oz.au>
 as specified in the source files bounces for me.]

Here is a patch to nenscript-1.12 that allows the -t flag to define a
file title that is included in the default header instead of "stdin"
when you are directing input from stdin to nenscript, or instead of
the filename when you give the file name on the command line.  I made
this change for "enscript.el", a package that interfaces to enscript
from GNU Emacs, so it could print "Emacs Buffer: main.c" instead of
the file name and still print the time and page number.

===================================================================
RCS file: /home/john/rwhitby/src/nenscript/main.c,v
retrieving revision 1.10
diff -c3 -r1.10 /home/john/rwhitby/src/nenscript/main.c
*** 1.10	1992/05/26 23:19:02
--- /home/john/rwhitby/src/nenscript/main.c	1992/10/07 02:57:36
***************
*** 62,68 ****
  void usage ()
  
  {
!   printf ("usage: %s -?12BGghlNnRrsVWw -f font -F titlefont -b header -L lines -p filename -P printer -S classification -# copies file...\n", progname);
    exit (0);
  }
  
--- 62,68 ----
  void usage ()
  
  {
!   printf ("usage: %s -?12BGghlNnRrsVWw -f font -F titlefont -b header -t filetitle -L lines -p filename -P printer -S classification -# copies file...\n", progname);
    exit (0);
  }
  
***************
*** 80,85 ****
--- 80,86 ----
  int  wrap = True;				/* True if to wrap long lines */
  int  titlesenabled = True;			/* True if page titles enables */
  char *title = NULL;				/* set to title if specified */
+ char *filetitle = NULL;				/* set to filetitle if specified */
  int  copies = 1;				/* number of copies of each page */
  int  gaudy = False;				/* enables gaudy mode */
  int  force_lines = 0;				/* force number of lines per page */
***************
*** 175,180 ****
--- 176,196 ----
            goto next_argv;
            break;
  
+ /* -t: set page filetitle */
+         case 't' :
+           if (*++ARGV[0])
+             filetitle = ARGV[0];
+           else {
+             if (ARGC < 1)
+               fprintf (stderr, "%s: -t option requires argument\n", progname);
+             else {
+               --ARGC;
+               filetitle = *++ARGV;
+             }
+           }
+           goto next_argv;
+           break;
+ 
  /* -f : set font to use for printing body */
          case 'f' :
            if (*++ARGV[0])
***************
*** 538,549 ****
  
    /* if no arguments, then accept stdin */
    if (argc < 1)
!     print_file (stdin, outputstream, "stdin", line_numbers);
    else for (;argc > 0;argc--) {
      if ((inputstream = fopen (*argv, "r")) == NULL)
        perror (*argv);
      else
!       print_file (inputstream, outputstream, *argv, line_numbers);
      argv++;
    }
  
--- 554,567 ----
  
    /* if no arguments, then accept stdin */
    if (argc < 1)
!     print_file (stdin, outputstream, (filetitle ? filetitle : "stdin"),
! 		line_numbers);
    else for (;argc > 0;argc--) {
      if ((inputstream = fopen (*argv, "r")) == NULL)
        perror (*argv);
      else
!       print_file (inputstream, outputstream, (filetitle ? filetitle : *argv),
! 		  line_numbers);
      argv++;
    }
  
===================================================================
===================================================================
RCS file: /home/john/rwhitby/src/nenscript/nenscript.1,v
retrieving revision 1.1
diff -c3 -r1.1 /home/john/rwhitby/src/nenscript/nenscript.1
*** 1.1	1992/10/07 03:13:05
--- /home/john/rwhitby/src/nenscript/nenscript.1	1992/10/07 03:12:50
***************
*** 12,17 ****
--- 12,19 ----
  ] [
  .BI \-b header
  ] [
+ .BI \-t filetitle
+ ] [
  .BI \-L lines
  ] [
  .BI \-p filename
***************
*** 75,80 ****
--- 77,88 ----
  as the title on each page, rather than the default header which is composed of the name of
  the source file, the current time and date and the page number. If in gaudy mode, the title
  is displayed in the blank area just above the file title.
+ 
+ .TP
+ .BI \-t filetitle
+ Print the text specified by
+ .I filetitle
+ as the name of the source file in the default header on each page.
  
  .TP
  .BI \-f font
===================================================================
-- 
--------------------------------------------- _--_|\  |
Rod Whitby (rwhitby@research.canon.oz.au)    /      \ |
Canon Information Systems Research Australia \_.--._/ |
1 Thomas Holt Drive, North Ryde, N.S.W., 2113.     v  |
Technical Details
Message-ID: <RWHITBY.92Oct7132026@bing.research.canon.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!mama!bing!rwhitby

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.postscript
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!mama!bing!rwhitby
From: rwhitby@research.canon.oz.au (Rod Whitby)
Subject: Patch to nenscript-1.12 to override the filename in default headers
Message-ID: <RWHITBY.92Oct7132026@bing.research.canon.oz.au>
Originator: rwhitby@bing
Sender: news@research.canon.oz.au
Organization: Canon Information Systems Research, Australia
Date: Wed, 7 Oct 1992 03:20:26 GMT
Lines: 136