| Date: Tue, 23 Jan 2018 15:43:47 -0300
Add flag to not perform reverse lookups
Signed-off-by: Lucas Gabriel Vuotto
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat:
geomyidae.8 | 4 ++++
main.c | 12 ++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
--- |
| t@@ -15,6 +15,7 @@
.Op Fl 6
.Op Fl c
.Op Fl d
+.Op Fl n
.Op Fl l Ar logfile
.Op Fl v Ar loglevel
.Op Fl b Ar base
t@@ -97,6 +98,9 @@ directory (by default off).
Don't fork into background. If no log file is given, this implies logging to
the standard output.
.
+.It Fl n
+Don't perform reverse lookups.
+.
.It Fl l Ar logfile
Specify file where log output is written (no default)
. |
| t@@ -41,6 +41,7 @@ int glfd = -1;
int loglvl = 15;
int running = 1;
int listfd = -1;
+int revlookup = 1;
char *logfile = nil;
char *argv0;
t@@ -93,7 +94,7 @@ logentry(char *host, char *port, char *qry, char *status)
tim = time(0);
ptr = localtime(&tim);
- ahost = reverselookup(host);
+ ahost = revlookup ? reverselookup(host) : host;
strftime(timstr, sizeof(timstr), "%F %T %z", ptr);
dprintf(glfd, "[%s|%s|%s|%s] %s\n",
t@@ -302,9 +303,9 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *port)
void
usage(void)
{
- dprintf(2, "usage: %s [-4] [-6] [-c] [-d] [-l logfile] [-v loglvl] "
- "[-b base] [-p port] [-o sport] [-u user] [-g group] "
- "[-h host] [-i IP]\n",
+ dprintf(2, "usage: %s [-4] [-6] [-c] [-d] [-n] [-l logfile] "
+ "[-v loglvl] [-b base] [-p port] [-o sport] "
+ "[-u user] [-g group] [-h host] [-i IP]\n",
argv0);
exit(1);
}
t@@ -374,6 +375,9 @@ main(int argc, char *argv[])
case 'o':
sport = EARGF(usage());
break;
+ case 'n':
+ revlookup = 0;
+ break;
default:
usage();
} ARGEND; |