Wed Feb 11 14:06:20 2004 Michael Jennings (mej)

Fixed handling of escape sequences while printing.  Pointed out by
Tom A. Cox <tomc@hot.rr.com>.


SVN revision: 8941
This commit is contained in:
Michael Jennings 2004-02-11 19:03:37 +00:00
parent 020ab11571
commit 41ba8fec04
2 changed files with 14 additions and 6 deletions

View File

@ -5168,3 +5168,8 @@ Mon Jan 19 21:02:30 2004 Michael Jennings (mej)
Patch from David Lloyd <dmlloyd@tds.net> for overstrike support.
----------------------------------------------------------------------
Wed Feb 11 14:06:20 2004 Michael Jennings (mej)
Fixed handling of escape sequences while printing. Pointed out by
Tom A. Cox <tomc@hot.rr.com>.
----------------------------------------------------------------------

View File

@ -850,7 +850,6 @@ void
process_print_pipe(void)
{
const char *const escape_seq = "\033[4i";
const char *const rev_escape_seq = "i4[\033";
int index;
FILE *fd;
@ -858,14 +857,18 @@ process_print_pipe(void)
for (index = 0; index < 4; /* nil */ ) {
unsigned char ch = cmd_getc();
if (ch == escape_seq[index])
if (ch == escape_seq[index]) {
index++;
else if (index)
for ( /*nil */ ; index > 0; index--)
fputc(rev_escape_seq[index - 1], fd);
} else if (index) {
int i;
if (index == 0)
for (i = 0; index > 0; i++, index--) {
fputc(escape_seq[i], fd);
}
}
if (index == 0) {
fputc(ch, fd);
}
}
pclose_printer(fd);
}