aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mxget.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/mxget.c b/mxget.c
index 5cc41064..28831d5a 100644
--- a/mxget.c
+++ b/mxget.c
@@ -117,12 +117,19 @@ struct mxentry *getmxrecords(const char *name)
}
#endif /* HAVE_RES_SEARCH */
-#ifdef TESTMAIN
-main(int argc, char *argv[])
+#ifdef STANDALONE
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
{
int count, i;
struct mxentry *responses;
+ if (argc != 2 || 0 == strcmp(argv[1], "-h")) {
+ fprintf(stderr, "Usage: %s domain\n", argv[0]);
+ exit(1);
+ }
+
responses = getmxrecords(argv[1]);
if (responses == (struct mxentry *)NULL)
puts("No MX records found");