Refactor little progname() for all applictions

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-11-27 17:38:01 +01:00
1 parent 829ff0b9f7
commit f24a03a32c
7 files changed
+94 -22

No files matched your search

+2 -15
View File
@@ -28,6 +28,7 @@
#include <string.h>
#include <unistd.h>
#include <sys/reboot.h>
#include "util.h"
#ifndef RB_SW_SUSPEND /* Since Linux 2.5.18, but not in GLIBC until 2.19 */
#define RB_SW_SUSPEND 0xd000fce2
@@ -43,7 +44,6 @@ typedef enum {
static cmd_t cmd = CMD_UNKNOWN;
static char *msg = NULL;
static char *prognm;
static void translate(void)
{
@@ -96,19 +96,6 @@ static int usage(int rc)
return rc;
}
static char *progname(char *arg0)
{
char *nm;
nm = strrchr(arg0, '/');
if (nm)
nm++;
else
nm = arg0;
return nm;
}
int main(int argc, char *argv[])
{
int c, force = 0;
@@ -122,7 +109,7 @@ int main(int argc, char *argv[])
};
/* Initial command taken from program name */
prognm = progname(argv[0]);
progname(argv[0]);
translate();
while ((c = getopt_long(argc, argv, "h?fHpr", long_options, NULL)) != EOF) {