Re: [hackers] [slock] Use argv0 instead of passing "slock:" to die every time || FRIGN

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Mon, 15 Feb 2016 12:11:56 +0100

On 14 February 2016 at 02:14, <git_AT_suckless.org> wrote:
> commit b02c4d452a7942d4be3c69e6f98dafd35a2e4e78
> Author: FRIGN <dev_AT_frign.de>
> AuthorDate: Sun Feb 14 02:13:54 2016 +0100
> Commit: FRIGN <dev_AT_frign.de>
> CommitDate: Sun Feb 14 02:13:54 2016 +0100
>
> Use argv0 instead of passing "slock:" to die every time
>
> diff --git a/slock.c b/slock.c
> index 4531f95..a0ffed0 100644
> --- a/slock.c
> +++ b/slock.c
> _AT_@ -46,6 +46,7 @@ static Bool failure = False;
> static Bool rr;
> static int rrevbase;
> static int rrerrbase;
> +static char *argv0;
>
> static void
> die(const char *errstr, ...)
> _AT_@ -53,6 +54,7 @@ die(const char *errstr, ...)
> va_list ap;
>
> va_start(ap, errstr);
> + fprintf(stderr, "%s: ", argv0);

I don't like this approach. Code should always output the original
name of the program, not the name of the process.

When someone renames slock into foo, then I cannot assert anymore what
it really is all about, if I query ./foo -v or ./foo -h

I'm for reverting to the original approach here -- btw. same for all
other suckless tools.

BR,
Anselm
Received on Mon Feb 15 2016 - 12:11:56 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 15 2016 - 12:12:19 CET