]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/test_parse_mtab.c
BIG commit to improve code style using astyle as well as fix up CNID DB
[netatalk.git] / etc / afpd / test_parse_mtab.c
index ffa95138a71db6b54187261e45711ec4aafc5971..4d8cc30dd1a51ac8f0db177ad12be496288462ca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: test_parse_mtab.c,v 1.3 2001-07-31 19:50:14 srittau Exp $
+ * $Id: test_parse_mtab.c,v 1.3.2.1 2001-12-03 05:01:04 jmarcus Exp $
  * test driver for the afpd_mtab_parse fn.  -- rgr, 9-Apr-01.
  */
 
 int
 main(int argc, char **argv)
 {
-  char *file_name = "afpd.mtab";
-  struct afpd_mount_table *table = NULL;
-  int arg = 1;
+    char *file_name = "afpd.mtab";
+    struct afpd_mount_table *table = NULL;
+    int arg = 1;
 
-  if (argc >= 3 && strcmp(argv[1], "-f") == 0) {
-    file_name = argv[2];
-    arg += 2;
-  }
-  if (arg < argc && argv[arg][0] == '-') {
-    /* either they don't understand, or they must be asking for help anyway. */
-    fprintf(stderr, "Usage:  %s [-f file-name] [file . . . ]\n",
-           argv[0]);
-    exit(1);
-  }
-  table = afpd_mtab_parse(file_name);
-  if (table != NULL) {
-    struct stat st;
-    int id, count = 0;
+    if (argc >= 3 && strcmp(argv[1], "-f") == 0) {
+        file_name = argv[2];
+        arg += 2;
+    }
+    if (arg < argc && argv[arg][0] == '-') {
+        /* either they don't understand, or they must be asking for help anyway. */
+        fprintf(stderr, "Usage:  %s [-f file-name] [file . . . ]\n",
+                argv[0]);
+        exit(1);
+    }
+    table = afpd_mtab_parse(file_name);
+    if (table != NULL) {
+        struct stat st;
+        int id, count = 0;
 
-    fprintf(stderr, "File %s:  Field width %d, shift %d.\n",
-           file_name, table->bits, table->shift);
-    for (id = 0; id < table->size; id++) {
-      struct afpd_mtab_entry *entry = table->table[id];
+        fprintf(stderr, "File %s:  Field width %d, shift %d.\n",
+                file_name, table->bits, table->shift);
+        for (id = 0; id < table->size; id++) {
+            struct afpd_mtab_entry *entry = table->table[id];
 
-      if (entry != NULL) {
-       fprintf(stderr, "  Id %d -> device %s (%d,%d) on %s -> bits 0x%08x.\n",
-               id, entry->device, entry->dev_major, entry->dev_minor,
-               entry->mount_point, entry->bit_value);
-       count++;
-      }
-    }
-    fprintf(stderr, "%d entries used out of a maximum of %d (1..%d).\n",
-           count, table->size-1, table->size-1);
-    for (; arg < argc; arg++) {
-      if (lstat(argv[arg], &st) != 0) {
-       fprintf(stderr, "Can't lstat '%s':  code %d\n",
-               argv[arg], errno);
-      }
-      else {
-       fprintf(stderr, "File %s, device (%d,%d), inode %ld, CNID 0x%08x.\n",
-               argv[arg], major(st.st_dev), minor(st.st_dev), st.st_ino,
-               CNID(&st, S_ISDIR(st.st_mode) ? 1 : 0));
-      }
+            if (entry != NULL) {
+                fprintf(stderr, "  Id %d -> device %s (%d,%d) on %s -> bits 0x%08x.\n",
+                        id, entry->device, entry->dev_major, entry->dev_minor,
+                        entry->mount_point, entry->bit_value);
+                count++;
+            }
+        }
+        fprintf(stderr, "%d entries used out of a maximum of %d (1..%d).\n",
+                count, table->size-1, table->size-1);
+        for (; arg < argc; arg++) {
+            if (lstat(argv[arg], &st) != 0) {
+                fprintf(stderr, "Can't lstat '%s':  code %d\n",
+                        argv[arg], errno);
+            }
+            else {
+                fprintf(stderr, "File %s, device (%d,%d), inode %ld, CNID 0x%08x.\n",
+                        argv[arg], major(st.st_dev), minor(st.st_dev), st.st_ino,
+                        CNID(&st, S_ISDIR(st.st_mode) ? 1 : 0));
+            }
+        }
     }
-  }
-  return(0);
+    return(0);
 }