1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

Use __progname instead of hand-rolled parsing of argv[0].

Inspired by similar diffs by tobias@ and millert@.

"I like the concept" pjanzen@
ok tedu@
This commit is contained in:
tb 2015-12-16 14:16:27 +00:00
parent 59c7b1366f
commit 48aa608063

View File

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.8 2014/03/11 07:42:55 guenther Exp $ */
/* $OpenBSD: main.c,v 1.9 2015/12/16 14:16:27 tb Exp $ */
/* $NetBSD: main.c,v 1.3 1995/04/22 10:37:01 cgd Exp $ */
/*
@ -43,6 +43,7 @@ main(argc, argv)
int argc;
char **argv;
{
extern char *__progname;
char *p;
int i;
int fd;
@ -56,10 +57,7 @@ main(argc, argv)
exit(1);
close(fd);
if ((p = strrchr(*argv, '/')))
p++;
else
p = *argv;
p = __progname;
if (strcmp(p, "driver") == 0 || strcmp(p, "saildriver") == 0)
mode = MODE_DRIVER;
else if (strcmp(p, "sail.log") == 0)