Hi,

This patch merges finger.h and extern.h, has they are always included
together. It also declares static functions as such and removes them
from the prototype list.

Index: finger.c
===================================================================
RCS file: /home/tleguern/proj/perso/cvs/src/usr.bin/finger/finger.c,v
retrieving revision 1.18
diff -u -p -r1.18 finger.c
--- finger.c    12 Nov 2009 15:33:21 -0000      1.18
+++ finger.c    21 Jul 2014 10:09:46 -0000
@@ -66,7 +66,9 @@
 #include <unistd.h>
 #include <err.h>
 #include "finger.h"
-#include "extern.h"
+
+static void     loginlist(void);
+static void     userlist(int, char **);

 time_t now;
 int entries, lflag, sflag, mflag, oflag, pplan, Mflag;
@@ -158,7 +160,7 @@ main(int argc, char *argv[])
        exit(0);
 }

-void
+static void
 loginlist(void)
 {
        PERSON *pn;
@@ -184,7 +186,7 @@ loginlist(void)
                enter_lastlog(pn);
 }

-void
+static void
 userlist(int argc, char **argv)
 {
        int i;
Index: finger.h
===================================================================
RCS file: /home/tleguern/proj/perso/cvs/src/usr.bin/finger/finger.h,v
retrieving revision 1.6
diff -u -p -r1.6 finger.h
--- finger.h    15 Mar 2004 02:50:29 -0000      1.6
+++ finger.h    21 Jul 2014 10:20:20 -0000
@@ -77,3 +77,26 @@ typedef struct where {

 extern PERSON *htab[HSIZE];            /* the buckets */
 extern PERSON *phead, *ptail;          /* the linked list of all people */
+
+extern time_t now;                     /* Current time. */
+extern char tbuf[1024];                        /* Temp buffer for anybody. */
+extern int entries;                    /* Number of people. */
+extern int lflag;
+extern int oflag;
+extern int pplan;
+
+struct storage;
+
+void    enter_lastlog(PERSON *);
+PERSON *enter_person(struct passwd *);
+void    enter_where(struct utmp *, PERSON *);
+PERSON *find_person(char *);
+void    lflag_print(void);
+int     match(struct passwd *, char *);
+void    netfinger(char *);
+PERSON *palloc(void);
+char   *prphone(char *);
+void    sflag_print(void);
+char   *vs(struct storage **, char *);
+void    free_storage(struct storage *);
+
Index: lprint.c
===================================================================
RCS file: /home/tleguern/proj/perso/cvs/src/usr.bin/finger/lprint.c,v
retrieving revision 1.10
diff -u -p -r1.10 lprint.c
--- lprint.c    27 Oct 2009 23:59:38 -0000      1.10
+++ lprint.c    21 Jul 2014 10:10:38 -0000
@@ -44,13 +44,17 @@
 #include <paths.h>
 #include <vis.h>
 #include "finger.h"
-#include "extern.h"

 #define        LINE_LEN        80
 #define        TAB_LEN         8               /* 8 spaces between tabs */
 #define        _PATH_PLAN      ".plan"
 #define        _PATH_PROJECT   ".project"

+static int      demi_print(char *, int);
+static void     lprint(PERSON *);
+static int      show_text(char *, char *, char *);
+static void     vputc(int);
+
 void
 lflag_print(void)
 {
@@ -69,7 +73,7 @@ lflag_print(void)
        }
 }

-void
+static void
 lprint(PERSON *pn)
 {
        struct tm *delta;
@@ -220,7 +224,7 @@ lprint(PERSON *pn)
        }
 }

-int
+static int
 demi_print(char *str, int oddfield)
 {
        static int lenlast;
@@ -258,7 +262,7 @@ demi_print(char *str, int oddfield)
        return (oddfield);
 }

-int
+static int
 show_text(char *directory, char *file_name, char *header)
 {
        int ch, lastc;
@@ -277,7 +281,7 @@ show_text(char *directory, char *file_na
        return (1);
 }

-void
+static void
 vputc(int ch)
 {
        char visout[5], *s2;
Index: net.c
===================================================================
RCS file: /home/tleguern/proj/perso/cvs/src/usr.bin/finger/net.c,v
retrieving revision 1.12
diff -u -p -r1.12 net.c
--- net.c       27 Oct 2009 23:59:38 -0000      1.12
+++ net.c       21 Jul 2014 09:56:12 -0000
@@ -43,7 +43,6 @@
 #include <unistd.h>
 #include <err.h>
 #include "finger.h"
-#include "extern.h"

 void
 netfinger(name)
Index: sprint.c
===================================================================
RCS file: /home/tleguern/proj/perso/cvs/src/usr.bin/finger/sprint.c,v
retrieving revision 1.13
diff -u -p -r1.13 sprint.c
--- sprint.c    27 Oct 2009 23:59:38 -0000      1.13
+++ sprint.c    21 Jul 2014 10:11:51 -0000
@@ -40,7 +40,10 @@
 #include <string.h>
 #include <err.h>
 #include "finger.h"
-#include "extern.h"
+
+static int       psort(const void *, const void *);
+static PERSON  **sort(void);
+static void      stimeprint(WHERE *);

 void
 sflag_print(void)
@@ -130,7 +133,7 @@ office:
        }
 }

-PERSON **
+static PERSON **
 sort(void)
 {
        PERSON *pn, **lp;
@@ -144,13 +147,13 @@ sort(void)
        return (list);
 }

-int
+static int
 psort(const void *p, const void *t)
 {
        return (strcmp((*(PERSON **)p)->name, (*(PERSON **)t)->name));
 }

-void
+static void
 stimeprint(WHERE *w)
 {
        struct tm *delta;
Index: util.c
===================================================================
RCS file: /home/tleguern/proj/perso/cvs/src/usr.bin/finger/util.c,v
retrieving revision 1.24
diff -u -p -r1.24 util.c
--- util.c      26 Nov 2013 13:18:55 -0000      1.24
+++ util.c      21 Jul 2014 10:00:55 -0000
@@ -49,12 +49,13 @@
 #include <vis.h>
 #include <err.h>
 #include "finger.h"
-#include "extern.h"

-char   *estrdup(char *);
-WHERE  *walloc(PERSON *pn);
-void   find_idle_and_ttywrite(WHERE *);
-void   userinfo(PERSON *, struct passwd *);
+static char    *estrdup(char *);
+static WHERE   *walloc(PERSON *pn);
+static void     find_idle_and_ttywrite(WHERE *);
+static void     userinfo(PERSON *, struct passwd *);
+static void     expandusername(char *, char *, char *, int);
+static int      hash(char *);

 struct storage {
        struct storage *next;
@@ -161,7 +162,7 @@ match(struct passwd *pw, char *user)
 }

 /* inspired by usr.sbin/sendmail/util.c::buildfname */
-void
+static void
 expandusername(char *gecos, char *login, char *buf, int buflen)
 {
        char *p, *bp;

Reply via email to