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 Schouten 2011-12-11 11:42:44 +00:00
parent 5111cde131
commit e802a0b31e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228408

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