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.
This commit is contained in:
ed 2011-12-11 11:42:44 +00:00
parent 38db8319a9
commit f30d5ac5ec

View File

@ -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