]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/directory.c
remove gcc warnings and cleanup inline mess
[netatalk.git] / etc / afpd / directory.c
index af57b41751eb878dd86ba96c7ed728f603b01e50..577a425484db00c3c237eec1ed67f02a1afc5b25 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.71.2.4.2.15.2.8 2005-09-27 10:40:41 didg Exp $
+ * $Id: directory.c,v 1.71.2.4.2.15.2.10 2008-11-25 15:16:32 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -392,9 +392,7 @@ struct dir *dir;
 /* remove the node from the tree. this is just like insertion, but
  * different. actually, it has to worry about a bunch of things that
  * insertion doesn't care about. */
-static void dir_remove( vol, dir )
-struct vol     *vol;
-struct dir     *dir;
+static void dir_remove( const struct vol *vol _U_, struct dir  *dir)
 {
 #ifdef REMOVE_NODES
     struct ofork *of, *last;
@@ -1290,6 +1288,12 @@ struct maccess ma;
 
 }
 
+/* --------------------- */
+static int invisible_dots(const struct vol *vol, const char *name)
+{ 
+  return vol_inv_dots(vol) && *name  == '.' && strcmp(name, ".") && strcmp(name, "..");
+}
+
 /* ------------------------------ 
    (".", curdir)
    (name, dir) with curdir:name == dir, from afp_enumerate
@@ -1343,8 +1347,7 @@ int getdirparams(const struct vol *vol,
         case DIRPBIT_ATTR :
             if ( isad ) {
                 ad_getattr(&ad, &ashort);
-            } else if (*dir->d_u_name == '.' && strcmp(dir->d_u_name, ".") 
-                        && strcmp(dir->d_u_name, "..")) {
+            } else if (invisible_dots(vol, dir->d_u_name)) {
                 ashort = htons(ATTRBIT_INVISIBLE);
             } else
                 ashort = 0;
@@ -1387,12 +1390,10 @@ int getdirparams(const struct vol *vol,
                 ashort = htons(FINDERINFO_CLOSEDVIEW);
                 memcpy(data + FINDERINFO_FRVIEWOFF, &ashort, sizeof(ashort));
 
-                /* dot files are by default invisible */
-                if (*dir->d_u_name  == '.' && strcmp(dir->d_u_name , ".") &&
-                        strcmp(dir->d_u_name , "..")) {
+                /* dot files are by default visible */
+                if (invisible_dots(vol, dir->d_u_name)) {
                     ashort = htons(FINDERINFO_INVISIBLE);
-                    memcpy(data + FINDERINFO_FRFLAGOFF,
-                           &ashort, sizeof(ashort));
+                    memcpy(data + FINDERINFO_FRFLAGOFF, &ashort, sizeof(ashort));
                 }
             }
             data += 32;
@@ -1610,8 +1611,9 @@ struct path Cur_Path = {
     0,
     "",  /* mac name */
     ".", /* unix name */
+    NULL,
     0,  /* stat is not set */
-    0,  /* */
+    0  /* errno */
 };
 
 /* ------------------ */
@@ -2144,10 +2146,9 @@ struct dir       *dir, *newparent;
 
 #define DOT_APPLEDOUBLE_LEN 13
 /* delete an empty directory */
-int deletecurdir( vol, path, pathlen )
+int deletecurdir( vol, path )
 const struct vol       *vol;
 char *path;
-int pathlen;
 {
     struct dirent *de;
     struct stat st;