delint and other cleanups.
This commit is contained in:
parent
99c164dd65
commit
23b9fac082
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: common.c,v 1.14 1998/07/09 18:35:35 msaitoh Exp $ */
|
||||
/* $NetBSD: common.c,v 1.15 1999/09/26 10:32:27 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -43,7 +43,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)common.c 8.5 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: common.c,v 1.14 1998/07/09 18:35:35 msaitoh Exp $");
|
||||
__RCSID("$NetBSD: common.c,v 1.15 1999/09/26 10:32:27 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -138,7 +138,8 @@ getport(rhost, rport)
|
||||
struct hostent *hp;
|
||||
struct servent *sp;
|
||||
struct sockaddr_in sin;
|
||||
int s, timo = 1, lport = IPPORT_RESERVED - 1;
|
||||
u_int timo = 1;
|
||||
int s, lport = IPPORT_RESERVED - 1;
|
||||
int err;
|
||||
|
||||
/*
|
||||
@ -146,14 +147,14 @@ getport(rhost, rport)
|
||||
*/
|
||||
if (rhost == NULL)
|
||||
fatal("no remote host to connect to");
|
||||
memset((char *)&sin, 0, sizeof(sin));
|
||||
memset(&sin, 0, sizeof(sin));
|
||||
if (inet_aton(rhost, &sin.sin_addr) == 1)
|
||||
sin.sin_family = AF_INET;
|
||||
else {
|
||||
hp = gethostbyname(rhost);
|
||||
if (hp == NULL)
|
||||
fatal("unknown host %s", rhost);
|
||||
memmove((caddr_t)&sin.sin_addr, hp->h_addr, hp->h_length);
|
||||
memmove(&sin.sin_addr, hp->h_addr, (size_t)hp->h_length);
|
||||
sin.sin_family = hp->h_addrtype;
|
||||
}
|
||||
if (rport == 0) {
|
||||
@ -173,7 +174,7 @@ retry:
|
||||
seteuid(uid);
|
||||
if (s < 0)
|
||||
return(-1);
|
||||
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
|
||||
if (connect(s, (const struct sockaddr *)&sin, sizeof(sin)) < 0) {
|
||||
err = errno;
|
||||
(void)close(s);
|
||||
errno = err;
|
||||
@ -233,7 +234,7 @@ getq(namelist)
|
||||
struct queue *q, **queue;
|
||||
struct stat stbuf;
|
||||
DIR *dirp;
|
||||
int nitems, arraysz;
|
||||
u_int nitems, arraysz;
|
||||
|
||||
seteuid(euid);
|
||||
if ((dirp = opendir(SD)) == NULL)
|
||||
@ -246,7 +247,7 @@ getq(namelist)
|
||||
* Estimate the array size by taking the size of the directory file
|
||||
* and dividing it by a multiple of the minimum size entry.
|
||||
*/
|
||||
arraysz = (stbuf.st_size / 24);
|
||||
arraysz = (int)(stbuf.st_size / 24);
|
||||
queue = (struct queue **)malloc(arraysz * sizeof(struct queue *));
|
||||
if (queue == NULL)
|
||||
goto errdone;
|
||||
@ -270,7 +271,7 @@ getq(namelist)
|
||||
*/
|
||||
if (++nitems > arraysz) {
|
||||
arraysz *= 2;
|
||||
queue = (struct queue **)realloc((char *)queue,
|
||||
queue = (struct queue **)realloc(queue,
|
||||
arraysz * sizeof(struct queue *));
|
||||
if (queue == NULL)
|
||||
goto errdone;
|
||||
@ -309,24 +310,24 @@ compar(p1, p2)
|
||||
char *
|
||||
checkremote()
|
||||
{
|
||||
char name[MAXHOSTNAMELEN + 1];
|
||||
char hname[MAXHOSTNAMELEN + 1];
|
||||
struct hostent *hp;
|
||||
static char errbuf[128];
|
||||
|
||||
remote = 0; /* assume printer is local */
|
||||
if (RM != NULL) {
|
||||
/* get the official name of the local host */
|
||||
gethostname(name, sizeof(name));
|
||||
name[sizeof(name)-1] = '\0';
|
||||
hp = gethostbyname(name);
|
||||
gethostname(hname, sizeof(hname));
|
||||
hname[sizeof(hname)-1] = '\0';
|
||||
hp = gethostbyname(hname);
|
||||
if (hp == (struct hostent *) NULL) {
|
||||
(void)snprintf(errbuf, sizeof(errbuf),
|
||||
"unable to get official name for local machine %s",
|
||||
name);
|
||||
hname);
|
||||
return errbuf;
|
||||
} else {
|
||||
(void)strncpy(name, hp->h_name, sizeof(name) - 1);
|
||||
name[sizeof(name) - 1] = '\0';
|
||||
(void)strncpy(hname, hp->h_name, sizeof(hname) - 1);
|
||||
hname[sizeof(hname) - 1] = '\0';
|
||||
}
|
||||
|
||||
/* get the official name of RM */
|
||||
@ -342,7 +343,7 @@ checkremote()
|
||||
* if the two hosts are not the same,
|
||||
* then the printer must be remote.
|
||||
*/
|
||||
if (strcasecmp(name, hp->h_name) != 0)
|
||||
if (strcasecmp(hname, hp->h_name) != 0)
|
||||
remote = 1;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: displayq.c,v 1.15 1998/09/14 21:23:07 frueauf Exp $ */
|
||||
/* $NetBSD: displayq.c,v 1.16 1999/09/26 10:32:27 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)displayq.c 8.4 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: displayq.c,v 1.15 1998/09/14 21:23:07 frueauf Exp $");
|
||||
__RCSID("$NetBSD: displayq.c,v 1.16 1999/09/26 10:32:27 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -148,7 +148,7 @@ displayq(format)
|
||||
if (fd >= 0) {
|
||||
(void)flock(fd, LOCK_SH);
|
||||
while ((i = read(fd, line, sizeof(line))) > 0)
|
||||
(void)fwrite(line, 1, i, stdout);
|
||||
(void)fwrite(line, 1, (size_t)i, stdout);
|
||||
(void)close(fd); /* unlocks as well */
|
||||
} else
|
||||
putchar('\n');
|
||||
@ -199,7 +199,7 @@ displayq(format)
|
||||
if (fd >= 0) {
|
||||
(void)flock(fd, LOCK_SH);
|
||||
while ((i = read(fd, line, sizeof(line))) > 0)
|
||||
(void)fwrite(line, 1, i, stdout);
|
||||
(void)fwrite(line, 1, (size_t)i, stdout);
|
||||
(void)close(fd); /* unlocks as well */
|
||||
} else
|
||||
putchar('\n');
|
||||
@ -235,7 +235,7 @@ displayq(format)
|
||||
cp = line;
|
||||
for (i = 0; i < requests && cp-line+10 < sizeof(line) - 1; i++) {
|
||||
cp += strlen(cp);
|
||||
(void)snprintf(cp, line - cp, " %d", requ[i]);
|
||||
(void)snprintf(cp, (size_t)(line - cp), " %d", requ[i]);
|
||||
}
|
||||
for (i = 0; i < users && cp - line + 1 + strlen(user[i]) <
|
||||
sizeof(line) - 1; i++) {
|
||||
@ -258,10 +258,10 @@ displayq(format)
|
||||
}
|
||||
else {
|
||||
i = strlen(line);
|
||||
if (write(fd, line, i) != i)
|
||||
if (write(fd, line, (size_t)i) != i)
|
||||
fatal("Lost connection");
|
||||
while ((i = read(fd, line, sizeof(line))) > 0)
|
||||
(void)fwrite(line, 1, i, stdout);
|
||||
(void)fwrite(line, 1, (size_t)i, stdout);
|
||||
(void)close(fd);
|
||||
}
|
||||
}
|
||||
@ -437,7 +437,7 @@ dump(nfile, file, copies)
|
||||
}
|
||||
seteuid(euid);
|
||||
if (*file && !stat(file, &lbuf))
|
||||
totsize += copies * lbuf.st_size;
|
||||
totsize += copies * (long)lbuf.st_size;
|
||||
seteuid(uid);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rmjob.c,v 1.13 1997/10/05 15:12:04 mrg Exp $ */
|
||||
/* $NetBSD: rmjob.c,v 1.14 1999/09/26 10:32:27 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)rmjob.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: rmjob.c,v 1.13 1997/10/05 15:12:04 mrg Exp $");
|
||||
__RCSID("$NetBSD: rmjob.c,v 1.14 1999/09/26 10:32:27 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -192,7 +192,7 @@ lockchk(s)
|
||||
n = 1;
|
||||
break;
|
||||
}
|
||||
sleep(i);
|
||||
sleep((size_t)i);
|
||||
}
|
||||
current[n-1] = '\0';
|
||||
(void)fclose(fp);
|
||||
@ -322,7 +322,8 @@ void
|
||||
rmremote()
|
||||
{
|
||||
char *cp, *s;
|
||||
int i, rem, len;
|
||||
int i, rem;
|
||||
size_t len;
|
||||
|
||||
if (!remote)
|
||||
return; /* not sending to a remote machine */
|
||||
@ -373,7 +374,7 @@ rmremote()
|
||||
if (len > sizeof(line))
|
||||
(void)free(s);
|
||||
while ((i = read(rem, line, sizeof(line))) > 0)
|
||||
(void)fwrite(line, 1, i, stdout);
|
||||
(void)fwrite(line, 1, (size_t)i, stdout);
|
||||
(void)close(rem);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: startdaemon.c,v 1.10 1998/07/18 05:04:39 lukem Exp $ */
|
||||
/* $NetBSD: startdaemon.c,v 1.11 1999/09/26 10:32:27 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993, 1994
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)startdaemon.c 8.2 (Berkeley) 4/17/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: startdaemon.c,v 1.10 1998/07/18 05:04:39 lukem Exp $");
|
||||
__RCSID("$NetBSD: startdaemon.c,v 1.11 1999/09/26 10:32:27 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -67,7 +67,8 @@ startdaemon(printer)
|
||||
char *printer;
|
||||
{
|
||||
struct sockaddr_un un;
|
||||
int s, n;
|
||||
int s;
|
||||
size_t n;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
s = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
@ -82,7 +83,8 @@ startdaemon(printer)
|
||||
#define SUN_LEN(unp) (strlen((unp)->sun_path) + 2)
|
||||
#endif
|
||||
seteuid(euid);
|
||||
if (connect(s, (struct sockaddr *)&un, SUN_LEN(&un)) < 0) {
|
||||
if (connect(s, (const struct sockaddr *)&un,
|
||||
(int)SUN_LEN(&un)) < 0) {
|
||||
seteuid(uid);
|
||||
warn("connect");
|
||||
(void)close(s);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: printjob.c,v 1.19 1998/07/06 07:03:28 mrg Exp $ */
|
||||
/* $NetBSD: printjob.c,v 1.20 1999/09/26 10:32:28 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -45,7 +45,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)printjob.c 8.7 (Berkeley) 5/10/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: printjob.c,v 1.19 1998/07/06 07:03:28 mrg Exp $");
|
||||
__RCSID("$NetBSD: printjob.c,v 1.20 1999/09/26 10:32:28 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -164,7 +164,7 @@ printjob()
|
||||
signal(SIGQUIT, abortpr);
|
||||
signal(SIGTERM, abortpr);
|
||||
|
||||
(void)mktemp(tempfile);
|
||||
(void)mktemp(tempfile); /* OK */
|
||||
|
||||
/*
|
||||
* uses short form file names
|
||||
|
Loading…
Reference in New Issue
Block a user