]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/desktop.c
remove the daemon icon, it's not displayed on OS9 and not always on OSX, from HAT
[netatalk.git] / etc / afpd / desktop.c
index 946180888be3e85980beb81e62c7933178e55fda..ae9521d32c1d220e61f213a6b0582dacb6ff045a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: desktop.c,v 1.26.2.4.2.15 2004-06-20 15:30:04 bfernhomberg Exp $
+ * $Id: desktop.c,v 1.26.2.4.2.18.2.5 2006-09-15 00:35:03 didg Exp $
  *
  * See COPYRIGHT.
  *
@@ -41,9 +41,9 @@
 
 
 int afp_opendt(obj, ibuf, ibuflen, rbuf, rbuflen )
-AFPObj      *obj;
+AFPObj  *obj _U_;
 char   *ibuf, *rbuf;
-int            ibuflen, *rbuflen;
+int    ibuflen _U_, *rbuflen;
 {
     struct vol *vol;
     u_int16_t  vid;
@@ -62,15 +62,15 @@ int         ibuflen, *rbuflen;
 }
 
 int afp_closedt(obj, ibuf, ibuflen, rbuf, rbuflen )
-AFPObj      *obj;
-char   *ibuf, *rbuf;
-int            ibuflen, *rbuflen;
+AFPObj  *obj _U_;
+char   *ibuf _U_, *rbuf _U_;
+int    ibuflen _U_, *rbuflen;
 {
     *rbuflen = 0;
     return( AFP_OK );
 }
 
-struct savedt  si = { { 0, 0, 0, 0 }, -1, 0 };
+struct savedt  si = { { 0, 0, 0, 0 }, -1, 0, 0 };
 
 static char *icon_dtfile(struct vol *vol, u_char creator[ 4 ])
 {
@@ -80,6 +80,8 @@ static char *icon_dtfile(struct vol *vol, u_char creator[ 4 ])
 static int iconopen( vol, creator, flags, mode )
 struct vol     *vol;
 u_char creator[ 4 ];
+int flags;
+int mode;
 {
     char       *dtf, *adt, *adts;
 
@@ -125,9 +127,9 @@ u_char      creator[ 4 ];
 }
 
 int afp_addicon(obj, ibuf, ibuflen, rbuf, rbuflen)
-AFPObj      *obj;
+AFPObj  *obj;
 char   *ibuf, *rbuf;
-int            ibuflen, *rbuflen;
+int    ibuflen _U_, *rbuflen;
 {
     struct vol         *vol;
 #ifndef NO_DDP
@@ -309,11 +311,13 @@ addicon_err:
     return( AFP_OK );
 }
 
-u_char utag[] = { 0, 0, 0, 0 };
-u_char ucreator[] = { 'U', 'N', 'I', 'X' };
-u_char utype[] = { 'T', 'E', 'X', 'T' };
-short  usize = 256;
-u_char uicon[] = {
+static const u_char    utag[] = { 0, 0, 0, 0 };
+static const u_char    ucreator[] = { 0, 0, 0, 0 };/* { 'U', 'N', 'I', 'X' };*/
+static const u_char    utype[] = { 0, 0, 0, 0 };/* { 'T', 'E', 'X', 'T' };*/
+static const short     usize = 256;
+
+#if 0
+static const u_char    uicon[] = {
     0x1F, 0xFF, 0xFC, 0x00, 0x10, 0x00, 0x06, 0x00,
     0x10, 0x00, 0x05, 0x00, 0x10, 0x00, 0x04, 0x80,
     0x10, 0x00, 0x04, 0x40, 0x10, 0x00, 0x04, 0x20,
@@ -347,11 +351,12 @@ u_char    uicon[] = {
     0x1F, 0xFF, 0xFF, 0xF0, 0x1F, 0xFF, 0xFF, 0xF0,
     0x1F, 0xFF, 0xFF, 0xF0, 0x1F, 0xFF, 0xFF, 0xF0,
 };
+#endif
 
 int afp_geticoninfo(obj, ibuf, ibuflen, rbuf, rbuflen )
-AFPObj      *obj;
+AFPObj  *obj _U_;
 char   *ibuf, *rbuf;
-int            ibuflen, *rbuflen;
+int    ibuflen _U_, *rbuflen;
 {
     struct vol *vol;
     u_char     fcreator[ 4 ], ih[ 12 ];
@@ -423,9 +428,9 @@ int         ibuflen, *rbuflen;
 
 
 int afp_geticon(obj, ibuf, ibuflen, rbuf, rbuflen )
-AFPObj      *obj;
+AFPObj  *obj;
 char   *ibuf, *rbuf;
-int            ibuflen, *rbuflen;
+int    ibuflen _U_, *rbuflen;
 {
     struct vol *vol;
     off_t       offset;
@@ -452,6 +457,7 @@ int         ibuflen, *rbuflen;
     memcpy( &bsize, ibuf, sizeof( bsize ));
     bsize = ntohs( bsize );
 
+#if 0
     if ( memcmp( fcreator, ucreator, sizeof( ucreator )) == 0 &&
             memcmp( ftype, utype, sizeof( utype )) == 0 &&
             itype == 1 &&
@@ -460,6 +466,7 @@ int         ibuflen, *rbuflen;
         *rbuflen = bsize;
         return( AFP_OK );
     }
+#endif
 
     if ( iconopen( vol, fcreator, O_RDONLY, 0 ) < 0) {
         return( AFPERR_NOITEM );
@@ -572,7 +579,7 @@ geticon_exit:
 }
 
 /* ---------------------- */
-static char            hexdig[] = "0123456789abcdef";
+static const char              hexdig[] = "0123456789abcdef";
 char *dtfile(const struct vol *vol, u_char creator[], char *ext )
 {
     static char        path[ MAXPATHLEN + 1];
@@ -725,7 +732,7 @@ static int ad_addcomment(struct vol *vol, struct path *path, char *ibuf)
     
     isadir = path_isadir(path);
     if (isadir || !(of = of_findname(path))) {
-        ad_init(&ad, vol->v_adouble);
+        ad_init(&ad, vol->v_adouble, vol->v_ad_options);
         adp = &ad;
     } else
         adp = of->of_ad;
@@ -736,32 +743,28 @@ static int ad_addcomment(struct vol *vol, struct path *path, char *ibuf)
         return( AFPERR_ACCESS );
     }
 
-    if (!ad_getentryoff(adp, ADEID_COMMENT)) {
-        /* not defined, save nothing but return success */
-        return AFP_OK;
-    }
-
-    if ( (ad_getoflags( adp, ADFLAGS_HF ) & O_CREAT) ) {
-        if ( *path->m_name == '\0' ) {
-            name = curdir->d_m_name;
-        } else {
-            name = path->m_name;
+    if (ad_getentryoff(adp, ADEID_COMMENT)) {
+        if ( (ad_getoflags( adp, ADFLAGS_HF ) & O_CREAT) ) {
+            if ( *path->m_name == '\0' ) {
+                name = curdir->d_m_name;
+            } else {
+                name = path->m_name;
+            }
+            ad_setname(adp, name);
         }
-        ad_setname(adp, name);
+        ad_setentrylen( adp, ADEID_COMMENT, clen );
+        memcpy( ad_entry( adp, ADEID_COMMENT ), ibuf, clen );
+        ad_flush( adp, ADFLAGS_HF );
     }
-
-    ad_setentrylen( adp, ADEID_COMMENT, clen );
-    memcpy( ad_entry( adp, ADEID_COMMENT ), ibuf, clen );
-    ad_flush( adp, ADFLAGS_HF );
     ad_close( adp, ADFLAGS_HF );
     return( AFP_OK );
 }
 
 /* ----------------------------- */
 int afp_addcomment(obj, ibuf, ibuflen, rbuf, rbuflen )
-AFPObj      *obj;
-char   *ibuf, *rbuf;
-int            ibuflen, *rbuflen;
+AFPObj      *obj _U_;
+char   *ibuf, *rbuf _U_;
+int            ibuflen _U_, *rbuflen;
 {
     struct vol         *vol;
     struct dir         *dir;
@@ -807,7 +810,7 @@ static int ad_getcomment(struct vol *vol, struct path *path, char *rbuf, int *rb
     upath = path->u_name;
     isadir = path_isadir(path);
     if (isadir || !(of = of_findname(path))) {
-        ad_init(&ad, vol->v_adouble);
+        ad_init(&ad, vol->v_adouble, vol->v_ad_options);
         adp = &ad;
     } else
         adp = of->of_ad;
@@ -817,6 +820,7 @@ static int ad_getcomment(struct vol *vol, struct path *path, char *rbuf, int *rb
     }
 
     if (!ad_getentryoff(adp, ADEID_COMMENT)) {
+        ad_close( adp, ADFLAGS_HF );
         return AFPERR_NOITEM;
     }
     /*
@@ -839,9 +843,9 @@ static int ad_getcomment(struct vol *vol, struct path *path, char *rbuf, int *rb
 
 /* -------------------- */
 int afp_getcomment(obj, ibuf, ibuflen, rbuf, rbuflen )
-AFPObj      *obj;
+AFPObj      *obj _U_;
 char   *ibuf, *rbuf;
-int            ibuflen, *rbuflen;
+int            ibuflen _U_, *rbuflen;
 {
     struct vol         *vol;
     struct dir         *dir;
@@ -886,7 +890,7 @@ static int ad_rmvcomment(struct vol *vol, struct path *path)
 
     isadir = path_isadir(path);
     if (isadir || !(of = of_findname(path))) {
-        ad_init(&ad, vol->v_adouble);
+        ad_init(&ad, vol->v_adouble, vol->v_ad_options);
         adp = &ad;
     } else
         adp = of->of_ad;
@@ -904,21 +908,19 @@ static int ad_rmvcomment(struct vol *vol, struct path *path)
         }
     }
 
-    if (!ad_getentryoff(adp, ADEID_COMMENT)) {
-        return AFP_OK;
+    if (ad_getentryoff(adp, ADEID_COMMENT)) {
+        ad_setentrylen( adp, ADEID_COMMENT, 0 );
+        ad_flush( adp, ADFLAGS_HF );
     }
-
-    ad_setentrylen( adp, ADEID_COMMENT, 0 );
-    ad_flush( adp, ADFLAGS_HF );
     ad_close( adp, ADFLAGS_HF );
     return( AFP_OK );
 }
 
 /* ----------------------- */
 int afp_rmvcomment(obj, ibuf, ibuflen, rbuf, rbuflen )
-AFPObj      *obj;
-char   *ibuf, *rbuf;
-int            ibuflen, *rbuflen;
+AFPObj      *obj _U_;
+char   *ibuf, *rbuf _U_;
+int            ibuflen _U_, *rbuflen;
 {
     struct vol         *vol;
     struct dir         *dir;