=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/write/write.c,v retrieving revision 1.18 retrieving revision 1.19 diff -c -r1.18 -r1.19 *** src/usr.bin/write/write.c 2002/12/09 08:15:29 1.18 --- src/usr.bin/write/write.c 2003/03/13 15:47:12 1.19 *************** *** 1,4 **** ! /* $OpenBSD: write.c,v 1.18 2002/12/09 08:15:29 deraadt Exp $ */ /* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: write.c,v 1.19 2003/03/13 15:47:12 deraadt Exp $ */ /* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */ /* *************** *** 47,53 **** #if 0 static char sccsid[] = "@(#)write.c 8.2 (Berkeley) 4/27/95"; #endif ! static char *rcsid = "$OpenBSD: write.c,v 1.18 2002/12/09 08:15:29 deraadt Exp $"; #endif /* not lint */ #include --- 47,53 ---- #if 0 static char sccsid[] = "@(#)write.c 8.2 (Berkeley) 4/27/95"; #endif ! static char *rcsid = "$OpenBSD: write.c,v 1.19 2003/03/13 15:47:12 deraadt Exp $"; #endif /* not lint */ #include *************** *** 68,74 **** void done(int sig); void do_write(char *, char *, uid_t); void wr_fputs(char *); ! void search_utmp(char *, char *, char *, uid_t); int term_chk(char *, int *, time_t *, int); int utmp_chk(char *, char *); --- 68,74 ---- void done(int sig); void do_write(char *, char *, uid_t); void wr_fputs(char *); ! void search_utmp(char *, char *, int, char *, uid_t); int term_chk(char *, int *, time_t *, int); int utmp_chk(char *, char *); *************** *** 103,109 **** /* check args */ switch (argc) { case 2: ! search_utmp(argv[1], tty, mytty, myuid); do_write(tty, mytty, myuid); break; case 3: --- 103,109 ---- /* check args */ switch (argc) { case 2: ! search_utmp(argv[1], tty, sizeof tty, mytty, myuid); do_write(tty, mytty, myuid); break; case 3: *************** *** 165,171 **** * writing from, unless that's the only terminal with messages enabled. */ void ! search_utmp(char *user, char *tty, char *mytty, uid_t myuid) { struct utmp u; time_t bestatime, atime; --- 165,171 ---- * writing from, unless that's the only terminal with messages enabled. */ void ! search_utmp(char *user, char *tty, int ttyl, char *mytty, uid_t myuid) { struct utmp u; time_t bestatime, atime; *************** *** 194,200 **** ++nttys; if (atime > bestatime) { bestatime = atime; ! (void)strcpy(tty, atty); } } --- 194,200 ---- ++nttys; if (atime > bestatime) { bestatime = atime; ! (void)strlcpy(tty, atty, ttyl); } } *************** *** 203,209 **** errx(1, "%s is not logged in", user); if (nttys == 0) { if (user_is_me) { /* ok, so write to yourself! */ ! (void)strcpy(tty, mytty); return; } errx(1, "%s has messages disabled", user); --- 203,209 ---- errx(1, "%s is not logged in", user); if (nttys == 0) { if (user_is_me) { /* ok, so write to yourself! */ ! (void)strlcpy(tty, mytty, ttyl); return; } errx(1, "%s has messages disabled", user); *************** *** 265,271 **** /* print greeting */ if (gethostname(host, sizeof(host)) < 0) ! (void)strcpy(host, "???"); now = time((time_t *)NULL); nows = ctime(&now); nows[16] = '\0'; --- 265,271 ---- /* print greeting */ if (gethostname(host, sizeof(host)) < 0) ! (void)strlcpy(host, "???", sizeof host); now = time((time_t *)NULL); nows = ctime(&now); nows[16] = '\0';