From 4d72fc9046a446d86a6cb0ba970910f51f6b5727 Mon Sep 17 00:00:00 2001 From: joerg Date: Tue, 6 Sep 2011 18:29:35 +0000 Subject: [PATCH] static + __dead --- usr.bin/rusers/rusers.c | 37 ++++++++++++------------- usr.bin/script/script.c | 61 ++++++++++++++++++++--------------------- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/usr.bin/rusers/rusers.c b/usr.bin/rusers/rusers.c index a491c72ac182..429f0267dfc8 100644 --- a/usr.bin/rusers/rusers.c +++ b/usr.bin/rusers/rusers.c @@ -1,4 +1,4 @@ -/* $NetBSD: rusers.c,v 1.24 2011/08/30 17:06:21 plunky Exp $ */ +/* $NetBSD: rusers.c,v 1.25 2011/09/06 18:29:35 joerg Exp $ */ /*- * Copyright (c) 1993 John Brezak @@ -30,7 +30,7 @@ #include #ifndef lint -__RCSID("$NetBSD: rusers.c,v 1.24 2011/08/30 17:06:21 plunky Exp $"); +__RCSID("$NetBSD: rusers.c,v 1.25 2011/09/06 18:29:35 joerg Exp $"); #endif /* not lint */ #include @@ -58,19 +58,18 @@ __RCSID("$NetBSD: rusers.c,v 1.24 2011/08/30 17:06:21 plunky Exp $"); #define MAX_INT 0x7fffffff -struct timeval timeout = { 25, 0 }; -int longopt; -int allopt; +static struct timeval timeout = { 25, 0 }; +static int longopt; +static int allopt; -void allhosts(void); -int main(int, char *[]); -void onehost(char *); -void remember_host(struct sockaddr *); -int rusers_reply(char *, struct netbuf *, struct netconfig *); -int search_host(struct sockaddr *); -void usage(void); +static void allhosts(void); +static void onehost(char *); +static void remember_host(struct sockaddr *); +static int rusers_reply(char *, struct netbuf *, struct netconfig *); +static int search_host(struct sockaddr *); +__dead static void usage(void); -struct host_list { +static struct host_list { struct host_list *next; int family; union { @@ -82,7 +81,7 @@ struct host_list { #define addr6 addr._addr6 #define addr4 addr._addr4 -int +static int search_host(struct sockaddr *sa) { struct host_list *hp; @@ -111,7 +110,7 @@ search_host(struct sockaddr *sa) return(0); } -void +static void remember_host(struct sockaddr *sa) { struct host_list *hp; @@ -138,7 +137,7 @@ remember_host(struct sockaddr *sa) hosts = hp; } -int +static int rusers_reply(char *replyp, struct netbuf *raddrp, struct netconfig *nconf) { char host[NI_MAXHOST]; @@ -223,7 +222,7 @@ rusers_reply(char *replyp, struct netbuf *raddrp, struct netconfig *nconf) return(0); } -void +static void onehost(char *host) { struct utmpidlearr up; @@ -254,7 +253,7 @@ onehost(char *host) freeaddrinfo(ai); } -void +static void allhosts(void) { struct utmpidlearr up; @@ -269,7 +268,7 @@ allhosts(void) errx(1, "%s", clnt_sperrno(clnt_stat)); } -void +static void usage(void) { fprintf(stderr, "usage: %s [-la] [hosts ...]\n", getprogname()); diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index 6fc32624ca12..98774ea4840d 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -1,4 +1,4 @@ -/* $NetBSD: script.c,v 1.20 2011/06/08 13:51:13 yamt Exp $ */ +/* $NetBSD: script.c,v 1.21 2011/09/06 18:29:56 joerg Exp $ */ /* * Copyright (c) 1980, 1992, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1992, 1993\ #if 0 static char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: script.c,v 1.20 2011/06/08 13:51:13 yamt Exp $"); +__RCSID("$NetBSD: script.c,v 1.21 2011/09/06 18:29:56 joerg Exp $"); #endif /* not lint */ #include @@ -73,26 +73,25 @@ struct stamp { uint32_t scr_direction; /* 'i', 'o', etc (also indicates endianness) */ }; -FILE *fscript; -int master, slave; -int child, subchild; -int outcc; -int usesleep, rawout; -int quiet, flush; -const char *fname; +static FILE *fscript; +static int master, slave; +static int child, subchild; +static int outcc; +static int usesleep, rawout; +static int quiet, flush; +static const char *fname; -struct termios tt; +static struct termios tt; -void done(void); -void dooutput(void); -void doshell(const char *); -void fail(void); -void finish(int); -int main(int, char **); -void scriptflush(int); -void record(FILE *, char *, size_t, int); -void consume(FILE *, off_t, char *, int); -void playback(FILE *); +__dead static void done(void); +__dead static void dooutput(void); +__dead static void doshell(const char *); +__dead static void fail(void); +static void finish(int); +static void scriptflush(int); +static void record(FILE *, char *, size_t, int); +static void consume(FILE *, off_t, char *, int); +__dead static void playback(FILE *); int main(int argc, char *argv[]) @@ -197,7 +196,7 @@ main(int argc, char *argv[]) return (0); } -void +static void finish(int signo) { int die, pid, status; @@ -211,7 +210,7 @@ finish(int signo) done(); } -void +static void dooutput(void) { struct itimerval value; @@ -247,7 +246,7 @@ dooutput(void) done(); } -void +static void scriptflush(int signo) { if (outcc) { @@ -256,7 +255,7 @@ scriptflush(int signo) } } -void +static void doshell(const char *command) { const char *shell; @@ -278,16 +277,16 @@ doshell(const char *command) fail(); } -void -fail() +static void +fail(void) { (void)kill(0, SIGTERM); done(); } -void -done() +static void +done(void) { time_t tvec; @@ -308,7 +307,7 @@ done() exit(0); } -void +static void record(FILE *fp, char *buf, size_t cc, int direction) { struct iovec iov[2]; @@ -328,7 +327,7 @@ record(FILE *fp, char *buf, size_t cc, int direction) err(1, "writev"); } -void +static void consume(FILE *fp, off_t len, char *buf, int reg) { size_t l; @@ -356,7 +355,7 @@ consume(FILE *fp, off_t len, char *buf, int reg) } \ } while (0/*CONSTCOND*/) -void +static void playback(FILE *fp) { struct timespec tsi, tso;