From 3fffa6c6072826f70aebe72863968bffb9d714cc Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 6 Nov 2015 16:30:33 +0000 Subject: Use getprogname(3) rather than __progname. Suggested by Joerg@ Sonnenberger (NetBSD). Last year, deraadt@ confirmed on tech@ that this "has the potential to be more portable", and micro-optimizing for speed is not relevant here. Also gets rid of one global variable. --- test-progname.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test-progname.c') diff --git a/test-progname.c b/test-progname.c index 79add7eb..0418b3c0 100644 --- a/test-progname.c +++ b/test-progname.c @@ -1,9 +1,10 @@ -#include - -extern char *__progname; +#include int main(void) { - return !!strcmp(__progname, "test-progname"); + const char * progname; + + progname = getprogname(); + return progname == NULL; } -- cgit v1.2.3-56-ge451