diff options
author | H. Peter Anvin <hpa@zytor.com> | 2012-08-08 20:00:20 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-08-08 20:00:20 -0700 |
commit | b9e993537698f75deb043eef58880b8f9d8bb9a0 (patch) | |
tree | 9285f7346b9b5dc9480f589723bc26e25d055f9a /tools | |
parent | d227c2aefd6f0bc9dbbe4bfbd0a56f9082d232fb (diff) | |
download | abc80-b9e993537698f75deb043eef58880b8f9d8bb9a0.tar.gz abc80-b9e993537698f75deb043eef58880b8f9d8bb9a0.tar.xz abc80-b9e993537698f75deb043eef58880b8f9d8bb9a0.zip |
abcprintd: drop CR; fix handling of the default command line
Drop CR; apparently lpr converts it to LF and results in double
spacing (sigh)...
Handle the case where we don't have a print command line correctly.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/abcprintd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/abcprintd.c b/tools/abcprintd.c index 43f9d7c..04a2590 100644 --- a/tools/abcprintd.c +++ b/tools/abcprintd.c @@ -171,7 +171,8 @@ static void output(int c, FILE *tf, enum print_state *psp) break; case ps_text: - putwc(abc_to_unicode[(unsigned char)c], tf); + if (c != '\r') + putwc(abc_to_unicode[(unsigned char)c], tf); break; case ps_binary: @@ -231,8 +232,9 @@ int main(int argc, char *argv[]) if ( badopt || optind >= argc ) { fprintf(stderr, - "Usage: %s [options] port lpr_program [lpr_args...]]\n" + "Usage: %s [options] port [lpr_program [lpr_args...]]\n" "Options:\n" + " -f run in the foreground\n" " -d dir enable file access to directory dir\n" , argv[0]); @@ -244,7 +246,7 @@ int main(int argc, char *argv[]) exit(1); } - if ( argc == optind ) { + if ( !argv[optind+1] ) { lpr_argc = sizeof(lpr_default_argv)/sizeof(const char *) - 1; lpr_argv = lpr_default_argv; } else { |