Get rid of warning about unused argument fromshutdown, and make sure the wall string isn't changed by the wall() function.
This commit is contained in:
parent
093ad0026b
commit
f8801cbcf1
@ -52,7 +52,7 @@ static void handler(int arg)
|
|||||||
/*
|
/*
|
||||||
* Print a text, escape all characters not in Latin-1.
|
* 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;
|
unsigned char *p;
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ static int file_isatty(const char *fname)
|
|||||||
/*
|
/*
|
||||||
* Wall function.
|
* Wall function.
|
||||||
*/
|
*/
|
||||||
void wall(char *text, int fromshutdown, int remote)
|
void wall(const char *text, int remote)
|
||||||
{
|
{
|
||||||
FILE *tp;
|
FILE *tp;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
@ -53,6 +53,9 @@ void initlog(int loglevel, char *fmt, ...);
|
|||||||
void set_term(int how);
|
void set_term(int how);
|
||||||
void print(char *fmt);
|
void print(char *fmt);
|
||||||
|
|
||||||
|
/* from dowall.c */
|
||||||
|
void wall(const char *text, int remote);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
# define INITDBG(level, fmt, args...) initlog(level, fmt, ##args)
|
# define INITDBG(level, fmt, args...) initlog(level, fmt, ##args)
|
||||||
#else
|
#else
|
||||||
|
@ -49,6 +49,8 @@
|
|||||||
#include "paths.h"
|
#include "paths.h"
|
||||||
#include "reboot.h"
|
#include "reboot.h"
|
||||||
#include "initreq.h"
|
#include "initreq.h"
|
||||||
|
#include "init.h"
|
||||||
|
|
||||||
|
|
||||||
char *Version = "@(#) shutdown 2.86-1 31-Jul-2004 miquels@cistron.nl";
|
char *Version = "@(#) shutdown 2.86-1 31-Jul-2004 miquels@cistron.nl";
|
||||||
|
|
||||||
@ -72,9 +74,6 @@ char *clean_env[] = {
|
|||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* From "wall.c" */
|
|
||||||
extern void wall(char *, int, int);
|
|
||||||
|
|
||||||
/* From "utmp.c" */
|
/* From "utmp.c" */
|
||||||
extern void write_wtmp(char *user, char *id, int pid, int type, char *line);
|
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,
|
snprintf(buf + len, sizeof(buf) - len,
|
||||||
"\rThe system is going DOWN %s in %d minute%s!\r\n",
|
"\rThe system is going DOWN %s in %d minute%s!\r\n",
|
||||||
newstate, mins, mins == 1 ? "" : "s");
|
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");
|
fprintf(stderr, "shutdown: not running.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (message[0]) wall(message, 1, 0);
|
if (message[0]) wall(message, 0);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,14 +29,13 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
#include "init.h"
|
||||||
|
|
||||||
|
|
||||||
char *Version = "@(#) wall 2.79 12-Sep-2000 miquels@cistron.nl";
|
char *Version = "@(#) wall 2.79 12-Sep-2000 miquels@cistron.nl";
|
||||||
#define MAXLEN 4096
|
#define MAXLEN 4096
|
||||||
#define MAXLINES 20
|
#define MAXLINES 20
|
||||||
|
|
||||||
extern void wall(char *, int, int);
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char buf[MAXLEN];
|
char buf[MAXLEN];
|
||||||
@ -115,7 +114,7 @@ int main(int argc, char **argv)
|
|||||||
closelog();
|
closelog();
|
||||||
|
|
||||||
unsetenv("TZ");
|
unsetenv("TZ");
|
||||||
wall(buf, 0, remote);
|
wall(buf, remote);
|
||||||
|
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user