From: Ben Gras Date: Mon, 2 Jul 2007 11:16:27 +0000 (+0000) Subject: Reported by Erik van der Kouwe : X-Git-Tag: v3.1.4~376 X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/zones/static/man.7.txt?a=commitdiff_plain;h=2746a5a2a9d948fee5290d897e9ab26d05ad6415;p=minix.git Reported by Erik van der Kouwe : - fprintf(stderr, "%s: reboot(): %s\n", strerror(errno)); + fprintf(stderr, "%s: reboot(): %s\n", prog, strerror(errno)); Other minor fixes inspired by other warnings produced by gcc. --- diff --git a/commands/reboot/halt.c b/commands/reboot/halt.c index 962e83b66..8cc385d81 100755 --- a/commands/reboot/halt.c +++ b/commands/reboot/halt.c @@ -128,6 +128,6 @@ char **argv; 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; } diff --git a/commands/reboot/sh_wall.c b/commands/reboot/sh_wall.c index dbaaeee5d..82f76400f 100755 --- a/commands/reboot/sh_wall.c +++ b/commands/reboot/sh_wall.c @@ -38,10 +38,10 @@ char *extra; /* If non-nil, why is the shutdown */ 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); @@ -96,7 +96,7 @@ char *message, *more; 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')) { diff --git a/commands/reboot/shutdown.c b/commands/reboot/shutdown.c index ac1cef8e2..bfa4f6b88 100755 --- a/commands/reboot/shutdown.c +++ b/commands/reboot/shutdown.c @@ -55,7 +55,7 @@ void wall _ARGS(( char *when, char *extra )); 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; @@ -123,7 +123,7 @@ char *arg; return; } -void main(argc,argv) +int main(argc,argv) int argc; char *argv[]; { @@ -265,7 +265,8 @@ char *argv[]; sleep(2); reboot(RBT_HALT); fprintf(stderr, "Reboot call failed: %s\n", strerror(errno)); - exit(1); + + return(1); } void usage() @@ -289,7 +290,6 @@ void terminate() FILE *in; pid_t pid; char c_pid[5]; - char buf[80]; in = fopen(SHUT_PID,"r"); if (in == (FILE *)0) { @@ -305,21 +305,12 @@ void terminate() 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); @@ -367,7 +358,7 @@ void inform_user() 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, diff --git a/commands/reboot/tinyhalt.c b/commands/reboot/tinyhalt.c index 80ce03f04..bbde83daf 100755 --- a/commands/reboot/tinyhalt.c +++ b/commands/reboot/tinyhalt.c @@ -15,7 +15,6 @@ int main(int argc, char **argv) { - int flag; char *prog; char *reboot_code = "delay; boot";