summaryrefslogtreecommitdiffstats
path: root/libexec/talkd/announce.c
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2003-04-03 05:13:27 +0000
committerjmallett <jmallett@FreeBSD.org>2003-04-03 05:13:27 +0000
commiteba71bcf69b1a44d8ff32c0aa0c0400d682b5dec (patch)
treeea700d011536a0f7f4ef18463e1769cfb052ce7e /libexec/talkd/announce.c
parent5b2b2811a19544037b626ef44e598691b3b2f525 (diff)
downloadFreeBSD-src-eba71bcf69b1a44d8ff32c0aa0c0400d682b5dec.zip
FreeBSD-src-eba71bcf69b1a44d8ff32c0aa0c0400d682b5dec.tar.gz
MFp4 @27667: WARNS=5 cleanup on i386.
Remove the unused FILE\ *tf from print_mesg args, and the bogus passing in of an uninitialised FILE* for it. Call a timeval 'now' instead of 'clock' due to shadowing. Remove a nested localtime declaration. Make the delete invite argument match the ID type, u_int32_t. Use const for pointers to const items. Cast to long where printing as such. Include netinet/in.h for htonl/htons. Reviewed by: imp
Diffstat (limited to 'libexec/talkd/announce.c')
-rw-r--r--libexec/talkd/announce.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libexec/talkd/announce.c b/libexec/talkd/announce.c
index 6d33005..ca64541 100644
--- a/libexec/talkd/announce.c
+++ b/libexec/talkd/announce.c
@@ -74,14 +74,13 @@ int
announce(CTL_MSG *request, const char *remote_machine)
{
char full_tty[32];
- FILE *tf;
struct stat stbuf;
(void)snprintf(full_tty, sizeof(full_tty),
"%s%s", _PATH_DEV, request->r_tty);
if (stat(full_tty, &stbuf) < 0 || (stbuf.st_mode&020) == 0)
return (PERMISSION_DENIED);
- return (print_mesg(request->r_tty, tf, request, remote_machine));
+ return (print_mesg(request->r_tty, request, remote_machine));
}
#define max(a,b) ( (a) > (b) ? (a) : (b) )
@@ -95,13 +94,12 @@ announce(CTL_MSG *request, const char *remote_machine)
* in in vi at the time
*/
int
-print_mesg(const char *tty, FILE *tf, CTL_MSG *request,
+print_mesg(const char *tty, CTL_MSG *request,
const char *remote_machine)
{
- struct timeval clock;
+ struct timeval now;
time_t clock_sec;
struct timezone zone;
- struct tm *localtime();
struct tm *localclock;
struct iovec iovec;
char line_buf[N_LINES][N_CHARS];
@@ -112,8 +110,8 @@ print_mesg(const char *tty, FILE *tf, CTL_MSG *request,
i = 0;
max_size = 0;
- gettimeofday(&clock, &zone);
- clock_sec = clock.tv_sec;
+ gettimeofday(&now, &zone);
+ clock_sec = now.tv_sec;
localclock = localtime(&clock_sec);
(void)snprintf(line_buf[i], N_CHARS, " ");
sizes[i] = strlen(line_buf[i]);
OpenPOWER on IntegriCloud