Re: [hackers] [dwm][PATCH] Do not call die() upon '-v' invocation

From: Ali H. Fardan <raiz_AT_firemail.cc>
Date: Fri, 28 Oct 2016 12:45:14 +0000

I don't think -v should output to stderr either, actually, imo, I think
usage() should return success.

On 2016-10-28 12:40, Klemens Nanni wrote:
> Returning -1 upon a valid invocation like 'dwm -v' is just wrong.
> ---
> dwm.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/dwm.c b/dwm.c
> index 421bf27..35828b4 100644
> --- a/dwm.c
> +++ b/dwm.c
> _AT_@ -2122,8 +2122,10 @@ zoom(const Arg *arg)
> int
> main(int argc, char *argv[])
> {
> - if (argc == 2 && !strcmp("-v", argv[1]))
> - die("dwm-"VERSION);
> + if (argc == 2 && !strcmp("-v", argv[1])) {
> + fputs("dwm-"VERSION, stderr);
> + return EXIT_SUCCESS;
> + }
> else if (argc != 1)
> die("usage: dwm [-v]");
> if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())

---
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
Received on Fri Oct 28 2016 - 14:45:14 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 28 2016 - 14:48:19 CEST