aboutsummaryrefslogtreecommitdiffstats
path: root/tools/abcprintd.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-03-11 23:11:48 +0000
committerH. Peter Anvin <hpa@zytor.com>2006-03-11 23:11:48 +0000
commit161ec04c845e121a8889bffa586aa41cb30f2337 (patch)
treeec555e05a14f859baa859a468a9fbb3704527e3b /tools/abcprintd.c
parentb0c2d713b8f75d3dbbd6475ac2a8f0cc47cebf8b (diff)
downloadabc80-161ec04c845e121a8889bffa586aa41cb30f2337.tar.gz
abc80-161ec04c845e121a8889bffa586aa41cb30f2337.tar.xz
abc80-161ec04c845e121a8889bffa586aa41cb30f2337.zip
Use FF 00 as job ending, not BREAK. Too many things don't work with BREAK.
Change 7F from section sign to middle dot; looks better on PS Courier
Diffstat (limited to 'tools/abcprintd.c')
-rw-r--r--tools/abcprintd.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/tools/abcprintd.c b/tools/abcprintd.c
index 28c1799..b813bb4 100644
--- a/tools/abcprintd.c
+++ b/tools/abcprintd.c
@@ -1,7 +1,7 @@
#ident "$Id$"
/* ----------------------------------------------------------------------- *
*
- * Copyright 2004 H. Peter Anvin - All Rights Reserved
+ * Copyright 2004-2006 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
/*
* abcprintd.c
*
- * Read a serial port; send data to lpr when receiving BREAK
+ * Read a serial port; send data to lpr when receiving FF 00
*
* Usage: abcprintd port [options to lpr]
*/
@@ -82,9 +82,9 @@ static int open_port(const char *path)
if ( tcgetattr(fd, &tio) )
return -1;
- tio.c_iflag &= ~(BRKINT|IGNBRK|IGNPAR|INPCK|ISTRIP|ICRNL|INLCR|IGNCR|
+ tio.c_iflag &= ~(BRKINT|PARMRK|INPCK|ISTRIP|ICRNL|INLCR|IGNCR|
IXON|IXOFF);
- tio.c_iflag |= PARMRK;
+ tio.c_iflag |= IGNBRK|IGNPAR;
tio.c_cflag &= ~(CSIZE|CSTOPB|HUPCL|PARENB|PARODD);
tio.c_cflag |= CLOCAL|CREAD|CS8;
@@ -122,15 +122,15 @@ static void output(int c, FILE *tf, enum print_state *psp)
"\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
" !\"#\244%&\'()*+,-./0123456789:;<=>?"
"\311ABCDEFGHIJKLMNOPQRSTUVWXYZ\304\326\305\334_"
- "\351abcdefghijklmnopqrstuvwxyz\344\366\345\374\247"
+ "\351abcdefghijklmnopqrstuvwxyz\344\366\345\374\267"
"\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217"
"\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237"
"\240\241\242\243$\245\246\247\250\251\252\253\254\255\256\257"
- "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277"
+ "\260\261\262\263\264\265\266\177\270\271\272\273\274\275\276\277"
"\300\301\302\303[]\306\307\310@\312\313\314\315\316\317"
"\320\321\322\323\324\325\\\327\330\331\332\333^\335\336\337"
"\340\341\342\343{}\346\347\350`\352\353\354\355\356\357"
- "\360\361\362\363\364\365|\367\370\371\372\373~\375\37\377";
+ "\360\361\362\363\364\365|\367\370\371\372\373~\375\376\377";
switch ( *psp ) {
case ps_first:
@@ -176,7 +176,6 @@ int main(int argc, char *argv[])
enum {
st_normal, /* Normal operation */
st_ff, /* 0xFF received */
- st_ff00, /* 0xFF 0x00 received */
} state;
char ibuf[BUF_SIZE], c;
int i, b;
@@ -233,24 +232,13 @@ int main(int argc, char *argv[])
break;
case st_ff:
- if ( c != 0 ) {
- output(c, tf, &ps);
- state = st_normal;
- } else {
- state = st_ff00;
- }
- break;
-
- case st_ff00:
if ( c == 0 )
print_setup(&tf, &ps); /* BREAK received, end of job */
+ else
+ output(c, tf, &ps);
state = st_normal;
break;
}
}
}
}
-
-
-
-