Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin static + __dead



details:   https://anonhg.NetBSD.org/src/rev/6e06c0f935f4
branches:  trunk
changeset: 769327:6e06c0f935f4
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Sep 06 18:29:35 2011 +0000

description:
static + __dead

diffstat:

 usr.bin/rusers/rusers.c |  37 ++++++++++++++---------------
 usr.bin/script/script.c |  61 ++++++++++++++++++++++++------------------------
 2 files changed, 48 insertions(+), 50 deletions(-)

diffs (248 lines):

diff -r 2c7e522526d1 -r 6e06c0f935f4 usr.bin/rusers/rusers.c
--- a/usr.bin/rusers/rusers.c   Tue Sep 06 18:28:58 2011 +0000
+++ b/usr.bin/rusers/rusers.c   Tue Sep 06 18:29:35 2011 +0000
@@ -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 <sys/cdefs.h>
 #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 <sys/types.h>
@@ -58,19 +58,18 @@
 
 #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 @@
 #define addr6 addr._addr6
 #define addr4 addr._addr4
 
-int
+static int
 search_host(struct sockaddr *sa)
 {
        struct host_list *hp;
@@ -111,7 +110,7 @@
        return(0);
 }
 
-void
+static void
 remember_host(struct sockaddr *sa)
 {
        struct host_list *hp;
@@ -138,7 +137,7 @@
        hosts = hp;
 }
 
-int
+static int
 rusers_reply(char *replyp, struct netbuf *raddrp, struct netconfig *nconf)
 {
        char host[NI_MAXHOST];
@@ -223,7 +222,7 @@
        return(0);
 }
 
-void
+static void
 onehost(char *host)
 {
        struct utmpidlearr up;
@@ -254,7 +253,7 @@
        freeaddrinfo(ai);
 }
 
-void
+static void
 allhosts(void)
 {
        struct utmpidlearr up;
@@ -269,7 +268,7 @@
                errx(1, "%s", clnt_sperrno(clnt_stat));
 }
 
-void
+static void
 usage(void)
 {
        fprintf(stderr, "usage: %s [-la] [hosts ...]\n", getprogname());
diff -r 2c7e522526d1 -r 6e06c0f935f4 usr.bin/script/script.c
--- a/usr.bin/script/script.c   Tue Sep 06 18:28:58 2011 +0000
+++ b/usr.bin/script/script.c   Tue Sep 06 18:29:35 2011 +0000
@@ -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 @@
 #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 <sys/types.h>
@@ -73,26 +73,25 @@
        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 @@
        return (0);
 }
 
-void
+static void
 finish(int signo)
 {
        int die, pid, status;
@@ -211,7 +210,7 @@
                done();
 }
 
-void
+static void
 dooutput(void)
 {
        struct itimerval value;
@@ -247,7 +246,7 @@
        done();
 }
 
-void
+static void
 scriptflush(int signo)
 {
        if (outcc) {
@@ -256,7 +255,7 @@
        }
 }
 
-void
+static void
 doshell(const char *command)
 {
        const char *shell;
@@ -278,16 +277,16 @@
        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 @@
        exit(0);
 }
 
-void
+static void
 record(FILE *fp, char *buf, size_t cc, int direction)
 {
        struct iovec iov[2];
@@ -328,7 +327,7 @@
                err(1, "writev");
 }
 
-void
+static void
 consume(FILE *fp, off_t len, char *buf, int reg)
 {
        size_t l;
@@ -356,7 +355,7 @@
        } \
 } while (0/*CONSTCOND*/)
 
-void
+static void
 playback(FILE *fp)
 {
        struct timespec tsi, tso;



Home | Main Index | Thread Index | Old Index