summaryrefslogtreecommitdiff
path: root/whois.c
diff options
context:
space:
mode:
authorMarco d'Itri <md@linux.it>2014-09-13 04:42:33 +0200
committerMarco d'Itri <md@linux.it>2014-09-13 05:27:51 +0200
commit1ae06d1a5a633a9efe7544a671f1885e00320094 (patch)
tree9ab1e37ae769e81b5045f214d0514f7138606f51 /whois.c
parentec1d53f1ba698e9b4d8be3c378e3f6bcbb93e5db (diff)
downloadwhois-1ae06d1a5a633a9efe7544a671f1885e00320094.tar.gz
Move longopts into main()
Diffstat (limited to 'whois.c')
-rw-r--r--whois.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/whois.c b/whois.c
index 66277f4..c36ffd2 100644
--- a/whois.c
+++ b/whois.c
@@ -71,23 +71,25 @@ int hide_discl = HIDE_DISABLED;
const char *client_tag = IDSTRING;
-#ifdef HAVE_GETOPT_LONG
-static const struct option longopts[] = {
- {"version", no_argument, NULL, 1 },
- {"verbose", no_argument, NULL, 2 },
- {"help", no_argument, NULL, 3 },
- {"server", required_argument, NULL, 'h'},
- {"host", required_argument, NULL, 'h'},
- {"port", required_argument, NULL, 'p'},
- {NULL, 0, NULL, 0 }
-};
-#else
+#ifndef HAVE_GETOPT_LONG
extern char *optarg;
extern int optind;
#endif
int main(int argc, char *argv[])
{
+#ifdef HAVE_GETOPT_LONG
+ const struct option longopts[] = {
+ {"version", no_argument, NULL, 1 },
+ {"verbose", no_argument, NULL, 2 },
+ {"help", no_argument, NULL, 3 },
+ {"server", required_argument, NULL, 'h'},
+ {"host", required_argument, NULL, 'h'},
+ {"port", required_argument, NULL, 'p'},
+ {NULL, 0, NULL, 0 }
+ };
+#endif
+
int ch, nopar = 0, fstringlen = 64;
const char *server = NULL, *port = NULL;
char *qstring, *fstring;