This commit is contained in:
albert 2002-12-09 07:53:09 +00:00
parent 5087f3dbf6
commit b657e7e08a
7 changed files with 20 additions and 9 deletions

View File

@ -57,8 +57,8 @@ static union el *opt_ruid = NULL;
static char *opt_pattern = NULL; static char *opt_pattern = NULL;
static int static int usage (int opt) NORETURN;
usage (int opt) static int usage (int opt)
{ {
if (i_am_pkill) if (i_am_pkill)
fprintf (stderr, "Usage: pkill [-SIGNAL] [-fvx] "); fprintf (stderr, "Usage: pkill [-SIGNAL] [-fvx] ");

1
pmap.c
View File

@ -19,6 +19,7 @@
#include <unistd.h> #include <unistd.h>
#include "proc/version.h" // FIXME: we need to link the lib for this :-( #include "proc/version.h" // FIXME: we need to link the lib for this :-(
static void usage(void) NORETURN;
static void usage(void){ static void usage(void){
fprintf(stderr, fprintf(stderr,
"Usage: pmap [-r] [-x] pid...\n" "Usage: pmap [-r] [-x] pid...\n"

View File

@ -18,6 +18,9 @@
#endif #endif
#endif #endif
// since gcc-2.5
#define NORETURN __attribute__((__noreturn__))
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 96 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 96
// won't alias anything, and aligned enough for anything // won't alias anything, and aligned enough for anything
#define MALLOC __attribute__ ((__malloc__)) #define MALLOC __attribute__ ((__malloc__))

View File

@ -231,6 +231,7 @@ static void iterate(void){
} }
/***** kill help */ /***** kill help */
static void kill_usage(void) NORETURN;
static void kill_usage(void){ static void kill_usage(void){
fprintf(stderr, fprintf(stderr,
"Usage:\n" "Usage:\n"
@ -245,6 +246,7 @@ static void kill_usage(void){
} }
/***** kill */ /***** kill */
static void kill_main(int argc, const char *restrict const *restrict argv) NORETURN;
static void kill_main(int argc, const char *restrict const *restrict argv){ static void kill_main(int argc, const char *restrict const *restrict argv){
const char *sigptr; const char *sigptr;
int signo = SIGTERM; int signo = SIGTERM;
@ -317,6 +319,7 @@ no_more_args:
} }
/***** skill/snice help */ /***** skill/snice help */
static void skillsnice_usage(void) NORETURN;
static void skillsnice_usage(void){ static void skillsnice_usage(void){
if(program==PROG_SKILL){ if(program==PROG_SKILL){
fprintf(stderr, fprintf(stderr,

3
top.c
View File

@ -324,6 +324,7 @@ static const char *tg2 (int x, int y)
/* /*
* The usual program end -- * The usual program end --
* called only by functions in this section. */ * called only by functions in this section. */
static void bye_bye (int eno, const char *str) NORETURN;
static void bye_bye (int eno, const char *str) static void bye_bye (int eno, const char *str)
{ {
if (!Batch) if (!Batch)
@ -408,6 +409,7 @@ static void bye_bye (int eno, const char *str)
* Normal end of execution. * Normal end of execution.
* catches: * catches:
* SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT and SIGTERM */ * SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT and SIGTERM */
static void end_pgm (int dont_care_sig) NORETURN;
static void end_pgm (int dont_care_sig) static void end_pgm (int dont_care_sig)
{ {
(void)dont_care_sig; (void)dont_care_sig;
@ -417,6 +419,7 @@ static void end_pgm (int dont_care_sig)
/* /*
* Standard error handler to normalize the look of all err o/p */ * Standard error handler to normalize the look of all err o/p */
static void std_err (const char *str) NORETURN;
static void std_err (const char *str) static void std_err (const char *str)
{ {
static char buf[SMLBUFSIZ]; static char buf[SMLBUFSIZ];

View File

@ -36,7 +36,7 @@ static unsigned int moreheaders=TRUE;
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
static void usage(void) NORETURN;
static void usage(void) { static void usage(void) {
fprintf(stderr,"usage: vmstat [-V] [-n] [delay [count]]\n"); fprintf(stderr,"usage: vmstat [-V] [-n] [delay [count]]\n");
fprintf(stderr," -V prints version.\n"); fprintf(stderr," -V prints version.\n");
@ -47,6 +47,7 @@ static void usage(void) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
static void crash(const char *filename) NORETURN;
static void crash(const char *filename) { static void crash(const char *filename) {
perror(filename); perror(filename);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

12
watch.c
View File

@ -42,15 +42,15 @@ static int first_screen = 1;
#define min(x,y) ((x) > (y) ? (y) : (x)) #define min(x,y) ((x) > (y) ? (y) : (x))
static void static void do_usage(void) NORETURN;
do_usage(void) static void do_usage(void)
{ {
fprintf(stderr, usage, progname); fprintf(stderr, usage, progname);
exit(1); exit(1);
} }
static void static void do_exit(int status) NORETURN;
do_exit(int status) static void do_exit(int status)
{ {
if (curses_started) if (curses_started)
endwin(); endwin();
@ -58,8 +58,8 @@ do_exit(int status)
} }
/* signal handler */ /* signal handler */
static void static void die(int notused) NORETURN;
die(int notused) static void die(int notused)
{ {
(void) notused; (void) notused;
do_exit(0); do_exit(0);