[PATCH 06/19] sfdisk: use program_invocation_short_name to determine program name

Sami Kerola
2013-06-02T17:51:53Z

fdisks/sfdisk.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/fdisks/sfdisk.c b/fdisks/sfdisk.c
index cac8252..912b95d 100644
--- a/fdisks/sfdisk.c
+++ b/fdisks/sfdisk.c
@@ -2549,7 +2549,6 @@ unsigned long long total_size;

int
main(int argc, char **argv) {
- char *progn;
int c;
char *dev;
int opt_size = 0;
@@ -2569,14 +2568,10 @@ main(int argc, char **argv) {

if (argc < 1)
errx(EXIT_FAILURE, _("no command?"));
- if ((progn = strrchr(argv[0], '/')) == NULL)
- progn = argv[0];
- else
- progn++;
- if (!strcmp(progn, "activate"))
+ if (!strcmp(program_invocation_short_name, "activate"))
activate = 1; /* equivalent to `sfdisk -A' */
#if 0 /* not important enough to deserve a name */
- else if (!strcmp(progn, "unhide"))
+ else if (!strcmp(program_invocation_short_name, "unhide"))
unhide = 1; /* equivalent to `sfdisk -U' */
#endif

--
1.8.3