diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-04-18 20:30:00 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-04-18 20:30:00 -0400 |
commit | 84271e583d80f546251ea914a33f8c537fddbac7 (patch) | |
tree | c819869cda13abc7b46a47aa7e860f2dbf0c7626 /utils/lpansi | |
parent | af9be28bc2701ea448898282942bd5b957439f18 (diff) | |
download | lynx-snapshots-84271e583d80f546251ea914a33f8c537fddbac7.tar.gz |
snapshot of project "lynx", label v2-8-1dev_6
Diffstat (limited to 'utils/lpansi')
-rw-r--r-- | utils/lpansi/Makefile | 24 | ||||
-rw-r--r-- | utils/lpansi/README | 82 | ||||
-rw-r--r-- | utils/lpansi/lpansi.1 | 77 | ||||
-rw-r--r-- | utils/lpansi/lpansi.c | 160 | ||||
-rw-r--r-- | utils/lpansi/vmsbuild.com | 73 |
5 files changed, 0 insertions, 416 deletions
diff --git a/utils/lpansi/Makefile b/utils/lpansi/Makefile deleted file mode 100644 index a88c6dca..00000000 --- a/utils/lpansi/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# Makefile for lpansi -# -VERSION=2.1 -# For hp-ux -# CFLAGS=-Aa -O -# For others: -CFLAGS=-O -BINDIR=/usr/local/bin -MANDIR=/usr/local/man/man1 - -lpansi: lpansi.o Makefile - $(CC) -o lpansi lpansi.o - -clean: - rm -f lpansi.o - -shar: - shar -v README lpansi.c lpansi.1 Makefile > lpansi-$(VERSION).shar - -install: lpansi - chmod o+rx,g+rx,u+rx lpansi; cp -p lpansi $(BINDIR)/lpansi - -install_man: - chmod o+rx,g+rx,u+rx lpansi.1; cp -p lpansi.1 $(MANDIR)/lpansi.1 diff --git a/utils/lpansi/README b/utils/lpansi/README deleted file mode 100644 index 252614a8..00000000 --- a/utils/lpansi/README +++ /dev/null @@ -1,82 +0,0 @@ -README for lpansi.c v2.1 10/20/1994 - - Print to ANSI printer on local terminal - - SYNOPSIS - lpansi [options] [file-list] - - DESCRIPTION - The Problem - UNIX supplies a printing program called lp <filename> which allows the - user to print a text (or any really) file to a printer. - Unfortunately, that printer is attached to the UNIX server which is - not where the user usually is. In my case, it is about 230 miles - away. I needed a similar program that would allow me to print to my - home printer. - - The solution: - The VT100 standard defines a printer on and off escape sequence. - [FYI: esc[5i is printer on, esc[4i is printer off.] Lpansi is a VERY - simple program that issues a printer on sequence, opens the files sent - as an argument, reads it character by character, echos it to stdout - (now your local printer) and ends by sending a form feed and printer - off command. - - Usage: - I had several purposes in mind when I wrote this. The first was to - find a way to replace lp in a gopher client I had with something that - would print at home. I also wanted to be able to print text files to - my home printer directly from the UNIX prompt. A natural extension of - this is to add it to LYNX, and other printing clients as your printer - command. - - Syntax: - This program accepts miltiple filenames as an argument. If no - filename is present, lpansi will use standard input. - - Thanks: - Thanks go to Michael Seibel on the PINE development team for helping - me find the correct ANSI codes to turn off the printer. I found out - later that PINE distributes a similar program called ansiprt which is - supposed to do the same thing. Here, the source code is provided so - you may incorporate the concept directly in your program. - - - Options: - -f Form feed off, no form feed at end of each file - -v Verbose, prints helpful information for debugging purposes. - - Disclaimer: - [Everyone has one so...] I make no promises whatsoever about how this - will work for you. If you have VT100 and/or ANSI, it should work just - fine. If it doesn't, quit using it. :) This program is free to use - and modify, but try to keep my name with it. I don't do that much - cool stuff, so I need all the credit I can get. Thanks. - - AUTHOR - Written by Gary Day (gday@comp.uark.edu) - - MODIFICATIONS - Version 1.1 Modified by Noel Hunter (noel@wfu.edu) - Version 2.0 Modified by Noel Hunter (noel@wfu.edu) - Version 2.1 Modified by Noel Hunter (noel@wfu.edu) - - FILES - /usr/local/bin/lpansi - - SEE ALSO - lp, lynx, pine - - EXAMPLES - lpansi .profile - - Will print the file named .profile to a printer attached to your - terminal. NCSA Telnet, WRC Reflections for PC, and Kermit are known - to work. - - In pine, use lpansi by typing "m" for "Main Menu", then selecting "s" - for setup. Next, enter "p" for "Printer", and select "1. Printer - attached to IBM PC or compatible, Macintosh". From then on, when you - choose print in pine, it will be sent to your terminal program and - attached printer. - diff --git a/utils/lpansi/lpansi.1 b/utils/lpansi/lpansi.1 deleted file mode 100644 index d0b854f7..00000000 --- a/utils/lpansi/lpansi.1 +++ /dev/null @@ -1,77 +0,0 @@ -.TH lpansi 1 "Print to ANSI printer on local terminal" -.ds)H LPANSI -.ds]W Release 2.1: October, 1994 -.SH lpansi -.SH -.SH SYNOPSIS -lpansi [options] [file-list] -.SH DESCRIPTION -.SH The Problem -UNIX supplies a printing program called lp <filename> which -allows the user to print a text (or any really) file to a -printer. Unfortunately, that printer is attached to the UNIX -server which is not where the user usually is. In my case, it is -about 230 miles away. I needed a similar program that would -allow me to print to my home printer. - -.SH The solution: -The VT100 standard defines a printer on and off escape -sequence. [FYI: esc[5i is printer on, esc[4i is printer off.] -Lpansi is a VERY simple program that issues a printer on -sequence, opens the files sent as an argument, reads it character -by character, echos it to stdout (now your local printer) and -ends by sending a form feed and printer off command. - -.SH Usage: -I had several purposes in mind when I wrote this. The first was to -find a way to replace lp in a gopher client I had with something that -would print at home. I also wanted to be able to print text -files to my home printer directly from the UNIX prompt. A -natural extension of this is to add it to LYNX, and other printing -clients as your printer command. - -.SH Syntax: -This program accepts miltiple filenames as an argument. -If no filename is present, lpansi will use standard input. -.SH Thanks: -Thanks go to Michael Seibel on the PINE development team for -helping me find the correct ANSI codes to turn off the printer. -I found out later that PINE distributes a similar program called -ansiprt which is supposed to do the same thing. Here, the source -code is provided so you may incorporate the concept directly in your -program. - -.SH Options: -.nfill - -f Form feed off, no form feed at end of each file - -v Verbose, prints helpful information for debugging purposes. -.fill -.SH Disclaimer: -[Everyone has one so...] I make no promises whatsoever about -how this will work for you. If you have VT100 and/or ANSI, it -should work just fine. If it doesn't, quit using it. :) This -program is free to use and modify, but try to keep my name with -it. I don't do that much cool stuff, so I need all the credit -I can get. Thanks. -.SH AUTHOR -Written by Gary Day (gday@comp.uark.edu) -.SH MODIFICATIONS -.nfill -Version 1.1 Modified by Noel Hunter (noel@wfu.edu) -Version 2.0 Modified by Noel Hunter (noel@wfu.edu) -Version 2.1 Modified by Noel Hunter (noel@wfu.edu) -.fill -.SH FILES -/usr/local/bin/lpansi -.SH SEE ALSO -lp, lynx, pine -.SH EXAMPLES -lpansi .profile - -Will print the file named .profile to a printer attached to your terminal. -NCSA Telnet, WRC Reflections for PC, and Kermit are known to work. - -In pine, use lpansi by typing "m" for "Main Menu", then selecting "s" for -setup. Next, enter "p" for "Printer", and select "1. Printer attached to -IBM PC or compatible, Macintosh". From then on, when you choose print -in pine, it will be sent to your terminal program and attached printer. diff --git a/utils/lpansi/lpansi.c b/utils/lpansi/lpansi.c deleted file mode 100644 index 4ea10e4f..00000000 --- a/utils/lpansi/lpansi.c +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************** - * lpansi.c * - * Original author: Gary Day, 11/30/93 * - * Current version: 2.1 by Noel Hunter, 10/20/94 * - * * - * Basic structure based on print -- format files for * - * printing from _Pratical_C_Programming by Steve * - * Oualline, O'Reilly & Associates * - ********************************************************/ -#include <stdio.h> -#include <stdlib.h> /* ANSI Standard only */ -#include <string.h> -#ifdef VMS -#include <unixio.h> -#include <unixlib.h> -#endif /* VMS */ - -int verbose = 0; /* verbose mode (default = false) */ -int formfeed = 1; /* form feed mode (default = true) */ -char *program_name; /* name of the program (for errors) */ - -/* Ansi C function prototypes */ -void ansi_printer_on(void); -void ansi_printer_off(void); -int main(int argc, char *argv[]); - -main(int argc, char *argv[]) -{ - void do_file(char *); /* print a file */ - void usage(void); /* tell user how to use the program */ - - /* save the program name for future use */ - program_name = argv[0]; - - /* - * loop for each option. - * Stop if we run out of arguments - * or we get an argument without a dash. - */ - while ((argc > 1) && (argv[1][0] == '-')) { - /* - * argv[1][1] is the actual option character. - */ - switch (argv[1][1]) { - /* - * -v verbose - */ - case 'v': - verbose = 1; - (void)printf("VERBOSE mode ON\n"); - break; - case 'f': - formfeed = 0; - break; - default: - (void)fprintf(stderr,"Bad option %s\n", argv[1]); - usage(); - } - /* - * move the argument list up one - * move the count down one - */ - argv++; - argc--; - } - - /* - * At this point all the options have been processed. - * Check to see if we have no files in the list - * and if so, we need to process just standard in. - */ - if (argc == 1) { - do_file("stdin"); - } else { - while (argc > 1) { - do_file(argv[1]); - argv++; - argc--; - } - } - return (0); -} -/******************************************************** - * do_file -- send a file to the printer * - * * - * Parameter * - * name -- name of the file to print * - ********************************************************/ -void do_file(char *name) -{ - int ch; /* Where we store our characters */ - FILE *fp; /* File pointer */ - - if ( verbose == 1 ) (void)printf("Processing: %s\n", name); - - ansi_printer_on(); - - if ( strcmp(name,"stdin") == 0 ) - { - while ((ch=getc(stdin))!=EOF) - { - putc(ch,stdout); - } - } - else /* Reading from a file */ - { - if ((fp=fopen(name, "r"))==NULL) - { - printf("Can't open %s\n",name); - exit(1); - } - while ((ch=getc(fp))!=EOF) - { - putc(ch,stdout); - } - fclose(fp); - } - - if ( formfeed == 1 ) - { - printf("\n\x0C"); /* Do a form feed at the end of the document */ - } - - ansi_printer_off(); - - if ( verbose == 1 ) (void)printf("Finished processing: %s\n", name); - -} - -/******************************************************** - * usage -- tell the user how to use this program and * - * exit * - ********************************************************/ -void usage(void) -{ - (void)fprintf(stderr,"Usage is %s [options] [file-list]\n", - program_name); - (void)fprintf(stderr,"Options\n"); - (void)fprintf(stderr," -f form feed OFF\n"); - (void)fprintf(stderr," -v verbose\n"); - exit (1); -} - -/******************************************************** - * Send a printer on escape sequence * - *******************************************************/ -void ansi_printer_on(void) -{ - if ( verbose == 1 ) (void)printf("ANSI printer ON\n"); - printf("\x1B[5i"); -} - -/******************************************************** - * Send a printer off escape sequence * - *******************************************************/ -void ansi_printer_off(void) -{ - printf("\x1B[4i"); - if ( verbose == 1 ) (void)printf("ANSI printer OFF\n"); -} diff --git a/utils/lpansi/vmsbuild.com b/utils/lpansi/vmsbuild.com deleted file mode 100644 index 12e44b46..00000000 --- a/utils/lpansi/vmsbuild.com +++ /dev/null @@ -1,73 +0,0 @@ -$ v = 'f$verify(0)' -$! VMSBUILD.COM for lpansi.c -$! -$! Command file to build LPANSI.EXE on VMS systems. -$! -$! 19-Dec-1996 F.Macrides macrides@sci.wfeb.edu -$! Initial version, for Lynx. -$! -$ ON CONTROL_Y THEN GOTO CLEANUP -$ ON ERROR THEN GOTO CLEANUP -$ proc = f$environment("PROCEDURE") -$ where = f$parse(proc,,,"DEVICE") + f$parse(proc,,,"DIRECTORY") -$ set default 'where' -$ write sys$output "Default directory:" -$ show default -$ write sys$output "" -$! -$! -$ if p1 .nes. "" -$ then -$ cc_opts = "/DEBUG/NOOPT" -$ link_opts = "/DEBUG" -$ else -$ cc_opts = "" -$ link_opts = "" -$ endif -$! -$ v1 = f$verify(1) -$! -$! Build LPANSI.EXE -$! -$ v1 = 'f$verify(0)' -$ IF f$trnlnm("VAXCMSG") .eqs. "DECC$MSG" .or. - - f$trnlnm("DECC$CC_DEFAULT") .eqs. "/DECC" .or. - - f$trnlnm("DECC$CC_DEFAULT") .eqs. "/VAXC" -$ THEN -$ compiler := "DECC" -$ v1 = f$verify(1) -$! Compile with DECC: -$ cc := cc/decc/prefix=all 'cc_opts' -$ v1 = 'f$verify(0)' -$ ELSE -$ IF f$search("gnu_cc:[000000]gcclib.olb") .nes. "" -$ THEN -$ compiler := "GNUC" -$ v1 = f$verify(1) -$! Compile with GNUC: -$ cc := gcc 'cc_opts' -$ v1 = 'f$verify(0)' -$ ELSE -$ compiler := "VAXC" -$ v1 = f$verify(1) -$! Compile with VAXC: -$ cc := cc 'cc_opts' -$ v1 = 'f$verify(0)' -$ ENDIF -$ ENDIF -$ v1 = f$verify(1) -$! -$ cc lpansi -$! -$! Link the objects and libaries. -$! -$ link/exe=lpansi.exe 'link_opts' - -lpansi.obj, - -sys$disk:[--.src]'compiler'.opt/opt -$ v1 = 'f$verify(0)' -$ CLEANUP: -$ v1 = 'f$verify(0)' -$ write sys$output "Default directory:" -$ show default -$ v1 = f$verify(v) -$ exit |