]> diplodocus.org Git - nmh/blobdiff - test/getcanon.c
context_foil.c: Move interface to own file.
[nmh] / test / getcanon.c
index ada6802a51f9b946d20d3c573e3d4082fc96cf39..27077dc6e7131f43cf0429b52736b9794c571bbc 100644 (file)
@@ -1,17 +1,16 @@
-/*
- * getcanon.c - Print the canonical name of a host, default to localhost.
+/* getcanon.c - Print the canonical name of a host, default to localhost.
  *
  * This code is Copyright (c) 2012, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
  * complete copyright information.
  */
 
-#include <netdb.h>   /* for getaddrinfo */
+#include <netdb.h>
 #include <sys/socket.h>
 #include <sys/types.h>
-#include <unistd.h>  /* for gethostname */
-#include <limits.h>  /* for _POSIX_HOST_NAME_MAX */
-#include <string.h>  /* for memset */
+#include <unistd.h>
+#include <limits.h>
+#include <string.h>
 #include <stdio.h>
 #include <errno.h>
 
@@ -46,10 +45,10 @@ main(int argc, char *argv[])
   hints.ai_family = AF_UNSPEC;
 
   if (getaddrinfo(hostname, NULL, &hints, &res)) {
-    printf("%s\n", hostname);
+    puts(hostname);
     return 1;
   }
-  printf("%s\n", res->ai_canonname);
+  puts(res->ai_canonname);
 
   return 0;
 }