[hackers] [quark] Make host parameters optional || Nihal Jere

From: <git_AT_suckless.org>
Date: Tue, 21 Apr 2020 17:48:26 +0200 (CEST)

commit 8ccef4b27a72f339b820f91c82330a3a5b592f7b
Author: Nihal Jere <nihal_AT_nihaljere.xyz>
AuthorDate: Tue Apr 21 17:04:37 2020 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Tue Apr 21 17:04:52 2020 +0200

    Make host parameters optional
    
    For me at least, the first valid configuration found by getaddrinfo
    works fine most of the time. Obviously if this isn't the configuration
    you want, you can specify the host explicitly.

diff --git a/main.c b/main.c
index eab952d..8b882c0 100644
--- a/main.c
+++ b/main.c
_AT_@ -166,7 +166,7 @@ usage(void)
         const char *opts = "[-u user] [-g group] [-n num] [-d dir] [-l] "
                            "[-i file] [-v vhost] ... [-m map] ...";
 
- die("usage: %s -h host -p port %s\n"
+ die("usage: %s -p port [-h host] %s\n"
             " %s -U file [-p port] %s", argv0,
             opts, argv0, opts);
 }
_AT_@ -266,8 +266,8 @@ main(int argc, char *argv[])
                 usage();
         }
 
- /* allow host xor UNIX-domain socket, force port with host */
- if ((!s.host == !udsname) || (s.host && !s.port)) {
+ /* can't have both host and UDS but must have one of port or UDS*/
+ if ((s.host && udsname) || !(s.port || udsname)) {
                 usage();
         }
 
diff --git a/quark.1 b/quark.1
index ce315b5..a86f8e7 100644
--- a/quark.1
+++ b/quark.1
_AT_@ -6,8 +6,8 @@
 .Nd simple static web server
 .Sh SYNOPSIS
 .Nm
-.Fl h Ar host
 .Fl p Ar port
+.Op Fl h Ar host
 .Op Fl u Ar user
 .Op Fl g Ar group
 .Op Fl n Ar num
Received on Tue Apr 21 2020 - 17:48:26 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 21 2020 - 17:48:41 CEST