summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-11-25 07:40:10 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-11-25 07:40:10 +0000
commit099c028df89479c24d6c47c560a1f4603ba766cc (patch)
treeccfe7d668180d94f7280a6b89e329dfd8966ad71
parente9e43e31b213ce9f6f907c373e61d161fbd1a8ef (diff)
avoid size_t -> int conversion. style nit for sizeof(). David Krause
-rw-r--r--libexec/talkd/announce.c6
-rw-r--r--libexec/talkd/print.c14
-rw-r--r--libexec/talkd/process.c20
-rw-r--r--libexec/talkd/talkd.c14
-rw-r--r--libexec/talkd/talkd.h4
5 files changed, 29 insertions, 29 deletions
diff --git a/libexec/talkd/announce.c b/libexec/talkd/announce.c
index 05be3e7256d..357d3e3b938 100644
--- a/libexec/talkd/announce.c
+++ b/libexec/talkd/announce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: announce.c,v 1.15 2002/09/24 17:36:53 millert Exp $ */
+/* $OpenBSD: announce.c,v 1.16 2002/11/25 07:40:09 itojun Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)announce.c 5.9 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: announce.c,v 1.15 2002/09/24 17:36:53 millert Exp $";
+static char rcsid[] = "$Id: announce.c,v 1.16 2002/11/25 07:40:09 itojun Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -70,7 +70,7 @@ announce(request, remote_machine)
FILE *tf;
struct stat stbuf;
- (void)snprintf(full_tty, sizeof full_tty, "%s/%s", _PATH_DEV,
+ (void)snprintf(full_tty, sizeof(full_tty), "%s/%s", _PATH_DEV,
request->r_tty);
if (access(full_tty, 0) != 0)
return (FAILED);
diff --git a/libexec/talkd/print.c b/libexec/talkd/print.c
index 0f6250118d7..0d5ce1b0e80 100644
--- a/libexec/talkd/print.c
+++ b/libexec/talkd/print.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print.c,v 1.4 2002/05/22 00:33:39 deraadt Exp $ */
+/* $OpenBSD: print.c,v 1.5 2002/11/25 07:40:09 itojun Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)print.c 5.8 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: print.c,v 1.4 2002/05/22 00:33:39 deraadt Exp $";
+static char rcsid[] = "$Id: print.c,v 1.5 2002/11/25 07:40:09 itojun Exp $";
#endif /* not lint */
/* debug print routines */
@@ -49,11 +49,11 @@ static char rcsid[] = "$Id: print.c,v 1.4 2002/05/22 00:33:39 deraadt Exp $";
static char *types[] =
{ "leave_invite", "look_up", "delete", "announce" };
-#define NTYPES (sizeof (types) / sizeof (types[0]))
+#define NTYPES (sizeof(types) / sizeof(types[0]))
static char *answers[] =
{ "success", "not_here", "failed", "machine_unknown", "permission_denied",
"unknown_request", "badversion", "badaddr", "badctladdr" };
-#define NANSWERS (sizeof (answers) / sizeof (answers[0]))
+#define NANSWERS (sizeof(answers) / sizeof(answers[0]))
void
print_request(cp, mp)
@@ -63,7 +63,7 @@ print_request(cp, mp)
char tbuf[80], *tp;
if (mp->type > NTYPES) {
- (void)snprintf(tbuf, sizeof tbuf, "type %d", mp->type);
+ (void)snprintf(tbuf, sizeof(tbuf), "type %d", mp->type);
tp = tbuf;
} else
tp = types[mp->type];
@@ -79,12 +79,12 @@ print_response(cp, rp)
char tbuf[80], *tp, abuf[80], *ap;
if (rp->type > NTYPES) {
- (void)snprintf(tbuf, sizeof tbuf, "type %d", rp->type);
+ (void)snprintf(tbuf, sizeof(tbuf), "type %d", rp->type);
tp = tbuf;
} else
tp = types[rp->type];
if (rp->answer > NANSWERS) {
- (void)snprintf(abuf, sizeof abuf, "answer %d", rp->answer);
+ (void)snprintf(abuf, sizeof(abuf), "answer %d", rp->answer);
ap = abuf;
} else
ap = answers[rp->answer];
diff --git a/libexec/talkd/process.c b/libexec/talkd/process.c
index 3ca736ffc5c..5e4f465cdf4 100644
--- a/libexec/talkd/process.c
+++ b/libexec/talkd/process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.c,v 1.13 2002/05/22 20:16:17 millert Exp $ */
+/* $OpenBSD: process.c,v 1.14 2002/11/25 07:40:09 itojun Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)process.c 5.10 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: process.c,v 1.13 2002/05/22 20:16:17 millert Exp $";
+static char rcsid[] = "$Id: process.c,v 1.14 2002/11/25 07:40:09 itojun Exp $";
#endif /* not lint */
/*
@@ -103,9 +103,9 @@ process_request(mp, rp)
char buf1[32], buf2[32];
strlcpy(buf1, inet_ntoa(satosin(&rp->addr)->sin_addr),
- sizeof buf1);
+ sizeof(buf1));
strlcpy(buf2, inet_ntoa(satosin(&mp->ctl_addr)->sin_addr),
- sizeof buf2);
+ sizeof(buf2));
syslog(LOG_WARNING, "addresses are different, %s != %s",
buf1, buf2);
}
@@ -161,13 +161,13 @@ do_announce(mp, rp)
int result;
/* see if the user is logged */
- result = find_user(mp->r_name, mp->r_tty, sizeof mp->r_tty);
+ result = find_user(mp->r_name, mp->r_tty, sizeof(mp->r_tty));
if (result != SUCCESS) {
rp->answer = result;
return;
}
hp = gethostbyaddr((char *)&satosin(&mp->ctl_addr)->sin_addr,
- sizeof (struct in_addr), AF_INET);
+ sizeof(struct in_addr), AF_INET);
if (hp == (struct hostent *)0) {
rp->answer = MACHINE_UNKNOWN;
return;
@@ -201,7 +201,7 @@ do_announce(mp, rp)
int
find_user(name, tty, ttyl)
char *name, *tty;
- int ttyl;
+ size_t ttyl;
{
struct utmp ubuf, ubuf1;
int status;
@@ -216,10 +216,10 @@ find_user(name, tty, ttyl)
fprintf(stderr, "talkd: can't read %s.\n", _PATH_UTMP);
return (FAILED);
}
-#define SCMPN(a, b) strncmp(a, b, sizeof (a))
+#define SCMPN(a, b) strncmp(a, b, sizeof(a))
status = NOT_HERE;
- (void) strlcpy(ftty, _PATH_DEV, sizeof ftty);
- while (fread((char *) &ubuf, sizeof ubuf, 1, fd) == 1)
+ (void) strlcpy(ftty, _PATH_DEV, sizeof(ftty));
+ while (fread((char *) &ubuf, sizeof(ubuf), 1, fd) == 1)
if (SCMPN(ubuf.ut_name, name) == 0) {
if (*tty == '\0') {
/* no particular tty was requested */
diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c
index d11a9880be1..16dae7ac3f4 100644
--- a/libexec/talkd/talkd.c
+++ b/libexec/talkd/talkd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: talkd.c,v 1.16 2002/10/08 02:53:54 itojun Exp $ */
+/* $OpenBSD: talkd.c,v 1.17 2002/11/25 07:40:09 itojun Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -41,7 +41,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)talkd.c 5.8 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: talkd.c,v 1.16 2002/10/08 02:53:54 itojun Exp $";
+static char rcsid[] = "$Id: talkd.c,v 1.17 2002/11/25 07:40:09 itojun Exp $";
#endif /* not lint */
/*
@@ -84,7 +84,7 @@ main(argc, argv)
exit(1);
}
openlog("talkd", LOG_PID, LOG_DAEMON);
- if (gethostname(hostname, sizeof (hostname)) < 0) {
+ if (gethostname(hostname, sizeof(hostname)) < 0) {
syslog(LOG_ERR, "gethostname: %m");
_exit(1);
}
@@ -107,9 +107,9 @@ main(argc, argv)
memset(&response, 0, sizeof(response));
cc = recvfrom(STDIN_FILENO, (char *)&request,
- sizeof (request), 0, (struct sockaddr *)&response.addr,
+ sizeof(request), 0, (struct sockaddr *)&response.addr,
&len);
- if (cc != sizeof (request)) {
+ if (cc != sizeof(request)) {
if (cc < 0 && errno != EINTR)
syslog(LOG_WARNING, "recvfrom: %m");
continue;
@@ -130,8 +130,8 @@ main(argc, argv)
process_request(&request, &response);
/* can block here, is this what I want? */
cc = sendto(STDOUT_FILENO, (char *)&response,
- sizeof (response), 0, &ctl_addr, sizeof (ctl_addr));
- if (cc != sizeof (response))
+ sizeof(response), 0, &ctl_addr, sizeof(ctl_addr));
+ if (cc != sizeof(response))
syslog(LOG_WARNING, "sendto: %m");
}
}
diff --git a/libexec/talkd/talkd.h b/libexec/talkd/talkd.h
index 459f13abba1..fca8c054bdd 100644
--- a/libexec/talkd/talkd.h
+++ b/libexec/talkd/talkd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: talkd.h,v 1.6 2002/05/22 00:32:27 deraadt Exp $ */
+/* $OpenBSD: talkd.h,v 1.7 2002/11/25 07:40:09 itojun Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -48,7 +48,7 @@ int delete_invite(int);
/* process.c */
void process_request( CTL_MSG *, CTL_RESPONSE *);
void do_announce(CTL_MSG *, CTL_RESPONSE *);
-int find_user(char *name, char *tty, int ttyl);
+int find_user(char *name, char *tty, size_t ttyl);
/* announce.c */
int announce(CTL_MSG *,char *);