sync();
reboot(flag, monitor_code, strlen(monitor_code));
- fprintf(stderr, "%s: reboot(): %s\n", strerror(errno));
+ fprintf(stderr, "%s: reboot(): %s\n", prog, strerror(errno));
return 1;
}
struct utsname utsname;
struct stat con_st, tty_st;
- if (ourtty = ttyname(1)) {
- if (ourname = strrchr(ourtty, '/')) ourtty = ourname+1;
+ if ((ourtty = ttyname(1))) {
+ if ((ourname = strrchr(ourtty, '/'))) ourtty = ourname+1;
} else ourtty = "system task";
- if (pw = getpwuid(getuid())) ourname = pw->pw_name;
+ if ((pw = getpwuid(getuid()))) ourname = pw->pw_name;
else ourname = "unknown";
time(&now);
char *m = more;
char *end = message + 1024 - 1;
- while (p < end && *p != 0) *p++;
+ while (p < end && *p != 0) p++;
while (p < end && *m != 0) {
if (*m == '\n' && (p == message || p[-1] != '\n')) {
int crash_check _ARGS(( void ));
void parse_time _ARGS(( char *arg ));
void get_message _ARGS(( void ));
-void main _ARGS(( int argc, char *argv[] ));
+int main _ARGS(( int argc, char *argv[] ));
char *itoa _ARGS(( int n ));
long wait_time=0L;
return;
}
-void main(argc,argv)
+int main(argc,argv)
int argc;
char *argv[];
{
sleep(2);
reboot(RBT_HALT);
fprintf(stderr, "Reboot call failed: %s\n", strerror(errno));
- exit(1);
+
+ return(1);
}
void usage()
FILE *in;
pid_t pid;
char c_pid[5];
- char buf[80];
in = fopen(SHUT_PID,"r");
if (in == (FILE *)0) {
puts("Shutdown process terminated");
unlink(SHUT_PID);
unlink(NOLOGIN);
-#ifdef not_very_useful
- in = fopen (SHUT_LOG,"a");
- if (in == (FILE *)0)
- exit(0);
- sprintf (buf, "Shutdown with pid %d terminated\n",pid);
- fputs(buf,in);
- fclose(in);
-#endif
exit(0);
}
void get_message()
{
char line[80];
- int max_lines=12;
puts ("Type your message. End with ^D at an empty line");
fputs ("shutdown> ",stdout);fflush(stdout);
else
if (wait_time > 1)
sprintf(mes,
- "\nThe system will shutdown in %d seconds\n\n",
+ "\nThe system will shutdown in %ld seconds\n\n",
wait_time);
else
sprintf(mes,
int main(int argc, char **argv)
{
- int flag;
char *prog;
char *reboot_code = "delay; boot";