Author: ed
Date: Sun Dec 11 11:42:44 2011
New Revision: 228408
URL: http://svn.freebsd.org/changeset/base/228408

Log:
  Let reboot(8) use getprogname() to compare the program name.
  
  While there, mark the global variable dohalt static, as reboot(8) only
  consists of a single C file.

Modified:
  head/sbin/reboot/reboot.c

Modified: head/sbin/reboot/reboot.c
==============================================================================
--- head/sbin/reboot/reboot.c   Sun Dec 11 11:38:50 2011        (r228407)
+++ head/sbin/reboot/reboot.c   Sun Dec 11 11:42:44 2011        (r228408)
@@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$");
 static void usage(void);
 static u_int get_pageins(void);
 
-int dohalt;
+static int dohalt;
 
 int
 main(int argc, char *argv[])
@@ -69,9 +69,9 @@ main(int argc, char *argv[])
        const struct passwd *pw;
        int ch, howto, i, fd, lflag, nflag, qflag, sverrno;
        u_int pageins;
-       const char *p, *user, *kernel = NULL;
+       const char *user, *kernel = NULL;
 
-       if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) {
+       if (strcmp(getprogname(), "halt") == 0) {
                dohalt = 1;
                howto = RB_HALT;
        } else
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to