Re: Headers cleanup + use getprogname() for test(1)

2016-05-14 Thread Philip Guenther
On Sat, May 14, 2016 at 2:28 AM, Mark Kettenis <mark.kette...@xs4all.nl> wrote:
>> 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  directly.

+1

> 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().

Geez, can't a guy rest a bit after committing a 10k line diff?  :-)

On the point: I continue to think we should move this direction.


Philip Guenther



Re: Headers cleanup + use getprogname() for test(1)

2016-05-14 Thread Mark Kettenis
> 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  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 -  1.16
> +++ bin/test/test.c   14 May 2016 09:06:33 -
> @@ -11,7 +11,7 @@
>   * This program is in the Public Domain.
>   */
>  
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -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;
> 
> 



Headers cleanup + use getprogname() for test(1)

2016-05-14 Thread Frederic Cambus
Hi tech@,

Headers cleanup + use getprogname() for test(1)

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 -  1.16
+++ bin/test/test.c 14 May 2016 09:06:33 -
@@ -11,7 +11,7 @@
  * This program is in the Public Domain.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -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;