As done in other places already, replace __progname with getprogname(3).

Feedback? Comments?

Index: test.c
===================================================================
RCS file: /cvs/src/bin/test/test.c,v
retrieving revision 1.17
diff -u -p -r1.17 test.c
--- test.c      21 Jan 2017 11:03:42 -0000      1.17
+++ test.c      24 Jul 2017 15:02:03 -0000
@@ -155,13 +154,12 @@ static __dead void syntax(const char *op
 int
 main(int argc, char *argv[])
 {
-       extern char *__progname;
-       int     res;
+       int res;
 
        if (pledge("stdio rpath", NULL) == -1)
                err(2, "pledge");
 
-       if (strcmp(__progname, "[") == 0) {
+       if (strcmp(getprogname(), "[") == 0) {
                if (strcmp(argv[--argc], "]"))
                        errx(2, "missing ]");
                argv[argc] = NULL;

Reply via email to