From f8801cbcf141968b9af5f1310d4bb77210d45b23 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sun, 22 Nov 2009 22:05:53 +0000 Subject: [PATCH] Get rid of warning about unused argument fromshutdown, and make sure the wall string isn't changed by the wall() function. --- src/dowall.c | 4 ++-- src/init.h | 3 +++ src/shutdown.c | 9 ++++----- src/wall.c | 5 ++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/dowall.c b/src/dowall.c index 821324f..05684e0 100644 --- a/src/dowall.c +++ b/src/dowall.c @@ -52,7 +52,7 @@ static void handler(int arg) /* * Print a text, escape all characters not in Latin-1. */ -static void feputs(char *line, FILE *fp) +static void feputs(const char *line, FILE *fp) { unsigned char *p; @@ -132,7 +132,7 @@ static int file_isatty(const char *fname) /* * Wall function. */ -void wall(char *text, int fromshutdown, int remote) +void wall(const char *text, int remote) { FILE *tp; struct sigaction sa; diff --git a/src/init.h b/src/init.h index fea706b..8a44468 100644 --- a/src/init.h +++ b/src/init.h @@ -53,6 +53,9 @@ void initlog(int loglevel, char *fmt, ...); void set_term(int how); void print(char *fmt); +/* from dowall.c */ +void wall(const char *text, int remote); + #if DEBUG # define INITDBG(level, fmt, args...) initlog(level, fmt, ##args) #else diff --git a/src/shutdown.c b/src/shutdown.c index 79add5e..84f99f1 100644 --- a/src/shutdown.c +++ b/src/shutdown.c @@ -49,6 +49,8 @@ #include "paths.h" #include "reboot.h" #include "initreq.h" +#include "init.h" + char *Version = "@(#) shutdown 2.86-1 31-Jul-2004 miquels@cistron.nl"; @@ -72,9 +74,6 @@ char *clean_env[] = { NULL, }; -/* From "wall.c" */ -extern void wall(char *, int, int); - /* From "utmp.c" */ extern void write_wtmp(char *user, char *id, int pid, int type, char *line); @@ -206,7 +205,7 @@ void warn(int mins) snprintf(buf + len, sizeof(buf) - len, "\rThe system is going DOWN %s in %d minute%s!\r\n", newstate, mins, mins == 1 ? "" : "s"); - wall(buf, 1, 0); + wall(buf, 0); } /* @@ -619,7 +618,7 @@ int main(int argc, char **argv) fprintf(stderr, "shutdown: not running.\n"); exit(1); } - if (message[0]) wall(message, 1, 0); + if (message[0]) wall(message, 0); exit(0); } diff --git a/src/wall.c b/src/wall.c index 12176dc..92d9fb4 100644 --- a/src/wall.c +++ b/src/wall.c @@ -29,14 +29,13 @@ #include #include #include +#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]; @@ -115,7 +114,7 @@ int main(int argc, char **argv) closelog(); unsetenv("TZ"); - wall(buf, 0, remote); + wall(buf, remote); /*NOTREACHED*/ return 0;