summaryrefslogtreecommitdiff
path: root/usr.sbin/lpr/lpd/key.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-05-20 23:13:51 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-05-20 23:13:51 +0000
commitb2a7fd194eceff2b87de78d7cec611dbe9852f58 (patch)
tree964c1ee0a29425901306badd36cf127d4a351291 /usr.sbin/lpr/lpd/key.c
parent1c6d6f81973745cbc85a424ec5f1931f07e8ebf7 (diff)
Pull in useful bits from NetBSD and make our lp* easier to diff and
do some minor cleanup of my own: o IPv6 support o ANSI function headers o use getopt() o synce usage() with man pages o passes -Wall on both 32bit and 64bit platforms o add an option to set the max number of children lpd will fork off o add an lpd option to bind to specific addresses instead of INADDR_ANY. o allow user to specify how long to wait for a connection to remote servers o more strlcpy() and snprintf() usage o Use FOO_FILENO constants instead of hard-coding 0-2 o Add some keeps to man the page SYNOPSIS to avoid options being split
Diffstat (limited to 'usr.sbin/lpr/lpd/key.c')
-rw-r--r--usr.sbin/lpr/lpd/key.c49
1 files changed, 19 insertions, 30 deletions
diff --git a/usr.sbin/lpr/lpd/key.c b/usr.sbin/lpr/lpd/key.c
index 259e97f28a6..bb1b136dfc8 100644
--- a/usr.sbin/lpr/lpd/key.c
+++ b/usr.sbin/lpr/lpd/key.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: key.c,v 1.4 2002/02/16 21:28:03 millert Exp $ */
+/* $OpenBSD: key.c,v 1.5 2002/05/20 23:13:50 millert Exp $ */
+/* $NetBSD: key.c,v 1.3 1997/10/20 08:08:28 scottr Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -37,7 +38,7 @@
#if 0
static const char sccsid[] = "@(#)key.c 8.3 (Berkeley) 4/2/94";
#else
-static const char rcsid[] = "$OpenBSD: key.c,v 1.4 2002/02/16 21:28:03 millert Exp $";
+static const char rcsid[] = "$OpenBSD: key.c,v 1.5 2002/05/20 23:13:50 millert Exp $";
#endif
#endif /* not lint */
@@ -56,6 +57,8 @@ static const char rcsid[] = "$OpenBSD: key.c,v 1.4 2002/02/16 21:28:03 millert E
#include "extern.h"
__BEGIN_DECLS
+static int
+ c_key(const void *, const void *);
void f_cbreak(struct info *);
void f_columns(struct info *);
void f_dec(struct info *);
@@ -75,7 +78,7 @@ static struct key {
#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 },
@@ -94,17 +97,14 @@ static struct key {
};
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;
@@ -134,8 +134,7 @@ ksearch(argvp, ip)
}
void
-f_cbreak(ip)
- struct info *ip;
+f_cbreak(struct info *ip)
{
if (ip->off)
@@ -150,8 +149,7 @@ f_cbreak(ip)
}
void
-f_columns(ip)
- struct info *ip;
+f_columns(struct info *ip)
{
ip->win.ws_col = atoi(ip->arg);
@@ -159,8 +157,7 @@ f_columns(ip)
}
void
-f_dec(ip)
- struct info *ip;
+f_dec(struct info *ip)
{
ip->t.c_cc[VERASE] = (u_char)0177;
@@ -173,8 +170,7 @@ f_dec(ip)
}
void
-f_extproc(ip)
- struct info *ip;
+f_extproc(struct info *ip)
{
if (ip->set) {
@@ -187,8 +183,7 @@ f_extproc(ip)
}
void
-f_ispeed(ip)
- struct info *ip;
+f_ispeed(struct info *ip)
{
cfsetispeed(&ip->t, atoi(ip->arg));
@@ -196,8 +191,7 @@ f_ispeed(ip)
}
void
-f_nl(ip)
- struct info *ip;
+f_nl(struct info *ip)
{
if (ip->off) {
@@ -211,8 +205,7 @@ f_nl(ip)
}
void
-f_ospeed(ip)
- struct info *ip;
+f_ospeed(struct info *ip)
{
cfsetospeed(&ip->t, atoi(ip->arg));
@@ -220,8 +213,7 @@ f_ospeed(ip)
}
void
-f_raw(ip)
- struct info *ip;
+f_raw(struct info *ip)
{
if (ip->off)
@@ -235,8 +227,7 @@ f_raw(ip)
}
void
-f_rows(ip)
- struct info *ip;
+f_rows(struct info *ip)
{
ip->win.ws_row = atoi(ip->arg);
@@ -244,8 +235,7 @@ f_rows(ip)
}
void
-f_sane(ip)
- struct info *ip;
+f_sane(struct info *ip)
{
ip->t.c_cflag = TTYDEF_CFLAG | (ip->t.c_cflag & (CLOCAL|CRTSCTS));
@@ -259,8 +249,7 @@ f_sane(ip)
}
void
-f_tty(ip)
- struct info *ip;
+f_tty(struct info *ip)
{
int tmp;