]> arthur.barton.de Git - netatalk.git/commitdiff
#ifdef debug msg, you need -enable-debug1 if you want them.
authordidg <didg>
Fri, 12 Sep 2003 18:44:16 +0000 (18:44 +0000)
committerdidg <didg>
Fri, 12 Sep 2003 18:44:16 +0000 (18:44 +0000)
configure.in
etc/afpd/afp_asp.c
etc/afpd/afp_dsi.c
etc/afpd/desktop.c
etc/afpd/fork.c
etc/afpd/main.c
libatalk/util/bprint.c
libatalk/util/fault.c

index 2c9518e95c8560e68b5a9fb44cf700816f88a697..7cf3d36340d8607925c7b35a884240b482bcc9b2 100644 (file)
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.179.2.3.2.2 2003-09-09 18:18:53 bfernhomberg Exp $
+dnl $Id: configure.in,v 1.179.2.3.2.3 2003-09-12 18:44:16 didg Exp $
 dnl configure.in for netatalk
 
 AC_INIT(bin/adv1tov2/adv1tov2.c)
@@ -187,18 +187,30 @@ AC_ARG_ENABLE(ddp,
        fi
 )
 
-AC_ARG_ENABLE(debug,
-       [  --enable-debug          enable debug code],
+AC_ARG_ENABLE(debug1,
+       [  --enable-debug1          enable debug code],
        if test "$enableval" != "no"; then
                if test "$enableval" = "yes"; then
-                       AC_DEFINE(DEBUG, 1, [Define if debugging information should be included])
+                       AC_DEFINE(DEBUG1, 1, [Define if debugging information should be included])
                else
-                       AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if debugging information should be included])
+                       AC_DEFINE_UNQUOTED(DEBUG1, $enableval, [Define if debugging information should be included])
                fi 
                AC_MSG_RESULT([enabling debugging code])
        fi
 )
 
+AC_ARG_ENABLE(debug,
+       [  --enable-debug          enable verbose debug code],
+       if test "$enableval" != "no"; then
+               if test "$enableval" = "yes"; then
+                       AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
+               else
+                       AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
+               fi 
+               AC_MSG_RESULT([enabling verbose debugging code])
+       fi
+)
+
 afp3=no
 AC_ARG_ENABLE(afp3,
        [  --enable-afp3           enable AFP 3.x calls],
index 477217f1a778e5d95b18738ecd716c0ce0c6a59d..ce19547f6ef7158b9fba2d36eb8176dbd18a98ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_asp.c,v 1.18.6.1 2003-09-09 16:42:19 didg Exp $
+ * $Id: afp_asp.c,v 1.18.6.2 2003-09-12 18:44:16 didg Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -242,9 +242,11 @@ void afp_over_asp(AFPObj *obj)
             afp_asp_close(obj);
             LOG(log_info, logtype_afpd, "done" );
 
+#ifdef DEBUG1
             if ( obj->options.flags & OPTION_DEBUG ) {
                 printf( "done\n" );
             }
+#endif
             return;
             break;
 
@@ -259,10 +261,12 @@ void afp_over_asp(AFPObj *obj)
             }
 #endif /* AFS */
             func = (u_char) asp->commands[0];
+#ifdef DEBUG1
             if ( obj->options.flags & OPTION_DEBUG ) {
                 printf("command: %d (%s)\n", func, AfpNum2name(func));
                 bprint( asp->commands, asp->cmdlen );
             }
+#endif            
             if ( afp_switch[ func ] != NULL ) {
                 /*
                  * The function called from afp_switch is expected to
@@ -284,11 +288,12 @@ void afp_over_asp(AFPObj *obj)
                 asp->datalen = 0;
                 reply = AFPERR_NOOP;
             }
+#ifdef DEBUG1
             if ( obj->options.flags & OPTION_DEBUG ) {
                 printf( "reply: %d, %d\n", reply, ccnt++ );
                 bprint( asp->data, asp->datalen );
             }
-
+#endif
             if ( asp_cmdreply( asp, reply ) < 0 ) {
                 LOG(log_error, logtype_afpd, "asp_cmdreply: %s", strerror(errno) );
                 afp_asp_die(1);
@@ -297,10 +302,12 @@ void afp_over_asp(AFPObj *obj)
 
         case ASPFUNC_WRITE :
             func = (u_char) asp->commands[0];
+#ifdef DEBUG1
             if ( obj->options.flags & OPTION_DEBUG ) {
                 printf( "(write) command: %d\n", func );
                 bprint( asp->commands, asp->cmdlen );
             }
+#endif
             if ( afp_switch[ func ] != NULL ) {
                 asp->datalen = ASP_DATASIZ;
                 reply = (*afp_switch[ func ])(obj,
@@ -316,10 +323,12 @@ void afp_over_asp(AFPObj *obj)
                 asp->datalen = 0;
                 reply = AFPERR_NOOP;
             }
+#ifdef DEBUG1
             if ( obj->options.flags & OPTION_DEBUG ) {
                 printf( "(write) reply code: %d, %d\n", reply, ccnt++ );
                 bprint( asp->data, asp->datalen );
             }
+#endif
             if ( asp_wrtreply( asp, reply ) < 0 ) {
                 LOG(log_error, logtype_afpd, "asp_wrtreply: %s", strerror(errno) );
                 afp_asp_die(1);
@@ -333,7 +342,7 @@ void afp_over_asp(AFPObj *obj)
             LOG(log_info, logtype_afpd, "main: asp_getrequest: %d", reply );
             break;
         }
-
+#ifdef DEBUG1
         if ( obj->options.flags & OPTION_DEBUG ) {
 #ifdef notdef
             pdesc( stdout );
@@ -341,6 +350,7 @@ void afp_over_asp(AFPObj *obj)
             of_pforkdesc( stdout );
             fflush( stdout );
         }
+#endif
     }
 }
 
index bccc826f2cace9731791b271a7458ad25a00a3d7..201e46c1a661a05c0eea3045e4755518f8e54600 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_dsi.c,v 1.27.2.3.2.1 2003-09-09 16:42:19 didg Exp $
+ * $Id: afp_dsi.c,v 1.27.2.3.2.2 2003-09-12 18:44:17 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -183,6 +183,7 @@ static void alarm_handler()
 }
 
 
+#ifdef DEBUG1
 /*  ---------------------------------
  *  old signal handler for SIGUSR1 - set the debug flag and 
  *  redirect stdout to <tmpdir>/afpd-debug-<pid>.
@@ -197,6 +198,7 @@ void afp_set_debug (int sig)
 
     return;
 }
+#endif
 
 /* -------------------------------------------
  afp over dsi. this never returns. 
@@ -277,7 +279,9 @@ void afp_over_dsi(AFPObj *obj)
         afp_dsi_die(1);
     }
 
+#ifdef DEBUG1
     fault_setup((void (*)(void *))afp_dsi_die);
+#endif
 
     /* get stuck here until the end */
     while ((cmd = dsi_receive(dsi))) {
@@ -301,8 +305,10 @@ void afp_over_dsi(AFPObj *obj)
         case DSIFUNC_CLOSE:
             afp_dsi_close(obj);
             LOG(log_info, logtype_afpd, "done");
+#ifdef DEBUG1
             if (obj->options.flags & OPTION_DEBUG )
                 printf("done\n");
+#endif                
             return;
             break;
 
@@ -317,10 +323,12 @@ void afp_over_dsi(AFPObj *obj)
 #endif /* AFS */
 
             function = (u_char) dsi->commands[0];
+#ifdef DEBUG1
             if (obj->options.flags & OPTION_DEBUG ) {
                 printf("command: %d (%s)\n", function, AfpNum2name(function));
                 bprint((char *) dsi->commands, dsi->cmdlen);
             }
+#endif            
 
             /* send off an afp command. in a couple cases, we take advantage
              * of the fact that we're a stream-based protocol. */
@@ -349,11 +357,12 @@ void afp_over_dsi(AFPObj *obj)
                 break;
             }
 
+#ifdef DEBUG1
             if (obj->options.flags & OPTION_DEBUG ) {
                 printf( "reply: %d, %d\n", err, dsi->clientID);
                 bprint((char *) dsi->data, dsi->datalen);
             }
-
+#endif
             if (!dsi_cmdreply(dsi, err)) {
                 LOG(log_error, logtype_afpd, "dsi_cmdreply(%d): %s", dsi->socket, strerror(errno) );
                 afp_dsi_die(1);
@@ -362,11 +371,12 @@ void afp_over_dsi(AFPObj *obj)
 
         case DSIFUNC_WRITE: /* FPWrite and FPAddIcon */
             function = (u_char) dsi->commands[0];
+#ifdef DEBUG1
             if ( obj->options.flags & OPTION_DEBUG ) {
                 printf("(write) command: %d, %d\n", function, dsi->cmdlen);
                 bprint((char *) dsi->commands, dsi->cmdlen);
             }
-
+#endif
             if ( afp_switch[ function ] != NULL ) {
                 dsi->datalen = DSI_DATASIZ;
                 child.flags |= CHILD_RUNNING;
@@ -384,11 +394,12 @@ void afp_over_dsi(AFPObj *obj)
                 err = AFPERR_NOOP;
             }
 
+#ifdef DEBUG1
             if (obj->options.flags & OPTION_DEBUG ) {
                 printf( "(write) reply code: %d, %d\n", err, dsi->clientID);
                 bprint((char *) dsi->data, dsi->datalen);
             }
-
+#endif
             if (!dsi_wrtreply(dsi, err)) {
                 LOG(log_error, logtype_afpd, "dsi_wrtreply: %s", strerror(errno) );
                 afp_dsi_die(1);
@@ -408,7 +419,7 @@ void afp_over_dsi(AFPObj *obj)
             dsi_writeflush(dsi);
             break;
         }
-
+#ifdef DEBUG1
         if ( obj->options.flags & OPTION_DEBUG ) {
 #ifdef notdef
             pdesc( stdout );
@@ -416,6 +427,7 @@ void afp_over_dsi(AFPObj *obj)
             of_pforkdesc( stdout );
             fflush( stdout );
         }
+#endif
     }
 
     /* error */
index 2f4b8373b7653bd6c8cfa07f9870e0a20d937aa0..7da4966ced233c2e5f3cacdb156cac792f3cabe3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: desktop.c,v 1.26.2.4.2.2 2003-09-11 23:36:44 bfernhomberg Exp $
+ * $Id: desktop.c,v 1.26.2.4.2.3 2003-09-12 18:44:17 didg Exp $
  *
  * See COPYRIGHT.
  *
@@ -244,10 +244,12 @@ addicon_err:
         if ((asp_wrtcont(obj->handle, rbuf, &buflen) < 0) || buflen != bsize)
             return( AFPERR_PARAM );
 
+#ifdef DEBUG1
         if (obj->options.flags & OPTION_DEBUG) {
             printf("(write) len: %d\n", buflen);
             bprint(rbuf, buflen);
         }
+#endif
 
         /*
          * We're at the end of the file, add the headers, etc.  */
@@ -294,11 +296,12 @@ addicon_err:
             }
 
             while ((iovcnt = dsi_write(dsi, rbuf, buflen))) {
+#ifdef DEBUG1
                 if ( obj->options.flags & OPTION_DEBUG ) {
                     printf("(write) command cont'd: %d\n", iovcnt);
                     bprint(rbuf, iovcnt);
                 }
-
+#endif
                 if ((cc = write(si.sdt_fd, rbuf, iovcnt)) < 0) {
                     LOG(log_error, logtype_afpd, "afp_addicon: write: %s", strerror(errno));
                     dsi_writeflush(dsi);
@@ -545,11 +548,12 @@ int               ibuflen, *rbuflen;
             if (buflen < 0)
                 goto geticon_exit;
 
+#ifdef DEBUG1
             if (obj->options.flags & OPTION_DEBUG) {
                 printf( "(read) reply: %d, %d\n", buflen, dsi->clientID);
                 bprint(rbuf, buflen);
             }
-
+#endif
             /* dsi_read() also returns buffer size of next allocation */
             buflen = dsi_read(dsi, rbuf, buflen); /* send it off */
             if (buflen < 0)
index 1221534f8e14d604e316deb3dc7b61f24578048a..9b2ef87a2c4464c4fcbffca1b8351216c5d70f8e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: fork.c,v 1.51.2.2.2.1 2003-09-09 16:42:20 didg Exp $
+ * $Id: fork.c,v 1.51.2.2.2.2 2003-09-12 18:44:17 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -961,11 +961,13 @@ int is64;
     if ((obj->proto == AFPPROTO_DSI) && (*rbuflen < reqcount) && !nlmask) {
         DSI *dsi = obj->handle;
 
+#ifdef DEBUG1
         if (obj->options.flags & OPTION_DEBUG) {
             printf( "(read) reply: %d/%d, %d\n", *rbuflen,
                     (int) reqcount, dsi->clientID);
             bprint(rbuf, *rbuflen);
         }
+#endif        
         /* subtract off the offset */
         size -= offset;
         if (reqcount > size) {
@@ -1010,11 +1012,12 @@ afp_read_loop:
                 goto afp_read_exit;
 
             offset += *rbuflen;
+#ifdef DEBUG1
             if (obj->options.flags & OPTION_DEBUG) {
                 printf( "(read) reply: %d, %d\n", *rbuflen, dsi->clientID);
                 bprint(rbuf, *rbuflen);
             }
-
+#endif
             /* dsi_read() also returns buffer size of next allocation */
             cc = dsi_read(dsi, rbuf, *rbuflen); /* send it off */
             if (cc < 0)
@@ -1322,11 +1325,12 @@ int                 is64;
             return( AFPERR_PARAM );
         }
 
+#ifdef DEBUG1
         if (obj->options.flags & OPTION_DEBUG) {
             printf("(write) len: %d\n", *rbuflen);
             bprint(rbuf, *rbuflen);
         }
-
+#endif
         if ((cc = write_file(ofork, eid, offset, rbuf, *rbuflen,
                              xlate)) < 0) {
             *rbuflen = 0;
@@ -1381,11 +1385,12 @@ int                 is64;
             /* loop until everything gets written. currently
                     * dsi_write handles the end case by itself. */
             while ((cc = dsi_write(dsi, rbuf, *rbuflen))) {
+#ifdef DEBUG1
                 if ( obj->options.flags & OPTION_DEBUG ) {
                     printf("(write) command cont'd: %d\n", cc);
                     bprint(rbuf, cc);
                 }
-
+#endif
                 if ((cc = write_file(ofork, eid, offset, rbuf, cc, xlate)) < 0) {
                     dsi_writeflush(dsi);
                     *rbuflen = 0;
index 74396115d790679781aec56bc63b6c57b76674ca..b4905af17351933d41dbe153fab11a1ef521cd01 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.c,v 1.20.4.2.2.1 2003-09-09 16:42:20 didg Exp $
+ * $Id: main.c,v 1.20.4.2.2.2 2003-09-12 18:44:17 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -172,8 +172,10 @@ char       **av;
     argv = av;
     set_auth_parameters( ac, av );
 #endif /* TRU64 */
-    fault_setup(NULL);
 
+#ifdef DEBUG1
+    fault_setup(NULL);
+#endif
     afp_options_init(&default_options);
     if (!afp_options_parse(ac, av, &default_options))
         exit(1);
index cb0734fd45e82f5c4b7f464d6d1de0ee65dfdc89..7841f6a4045566442366271bdb483173eb094a7c 100644 (file)
@@ -2,6 +2,7 @@
 #include "config.h"
 #endif
 
+#ifdef DEBUG1
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -48,3 +49,4 @@ void bprint( data, len )
 
     printf("(end)\n");
 }
+#endif
index 43ebddc0ae2a88928afb2e3ff6288858f47e462b..1c62665c952ef13b9784de6ace73dd3a832bf9d9 100644 (file)
@@ -22,6 +22,8 @@
 #include "config.h"
 #endif
 
+#ifdef DEBUG1
+
 #include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -194,5 +196,4 @@ void fault_setup(void (*fn)(void *))
 #endif
 }
 
-
-
+#endif