#include <unistd.h>
#include <pwd.h>
#include <syslog.h>
+#include <sys/types.h>
+#include "init.h"
char *Version = "@(#) wall 2.79 12-Sep-2000 miquels@cistron.nl";
#define MAXLEN 4096
#define MAXLINES 20
-extern void wall(char *, int, int);
-
int main(int argc, char **argv)
{
char buf[MAXLEN];
i = 0;
for (p = buf; *p; p++) {
- if (*p == '\n' && i++ > MAXLINES) {
+ if (*p == '\n' && ++i >= MAXLINES) {
*++p = 0;
break;
}
}
openlog("wall", LOG_PID, LOG_USER);
- syslog(LOG_INFO, "wall: user %s broadcasted %d lines (%d chars)",
+ syslog(LOG_INFO, "wall: user %s broadcasted %d lines (%zu chars)",
whoami, i, strlen(buf));
closelog();
unsetenv("TZ");
- wall(buf, 0, remote);
+ wall(buf, remote);
/*NOTREACHED*/
return 0;