diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-04 11:53:06 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-04 11:53:06 +0000 |
commit | 8a4b7d06ffbe850e5186e7994f245809c75d29f5 (patch) | |
tree | 430069999a3c8b72217ed4c5e2309b9808a809c5 /usr.sbin | |
parent | 41825ebcd1c1b1c101667efb51ab14027456d079 (diff) |
correct -P, $PRINTER, and DEFLP interactions. bug reported by scott.burns@labatt.com
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/lpr/lpq/lpq.c | 7 | ||||
-rw-r--r-- | usr.sbin/lpr/lpr/lpr.c | 10 | ||||
-rw-r--r-- | usr.sbin/lpr/lprm/lprm.c | 7 | ||||
-rw-r--r-- | usr.sbin/lpr/pac/pac.c | 9 |
4 files changed, 27 insertions, 6 deletions
diff --git a/usr.sbin/lpr/lpq/lpq.c b/usr.sbin/lpr/lpq/lpq.c index e9026bf8e5d..8559dc93cda 100644 --- a/usr.sbin/lpr/lpq/lpq.c +++ b/usr.sbin/lpr/lpq/lpq.c @@ -104,8 +104,13 @@ main(argc, argv) usage(); } - if (printer == NULL && (printer = getenv("PRINTER")) == NULL) + if (printer == NULL) { + char *p; + printer = DEFLP; + if ((p = getenv("PRINTER")) + printer = p; + } for (argc -= optind, argv += optind; argc; --argc, ++argv) if (isdigit(argv[0][0])) { diff --git a/usr.sbin/lpr/lpr/lpr.c b/usr.sbin/lpr/lpr/lpr.c index 037851a05ff..bd299a8d7f6 100644 --- a/usr.sbin/lpr/lpr/lpr.c +++ b/usr.sbin/lpr/lpr/lpr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lpr.c,v 1.2 1996/04/21 23:40:42 deraadt Exp $ */ +/* $OpenBSD: lpr.c,v 1.3 1996/05/04 11:52:55 deraadt Exp $ */ /* $NetBSD: lpr.c,v 1.10 1996/03/21 18:12:25 jtc Exp $ */ /* @@ -259,8 +259,14 @@ main(argc, argv) } } } - if (printer == NULL && (printer = getenv("PRINTER")) == NULL) + + if (printer == NULL) { + char *p; + printer = DEFLP; + if ((p = getenv("PRINTER")) + printer = p; + } chkprinter(printer); if (SC && ncopies > 1) fatal2("multiple copies are not allowed"); diff --git a/usr.sbin/lpr/lprm/lprm.c b/usr.sbin/lpr/lprm/lprm.c index df3a6cb3b04..88607c2083f 100644 --- a/usr.sbin/lpr/lprm/lprm.c +++ b/usr.sbin/lpr/lprm/lprm.c @@ -133,8 +133,13 @@ main(argc, argv) } } } - if (printer == NULL && (printer = getenv("PRINTER")) == NULL) + if (printer == NULL) { + char *p; + printer = DEFLP; + if ((p = getenv("PRINTER")) + printer = p; + } rmjob(); exit(0); diff --git a/usr.sbin/lpr/pac/pac.c b/usr.sbin/lpr/pac/pac.c index ac8abc21374..36e15f253f7 100644 --- a/usr.sbin/lpr/pac/pac.c +++ b/usr.sbin/lpr/pac/pac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pac.c,v 1.3 1996/04/21 23:40:48 deraadt Exp $ */ +/* $OpenBSD: pac.c,v 1.4 1996/05/04 11:53:05 deraadt Exp $ */ /* $NetBSD: pac.c,v 1.7 1996/03/21 18:21:20 jtc Exp $ */ /* @@ -169,8 +169,13 @@ fprintf(stderr, (void) enter(--cp); allflag = 0; } - if (printer == NULL && (printer = getenv("PRINTER")) == NULL) + if (printer == NULL) { + char *p; + printer = DEFLP; + if ((p = getenv("PRINTER")) + printer = p; + } if (!chkprinter(printer)) { printf("pac: unknown printer %s\n", printer); exit(2); |