Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/shlock Use pid_t directly. Apply static and __dead.



details:   https://anonhg.NetBSD.org/src/rev/82c7769a9cc8
branches:  trunk
changeset: 769328:82c7769a9cc8
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Sep 06 18:30:38 2011 +0000

description:
Use pid_t directly. Apply static and __dead.

diffstat:

 usr.bin/shlock/shlock.c |  41 ++++++++++++++++++++---------------------
 1 files changed, 20 insertions(+), 21 deletions(-)

diffs (104 lines):

diff -r 6e06c0f935f4 -r 82c7769a9cc8 usr.bin/shlock/shlock.c
--- a/usr.bin/shlock/shlock.c   Tue Sep 06 18:29:35 2011 +0000
+++ b/usr.bin/shlock/shlock.c   Tue Sep 06 18:30:38 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: shlock.c,v 1.11 2011/08/31 16:24:58 plunky Exp $       */
+/*     $NetBSD: shlock.c,v 1.12 2011/09/06 18:30:38 joerg Exp $        */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: shlock.c,v 1.11 2011/08/31 16:24:58 plunky Exp $");
+__RCSID("$NetBSD: shlock.c,v 1.12 2011/09/06 18:30:38 joerg Exp $");
 #endif
 
 #include <sys/types.h>
@@ -88,11 +88,11 @@
 #define        TRUE    1
 #define        FALSE   0
 
-int    Debug = FALSE;
-char   *Pname;
-const char USAGE[] = "%s: USAGE: %s [-du] [-p PID] -f file\n";
-const char E_unlk[] = "%s: unlink(%s): %s\n";
-const char E_open[] = "%s: open(%s): %s\n";
+static int     Debug = FALSE;
+static char    *Pname;
+static const char USAGE[] = "%s: USAGE: %s [-du] [-p PID] -f file\n";
+static const char E_unlk[] = "%s: unlink(%s): %s\n";
+static const char E_open[] = "%s: open(%s): %s\n";
 
 #define        dprintf if (Debug) printf
 
@@ -103,12 +103,11 @@
 */
 
 /* the following is in case you need to make the prototypes go away. */
-char   *xtmpfile(char *, pid_t, int);
-int    p_exists(pid_t);
-int    cklock(char *, int);
-int    mklock(char *, pid_t, int);
-void   bad_usage(void);
-int    main(int, char **);
+static char    *xtmpfile(char *, pid_t, int);
+static int     p_exists(pid_t);
+static int     cklock(char *, int);
+static int     mklock(char *, pid_t, int);
+__dead static void     bad_usage(void);
 
 /*
 ** Create a temporary file, all ready to lock with.
@@ -116,8 +115,8 @@
 ** gave us a full path, instead of using the current directory
 ** which might not be in the same filesystem.
 */
-char *
-xtmpfile(char *file, __pid_t pid, int uucpstyle)
+static char *
+xtmpfile(char *file, pid_t pid, int uucpstyle)
 {
        int     fd;
        int     len;
@@ -182,8 +181,8 @@
 ** Does the PID exist?
 ** Send null signal to find out.
 */
-int
-p_exists(__pid_t pid)
+static int
+p_exists(pid_t pid)
 {
        dprintf("%s: process %ld is ", Pname, (u_long)pid);
        if (pid <= 0) {
@@ -222,7 +221,7 @@
 **     o       No clean up to do if the system or application crashes.
 **
 */
-int
+static int
 cklock(char *file, int uucpstyle)
 {
        int     fd = open(file, O_RDONLY);
@@ -250,8 +249,8 @@
        return(p_exists(uucpstyle ? pid : atoi(buf)));
 }
 
-int
-mklock(char *file, __pid_t pid, int uucpstyle)
+static int
+mklock(char *file, pid_t pid, int uucpstyle)
 {
        char    *tmp;
        int     retcode = FALSE;
@@ -298,7 +297,7 @@
        return(retcode);
 }
 
-void
+static void
 bad_usage(void)
 {
        fprintf(stderr, USAGE, Pname, Pname);



Home | Main Index | Thread Index | Old Index