> Date: Sat, 14 May 2016 13:08:54 +0200
> From: Frederic Cambus <f...@statdns.com>
> 
> Hi tech@,
> 
> Headers cleanup + use getprogname() for test(1)

*Never* include <sys/cdefs.h> directly.

And despite some of the noises guenther@ made recenly, I don't think
we have made the decision to drop __progname in favour of
getprogname().

> Index: bin/test/test.c
> ===================================================================
> RCS file: /cvs/src/bin/test/test.c,v
> retrieving revision 1.16
> diff -u -p -r1.16 test.c
> --- bin/test/test.c   13 Jan 2016 13:13:04 -0000      1.16
> +++ bin/test/test.c   14 May 2016 09:06:33 -0000
> @@ -11,7 +11,7 @@
>   * This program is in the Public Domain.
>   */
>  
> -#include <sys/types.h>
> +#include <sys/cdefs.h>
>  #include <sys/stat.h>
>  #include <unistd.h>
>  #include <ctype.h>
> @@ -155,13 +155,12 @@ static void syntax(const char *op, char 
>  int
>  main(int argc, char *argv[])
>  {
> -     extern char *__progname;
>       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