Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/lpr/lpd Replace 1 and 2 with STDOUT_FILENO and STDE...
details: https://anonhg.NetBSD.org/src/rev/00f879b83f26
branches: trunk
changeset: 515929:00f879b83f26
user: mjl <mjl%NetBSD.org@localhost>
date: Tue Oct 09 02:15:37 2001 +0000
description:
Replace 1 and 2 with STDOUT_FILENO and STDERR_FILENO.
ANSIfy and constify.
diffstat:
usr.sbin/lpr/lpd/key.c | 46 ++++++++++++------------------------
usr.sbin/lpr/lpd/lpd.c | 6 ++--
usr.sbin/lpr/lpd/lpdchar.c | 6 ++--
usr.sbin/lpr/lpd/modes.c | 18 ++++++--------
usr.sbin/lpr/lpd/printjob.c | 56 ++++++++++++++++----------------------------
usr.sbin/lpr/lpd/recvjob.c | 32 +++++++++++--------------
6 files changed, 65 insertions(+), 99 deletions(-)
diffs (truncated from 601 to 300 lines):
diff -r f7a09f0a28a2 -r 00f879b83f26 usr.sbin/lpr/lpd/key.c
--- a/usr.sbin/lpr/lpd/key.c Mon Oct 08 23:42:21 2001 +0000
+++ b/usr.sbin/lpr/lpd/key.c Tue Oct 09 02:15:37 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.3 1997/10/20 08:08:28 scottr Exp $ */
+/* $NetBSD: key.c,v 1.4 2001/10/09 02:15:37 mjl Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)key.c 8.3 (Berkeley) 4/2/94";
#else
-__RCSID("$NetBSD: key.c,v 1.3 1997/10/20 08:08:28 scottr Exp $");
+__RCSID("$NetBSD: key.c,v 1.4 2001/10/09 02:15:37 mjl Exp $");
#endif
#endif /* not lint */
@@ -78,7 +78,7 @@
#define F_NEEDARG 0x01 /* needs an argument */
#define F_OFFOK 0x02 /* can turn off */
int flags;
-} keys[] = {
+} const keys[] = {
{ "cbreak", f_cbreak, F_OFFOK },
{ "cols", f_columns, F_NEEDARG },
{ "columns", f_columns, F_NEEDARG },
@@ -97,17 +97,14 @@
};
static int
-c_key(a, b)
- const void *a, *b;
+c_key(const void *a, const void *b)
{
return (strcmp(((struct key *)a)->name, ((struct key *)b)->name));
}
int
-ksearch(argvp, ip)
- char ***argvp;
- struct info *ip;
+ksearch(char ***argvp, struct info *ip)
{
char *name;
struct key *kp, tmp;
@@ -137,8 +134,7 @@
}
void
-f_cbreak(ip)
- struct info *ip;
+f_cbreak(struct info *ip)
{
if (ip->off)
@@ -153,8 +149,7 @@
}
void
-f_columns(ip)
- struct info *ip;
+f_columns(struct info *ip)
{
ip->win.ws_col = atoi(ip->arg);
@@ -162,8 +157,7 @@
}
void
-f_dec(ip)
- struct info *ip;
+f_dec(struct info *ip)
{
ip->t.c_cc[VERASE] = (u_char)0177;
@@ -176,8 +170,7 @@
}
void
-f_extproc(ip)
- struct info *ip;
+f_extproc(struct info *ip)
{
if (ip->set) {
@@ -190,8 +183,7 @@
}
void
-f_ispeed(ip)
- struct info *ip;
+f_ispeed(struct info *ip)
{
cfsetispeed(&ip->t, atoi(ip->arg));
@@ -199,8 +191,7 @@
}
void
-f_nl(ip)
- struct info *ip;
+f_nl(struct info *ip)
{
if (ip->off) {
@@ -214,8 +205,7 @@
}
void
-f_ospeed(ip)
- struct info *ip;
+f_ospeed(struct info *ip)
{
cfsetospeed(&ip->t, atoi(ip->arg));
@@ -223,8 +213,7 @@
}
void
-f_raw(ip)
- struct info *ip;
+f_raw(struct info *ip)
{
if (ip->off)
@@ -238,8 +227,7 @@
}
void
-f_rows(ip)
- struct info *ip;
+f_rows(struct info *ip)
{
ip->win.ws_row = atoi(ip->arg);
@@ -247,8 +235,7 @@
}
void
-f_sane(ip)
- struct info *ip;
+f_sane(struct info *ip)
{
ip->t.c_cflag = TTYDEF_CFLAG | (ip->t.c_cflag & (CLOCAL|CRTSCTS|CDTRCTS));
@@ -262,8 +249,7 @@
}
void
-f_tty(ip)
- struct info *ip;
+f_tty(struct info *ip)
{
int tmp;
diff -r f7a09f0a28a2 -r 00f879b83f26 usr.sbin/lpr/lpd/lpd.c
--- a/usr.sbin/lpr/lpd/lpd.c Mon Oct 08 23:42:21 2001 +0000
+++ b/usr.sbin/lpr/lpd/lpd.c Tue Oct 09 02:15:37 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lpd.c,v 1.30 2001/08/11 01:04:57 mjl Exp $ */
+/* $NetBSD: lpd.c,v 1.31 2001/10/09 02:15:37 mjl Exp $ */
/*
* Copyright (c) 1983, 1993, 1994
@@ -45,7 +45,7 @@
#if 0
static char sccsid[] = "@(#)lpd.c 8.7 (Berkeley) 5/10/95";
#else
-__RCSID("$NetBSD: lpd.c,v 1.30 2001/08/11 01:04:57 mjl Exp $");
+__RCSID("$NetBSD: lpd.c,v 1.31 2001/10/09 02:15:37 mjl Exp $");
#endif
#endif /* not lint */
@@ -440,7 +440,7 @@
do {
if (cp >= &cbuf[sizeof(cbuf) - 1])
fatal("Command line too long");
- if ((n = read(1, cp, 1)) != 1) {
+ if ((n = read(STDOUT_FILENO, cp, 1)) != 1) {
if (n < 0)
fatal("Lost connection");
return;
diff -r f7a09f0a28a2 -r 00f879b83f26 usr.sbin/lpr/lpd/lpdchar.c
--- a/usr.sbin/lpr/lpd/lpdchar.c Mon Oct 08 23:42:21 2001 +0000
+++ b/usr.sbin/lpr/lpd/lpdchar.c Tue Oct 09 02:15:37 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lpdchar.c,v 1.5 1997/07/17 05:44:32 mikel Exp $ */
+/* $NetBSD: lpdchar.c,v 1.6 2001/10/09 02:15:38 mjl Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)lpdchar.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: lpdchar.c,v 1.5 1997/07/17 05:44:32 mikel Exp $");
+__RCSID("$NetBSD: lpdchar.c,v 1.6 2001/10/09 02:15:38 mjl Exp $");
#endif
#endif /* not lint */
@@ -108,7 +108,7 @@
#define c111111_ 0176
#define c1111111 0177
-char scnkey[][HEIGHT] = /* this is relatively easy to modify */
+const char scnkey[][HEIGHT] = /* this is relatively easy to modify */
/* just look: */
{
{ c_______,
diff -r f7a09f0a28a2 -r 00f879b83f26 usr.sbin/lpr/lpd/modes.c
--- a/usr.sbin/lpr/lpd/modes.c Mon Oct 08 23:42:21 2001 +0000
+++ b/usr.sbin/lpr/lpd/modes.c Tue Oct 09 02:15:37 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: modes.c,v 1.3 1997/10/20 08:08:31 scottr Exp $ */
+/* $NetBSD: modes.c,v 1.4 2001/10/09 02:15:38 mjl Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)modes.c 8.3 (Berkeley) 4/2/94";
#else
-__RCSID("$NetBSD: modes.c,v 1.3 1997/10/20 08:08:31 scottr Exp $");
+__RCSID("$NetBSD: modes.c,v 1.4 2001/10/09 02:15:38 mjl Exp $");
#endif
#endif /* not lint */
@@ -59,7 +59,7 @@
* The code in optlist() depends on minus options following regular
* options, i.e. "foo" must immediately precede "-foo".
*/
-struct modes cmodes[] = {
+const struct modes cmodes[] = {
{ "cs5", CS5, CSIZE },
{ "cs6", CS6, CSIZE },
{ "cs7", CS7, CSIZE },
@@ -95,7 +95,7 @@
{ NULL },
};
-struct modes imodes[] = {
+const struct modes imodes[] = {
{ "ignbrk", IGNBRK, 0 },
{ "-ignbrk", 0, IGNBRK },
{ "brkint", BRKINT, 0 },
@@ -131,7 +131,7 @@
{ NULL },
};
-struct modes lmodes[] = {
+const struct modes lmodes[] = {
{ "echo", ECHO, 0 },
{ "-echo", 0, ECHO },
{ "echoe", ECHOE, 0 },
@@ -183,7 +183,7 @@
{ NULL },
};
-struct modes omodes[] = {
+const struct modes omodes[] = {
{ "opost", OPOST, 0 },
{ "-opost", 0, OPOST },
{ "litout", 0, OPOST },
@@ -200,11 +200,9 @@
#define CHK(s) (*name == s[0] && !strcmp(name, s))
int
-msearch(argvp, ip)
- char ***argvp;
- struct info *ip;
+msearch(char ***argvp, struct info *ip)
{
- struct modes *mp;
+ const struct modes *mp;
char *name;
name = **argvp;
diff -r f7a09f0a28a2 -r 00f879b83f26 usr.sbin/lpr/lpd/printjob.c
--- a/usr.sbin/lpr/lpd/printjob.c Mon Oct 08 23:42:21 2001 +0000
+++ b/usr.sbin/lpr/lpd/printjob.c Tue Oct 09 02:15:37 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: printjob.c,v 1.29 2001/09/24 13:22:36 wiz Exp $ */
+/* $NetBSD: printjob.c,v 1.30 2001/10/09 02:15:38 mjl Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -45,7 +45,7 @@
#if 0
static char sccsid[] = "@(#)printjob.c 8.7 (Berkeley) 5/10/95";
#else
-__RCSID("$NetBSD: printjob.c,v 1.29 2001/09/24 13:22:36 wiz Exp $");
+__RCSID("$NetBSD: printjob.c,v 1.30 2001/10/09 02:15:38 mjl Exp $");
#endif
#endif /* not lint */
@@ -142,7 +142,7 @@
static void alarmer __P((int));
Home |
Main Index |
Thread Index |
Old Index