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
@@ -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

Reply via email to