[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LYNX-DEV patch to incorporate "lpansi" into LYPrint.c
From: |
Nelson Henry Eric |
Subject: |
LYNX-DEV patch to incorporate "lpansi" into LYPrint.c |
Date: |
Mon, 6 Apr 1998 16:39:40 +0900 (JST) |
In general I like the idea of separate utilities for special
functions, however, I don't like the idea of the Lynx distribution
hauling a lot of baggage around. The following patch adds only a
handful of code to Lynx, but will allow the removal of the entire
"utils" subdirectory by wrapping the print TO_SCREEN routine with
the turn printer on/off escape codes in "lpansi.c".
Many thanks to Dan for testing before I had a way to test myself.
The patch has been applied to "pubLynx", so anyone who wants can
give it a whirl: "telnet://ibr1.irm.nara.kindai.ac.jp", login "lynx",
hit return for default "vt100." Note that messages are in Japanese,
so the string to CHECK_PRINTER, which requires a return to commence
printing, is:
"$B%W%j%s%?!<$,%*%s%i%$%s$G$9$+!#!!(J[$B%j%?!<%s(J]$B%-!<$G0u:~$r3+;O(J:"
__Henry
*** lynx.cfg.orig Mon Mar 30 10:46:32 1998
--- lynx.cfg Mon Mar 30 12:40:11 1998
***************
*** 964,972 ****
#PRINTER:Office printer:lpr -POffprt %s:TRUE
#PRINTER:VMS printer:print /queue=cc$print %s:FALSE:58
#PRINTER:Busy VMS printer:@Lynx_Dir\:VMSPrint sys$print %s:FALSE:58
- # Check out the lpansi program in utils/ for printing on vt100
- # attached printers.
- #PRINTER:Use vt100 print sequence to print from your local terminal:lpansi
%s:TRUE
# Don't use the following printer on anonymous accounts since
# allowing shell input is very dangerous.
#PRINTER:Specify your own print command:echo -n "Enter a print command\: ";
read word; sh -c "$word %s":FALSE
--- 964,969 ----
*** LYMessages_en.h.orig Fri Feb 13 22:53:42 1998
--- LYMessages_en.h Mon Mar 30 10:46:33 1998
***************
*** 460,465 ****
--- 460,467 ----
#define PRESS_RETURN_TO_FINISH "Press <return> to finish: "
#define CONFIRM_LONG_PAGE_PRINT \
"File is %d pages long. Are you sure you want to print? [y]"
+ #define CHECK_PRINTER \
+ "Be sure your printer is on-line. Press <return> to start printing:"
#define FILE_ALLOC_FAILED "ERROR - Unable to allocate file space!!!"
#define UNABLE_TO_OPEN_TEMPFILE "Unable to open tempfile"
#define UNABLE_TO_OPEN_PRINTOP_FILE "Unable to open print options file"
*** src/LYPrint.c.orig Wed Mar 25 22:58:54 1998
--- src/LYPrint.c Mon Apr 6 14:50:11 1998
***************
*** 38,50 ****
* LYNXPRINT://LOCAL_FILE/lines=##
* LYNXPRINT://MAIL_FILE/lines=##
* LYNXPRINT://TO_SCREEN/lines=##
* LYNXPRINT://PRINTER/lines=##/number=#
*/
#define TO_FILE 1
#define TO_SCREEN 2
! #define MAIL 3
! #define PRINTER 4
#ifdef VMS
PRIVATE int remove_quotes PARAMS((char *string));
--- 38,67 ----
* LYNXPRINT://LOCAL_FILE/lines=##
* LYNXPRINT://MAIL_FILE/lines=##
* LYNXPRINT://TO_SCREEN/lines=##
+ * LYNXPRINT://LPANSI/lines=##
* LYNXPRINT://PRINTER/lines=##/number=#
*/
#define TO_FILE 1
#define TO_SCREEN 2
! /*
! * "lpansi.c"
! * Original author: Gary Day (address@hidden), 11/30/93
! * Current version: 2.1 by Noel Hunter (address@hidden), 10/20/94
! *
! * Basic structure based on print -- format files for printing from
! * _Pratical_C_Programming by Steve Oualline, O'Reilly & Associates
! *
! * adapted from the README for lpansi.c v2.1, dated 10/20/1994:
! * Print to ANSI printer on local terminal
! * The VT100 standard defines printer on and off escape sequences,
! * esc[5i is printer on, and esc[4i is printer off.
! *
! * incorporate the idea of "lpansi" directly into LYPrint.c - HN
! */
! #define LPANSI 3
! #define MAIL 4
! #define PRINTER 5
#ifdef VMS
PRIVATE int remove_quotes PARAMS((char *string));
***************
*** 62,67 ****
--- 79,85 ----
int printer_number = 0;
int pages = 0;
int type = 0, c, len;
+ BOOLEAN Lpansi = FALSE;
FILE *outfile_fp;
char *cp = NULL;
lynx_printer_item_type *cur_printer;
***************
*** 196,201 ****
--- 214,222 ----
type = TO_FILE;
} else if (strstr(link_info, "TO_SCREEN")) {
type = TO_SCREEN;
+ } else if (strstr(link_info, "LPANSI")) {
+ Lpansi = TRUE;
+ type = TO_SCREEN;
} else if (strstr(link_info, "MAIL_FILE")) {
type = MAIL;
} else if (strstr(link_info, "PRINTER")) {
***************
*** 901,907 ****
}
}
! _statusline(PRESS_RETURN_TO_BEGIN);
*filename = '\0';
if (LYgetstr(filename, VISIBLE,
sizeof(filename), NORECALL) < 0) {
--- 922,932 ----
}
}
! if (Lpansi) {
! _statusline(CHECK_PRINTER);
! } else {
! _statusline(PRESS_RETURN_TO_BEGIN);
! }
*filename = '\0';
if (LYgetstr(filename, VISIBLE,
sizeof(filename), NORECALL) < 0) {
***************
*** 930,935 ****
--- 955,961 ----
"<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
newdoc->address, content_base);
}
+ if (Lpansi) printf("\x1B[5i");
print_wwwfile_to_fd(outfile_fp, 0);
if (keypad_mode)
printlist(outfile_fp, FALSE);
***************
*** 941,953 ****
break;
}
#endif /* VMS */
! fprintf(stdout,"\n\n%s", PRESS_RETURN_TO_FINISH);
!
! fflush(stdout); /* refresh to screen */
! LYgetch(); /* grab some user input to pause */
#ifdef VMS
! HadVMSInterrupt = FALSE;
#endif /* VMS */
start_curses();
break;
--- 967,984 ----
break;
}
#endif /* VMS */
! if (Lpansi) {
! printf("\n\x0C"); /* Form feed */
! printf("\x1B[4i");
! Lpansi = FALSE;
! } else {
! fprintf(stdout,"\n\n%s", PRESS_RETURN_TO_FINISH);
! LYgetch(); /* grab some user input to pause */
#ifdef VMS
! HadVMSInterrupt = FALSE;
#endif /* VMS */
+ }
+ fflush(stdout); /* refresh to screen */
start_curses();
break;
***************
*** 1275,1280 ****
--- 1306,1312 ----
* printer links look like
* LYNXPRINT://LOCAL_FILE/lines=# print to a local file
* LYNXPRINT://TO_SCREEN/lines=# print to the screen
+ * LYNXPRINT://LPANSI/lines=# print to the local terminal
* LYNXPRINT://MAIL_FILE/lines=# mail the file
* LYNXPRINT://PRINTER/lines=#/number=# print to printer number #
*/
***************
*** 1345,1350 ****
--- 1377,1385 ----
lines_in_file);
fprintf(fp0,
" <a href=\"LYNXPRINT://TO_SCREEN/lines=%d\">Print to the screen</a>\n",
+ lines_in_file);
+ fprintf(fp0,
+ " <a href=\"LYNXPRINT://LPANSI/lines=%d\">Print out on a printer
attached to your vt100 terminal</a>\n",
lines_in_file);
for (count = 0, cur_printer = printers; cur_printer != NULL;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- LYNX-DEV patch to incorporate "lpansi" into LYPrint.c,
Nelson Henry Eric <=