Andreas Krennmair:
[apps/madmutt.git] / getdomain.c
index 7163627..d11c26d 100644 (file)
@@ -19,10 +19,10 @@ int fclose ();
 static void strip_trailing_dot (char *q)
 {
   char *p = q;
-  
+
   for (; *q; q++)
     p = q;
-  
+
   if (*p == '.')
     *p = '\0';
 }
@@ -34,32 +34,32 @@ int getdnsdomainname (char *s, size_t l)
   char *p = NULL;
   char *q;
 
-  if ((f = fopen ("/etc/resolv.conf", "r")) == NULL) return (-1);
+  if ((f = fopen ("/etc/resolv.conf", "r")) == NULL)
+    return (-1);
 
   tmp[sizeof (tmp) - 1] = 0;
 
-  l--; /* save room for the terminal \0 */
+  l--;                          /* save room for the terminal \0 */
 
-  while (fgets (tmp, sizeof (tmp) - 1, f) != NULL)
-  {
+  while (fgets (tmp, sizeof (tmp) - 1, f) != NULL) {
     p = tmp;
-    while (ISSPACE (*p)) p++;
-    if (mutt_strncmp ("domain", p, 6) == 0 || mutt_strncmp ("search", p, 6) == 0)
-    {
+    while (ISSPACE (*p))
+      p++;
+    if (mutt_strncmp ("domain", p, 6) == 0
+        || mutt_strncmp ("search", p, 6) == 0) {
       p += 6;
-      
+
       for (q = strtok (p, " \t\n"); q; q = strtok (NULL, " \t\n"))
-       if (strcmp (q, "."))
-         break;
-
-      if (q)
-      {
-       strip_trailing_dot (q);
-       strfcpy (s, q, l);
-       safe_fclose (&f);
-       return 0;
+        if (strcmp (q, "."))
+          break;
+
+      if (q) {
+        strip_trailing_dot (q);
+        strfcpy (s, q, l);
+        safe_fclose (&f);
+        return 0;
       }
-      
+
     }
   }