remove most of the debug code: often makes the code unreadable, for little
authorPierre Habouzit <madcoder@debian.org>
Mon, 13 Nov 2006 23:14:05 +0000 (00:14 +0100)
committerPierre Habouzit <madcoder@debian.org>
Mon, 13 Nov 2006 23:14:05 +0000 (00:14 +0100)
gain when we debug, because the debugging is due to the high level of code
interweaving

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
64 files changed:
alias.c
attach.c
commands.c
complete.c
compress.c
configure.ac
copy.c
from.c
handler.c
hcache.c
headers.c
imap/auth.c
imap/auth_anon.c
imap/auth_cram.c
imap/auth_gss.c
imap/auth_login.c
imap/auth_sasl.c
imap/browse.c
imap/command.c
imap/imap.c
imap/message.c
imap/util.c
init.c
init.h
lib-crypt/crypt-gpgme.c
lib-crypt/crypt.c
lib-crypt/gnupgparse.c
lib-crypt/pgp.c
lib-crypt/pgpinvoke.c
lib-crypt/pgpkey.c
lib-crypt/pgpmicalg.c
lib-crypt/smime.c
lib-lib/Makefile.am
lib-lib/buffer.c
lib-lib/debug.c [deleted file]
lib-lib/debug.h [deleted file]
lib-lib/file.c
lib-mime/rfc822parse.c
lib-sys/mutt_socket.c
lib-sys/mutt_ssl.c
lib-ui/color.c
lib-ui/curs_lib.c
lib-ui/curs_main.c
main.c
makedoc.c
mbox.c
mh.c
mutt_idna.c
mutt_sasl.c
muttlib.c
mx.c
nntp/newsrc.c
nntp/nntp.c
pager.c
pop/pop.c
pop/pop_auth.c
pop/pop_lib.c
postpone.c
query.c
rfc1524.c
rfc3676.c
send.c
sendlib.c
state.c

diff --git a/alias.c b/alias.c
index 1500dbc..7706be0 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -38,7 +38,6 @@
 #include <lib-lib/file.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
 #include <lib-lib/rx.h>
 
 #include <lib-sys/unix.h>
index e352c4a..63723dc 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -26,7 +26,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/file.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include <lib-sys/unix.h>
 
@@ -106,7 +105,6 @@ int mutt_compose_attachment (BODY * a)
         m_strcpy(command, sizeof(command), entry->composecommand);
       if (rfc1524_expand_filename (entry->nametemplate,
                                    a->filename, newfile, sizeof (newfile))) {
-        debug_print (1, ("oldfile: %s\t newfile: %s\n", a->filename, newfile));
         if (safe_symlink (a->filename, newfile) == -1) {
           if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES)
               != M_YES)
@@ -227,8 +225,7 @@ int mutt_edit_attachment (BODY * a)
       m_strcpy(command, sizeof(command), entry->editcommand);
       if (rfc1524_expand_filename (entry->nametemplate,
                                    a->filename, newfile, sizeof (newfile))) {
-        debug_print (1, ("oldfile: %s\t newfile: %s\n", a->filename, newfile));
-        if (safe_symlink (a->filename, newfile) == -1) {
+          if (safe_symlink (a->filename, newfile) == -1) {
           if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES)
               != M_YES)
             goto bailout;
@@ -339,7 +336,6 @@ void mutt_check_lookup_list (BODY * b, char *type, int len)
                   n == TYPEMULTIPART ? "multipart" :
                   n == TYPETEXT ? "text" :
                   n == TYPEVIDEO ? "video" : "other", tmp.subtype);
-        debug_print (1, ("\"%s\" -> %s\n", b->filename, type));
       }
       if (tmp.subtype)
         p_delete(&tmp.subtype);
@@ -899,8 +895,6 @@ int mutt_print_attachment (FILE * fp, BODY * a)
     rfc1524_entry *entry;
     int piped = FALSE;
 
-    debug_print (2, ("Using mailcap...\n"));
-
     entry = rfc1524_new_entry ();
     rfc1524_mailcap_lookup (a, type, entry, M_PRINT);
     if (rfc1524_expand_filename (entry->nametemplate, a->filename,
@@ -979,16 +973,11 @@ int mutt_print_attachment (FILE * fp, BODY * a)
     mutt_mktemp (newfile);
     if (mutt_decode_save_attachment (fp, a, newfile, M_PRINTING, 0) == 0) {
 
-      debug_print (2, ("successfully decoded %s type attachment to %s\n",
-               type, newfile));
-
       if ((ifp = fopen (newfile, "r")) == NULL) {
         mutt_perror ("fopen");
         goto bail0;
       }
 
-      debug_print (2, ("successfully opened %s read-only\n", newfile));
-
       mutt_endwin (NULL);
       if ((thepid =
            mutt_create_filter (NONULL (PrintCmd), &fpout, NULL, NULL)) < 0) {
@@ -997,8 +986,6 @@ int mutt_print_attachment (FILE * fp, BODY * a)
         goto bail0;
       }
 
-      debug_print (2, ("Filter created.\n"));
-
       mutt_copy_stream (ifp, fpout);
 
       safe_fclose (&fpout);
index b53fb3d..e64c8c2 100644 (file)
@@ -25,7 +25,6 @@
 #include <lib-lib/file.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/ascii.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -144,7 +143,6 @@ int mutt_display_message (HEADER * cur)
                              (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) |
                              CH_DECODE | CH_FROM);
     if (res == 0 && (ferror(fpout) || feof(fpout))) {
-      debug_print (1, ("_mutt_copy_message failed to detect EOF!\n"));
       res = -1;
     }
 
index 40af1a6..2fd849a 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <lib-lib/str.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 #include "mx.h"
@@ -45,8 +44,6 @@ int mutt_complete (char *s, ssize_t slen)
 
   char imap_path[LONG_STRING];
 
-  debug_print (2, ("completing %s\n", s));
-
 #ifdef USE_NNTP
   if (option (OPTNEWS)) {
     string_list_t *l = CurrentNewsSrv->list;
@@ -159,7 +156,6 @@ int mutt_complete (char *s, ssize_t slen)
   }
 
   if (dirp == NULL) {
-    debug_print (1, ("%s: %s (errno %d).\n", exp_dirpart, strerror (errno), errno));
     return (-1);
   }
 
index bd78ff7..21b3c14 100644 (file)
@@ -16,7 +16,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-sys/mutt_signal.h>
 #include <lib-sys/unix.h>
@@ -233,7 +232,6 @@ int mutt_open_read_compressed (CONTEXT * ctx)
   cmd = get_compression_cmd (ci->open, ctx);
   if (cmd == NULL)
     return (-1);
-  debug_print (2, ("DecompressCmd: '%s'\n", cmd));
 
   if ((fp = fopen (ctx->realpath, "r")) == NULL) {
     mutt_perror (ctx->realpath);
@@ -321,8 +319,6 @@ int mutt_open_append_compressed (CONTEXT * ctx)
 /* close a compressed mailbox */
 void mutt_fast_close_compressed (CONTEXT * ctx)
 {
-  debug_print (2, ("called on '%s'\n", ctx->path));
-
   if (ctx->compressinfo) {
     if (ctx->fp)
       fclose (ctx->fp);
@@ -370,8 +366,6 @@ int mutt_sync_compressed (CONTEXT * ctx)
     return (-1);
   }
 
-  debug_print (2, ("CompressCommand: '%s'\n", cmd));
-
   endwin ();
   fflush (stdout);
   sprintf (echo_cmd, _("echo Compressing %s..."), ctx->realpath);
@@ -402,8 +396,6 @@ int mutt_slow_close_compressed (CONTEXT * ctx)
   char *cmd;
   COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
 
-  debug_print (2, ("called on '%s'\n", ctx->path));
-
   if (!(ctx->append && ((append = get_append_command (ctx->realpath, ctx))
                         || (append = ci->close)))) {    /* if we can not or should not append,
                                                          * we only have to remove the compressed info, because sync was already
@@ -443,8 +435,6 @@ int mutt_slow_close_compressed (CONTEXT * ctx)
     return (-1);
   }
 
-  debug_print (2, ("CompressCmd: '%s'\n", cmd));
-
   endwin ();
   fflush (stdout);
 
index cf33c7c..2b40a60 100644 (file)
@@ -468,12 +468,6 @@ AC_ARG_WITH(idn, AC_HELP_STRING([--with-idn=[PFX]], [Use GNU libidn for domain n
 
 dnl -- end socket --
 
-AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging support]),
-    [ if test x$enableval = xyes ; then
-            AC_DEFINE(DEBUG,1,[ Define to enable debugging info. ])
-      fi
-     ])
-
 AC_ARG_ENABLE(flock, AC_HELP_STRING([--enable-flock], [Use flock() to lock files]),
         [if test $enableval = yes; then
                 AC_DEFINE(USE_FLOCK,1, [ Define to use flock() to lock mailboxes. ])
diff --git a/copy.c b/copy.c
index 46dfd64..d658ffc 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -21,7 +21,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/file.h>
 #include <lib-lib/ascii.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -121,13 +120,10 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end,
    */
   if (flags & CH_REORDER) {
     for (t = HeaderOrderList; t; t = t->next) {
-      debug_print (1, ("Reorder list: %s\n", t->data));
       hdr_count++;
     }
   }
 
-  debug_print (1, ("WEED is %s\n", (flags & CH_WEED) ? "Set" : "Not"));
-
   headers = p_new(char *, hdr_count);
 
   /* Read all the headers into the array */
@@ -208,7 +204,6 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end,
       if (flags & CH_REORDER) {
         for (t = HeaderOrderList, x = 0; (t); t = t->next, x++) {
           if (!ascii_strncasecmp (buf, t->data, m_strlen(t->data))) {
-            debug_print (2, ("Reorder: %s matches %s\n", t->data, buf));
             break;
           }
         }
@@ -218,7 +213,6 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end,
     }                           /* If beginning of header */
 
     if (!ignore) {
-      debug_print (2, ("Reorder: x = %d; hdr_count = %d\n", x, hdr_count));
       if (!this_one)
         this_one = m_strdup(buf);
       /* we do want to see all lines if this header doesn't feature
@@ -561,18 +555,6 @@ _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body,
       if (copy_delete_attach (body, fpin, fpout, date))
         return -1;
 
-#ifdef DEBUG
-      {
-        off_t fail = ((ftello (fpout) - new_offset) - new_length);
-
-        if (fail) {
-          mutt_error ("The length calculation was wrong by %ld bytes", fail);
-          new_length += fail;
-          mutt_sleep (1);
-        }
-      }
-#endif
-
       /* Update original message if we are sync'ing a mailfolder */
       if (flags & M_CM_UPDATE) {
         hdr->attach_del = 0;
@@ -695,7 +677,6 @@ mutt_copy_message (FILE * fpout, CONTEXT * src, HEADER * hdr, int flags,
        _mutt_copy_message (fpout, msg->fp, hdr, hdr->content, flags,
                            chflags)) == 0 && (ferror (fpout)
                                               || feof (fpout))) {
-    debug_print (1, ("_mutt_copy_message failed to detect EOF!\n"));
     r = -1;
   }
   mx_close_message (&msg);
diff --git a/from.c b/from.c
index a53944a..7122052 100644 (file)
--- a/from.c
+++ b/from.c
@@ -17,7 +17,6 @@
 #include <lib-lib/mem.h>
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 
@@ -72,8 +71,6 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
   if (!*s)
     return 0;
 
-  debug_print (3, ("parsing: %s\n", s));
-
   if (!is_day_name (s)) {
     const char *p;
     ssize_t len;
@@ -98,7 +95,6 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
         len = pathlen - 1;
       memcpy (path, s, len);
       path[len] = 0;
-      debug_print (3, ("got return path: %s\n", path));
     }
 
     s = vskipspaces(p + 1);
@@ -106,7 +102,6 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
       return 0;
 
     if (!is_day_name (s)) {
-      debug_print (1, ("expected weekday, got: %s\n", s));
       return 0;
     }
   }
@@ -174,10 +169,6 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
     return 0;
   tm.tm_year = yr > 1900 ? yr - 1900 : (yr < 70 ? yr + 100 : yr);
 
-  debug_print (3, ("month=%d, day=%d, hr=%d, min=%d, sec=%d, yr=%d.\n",
-           tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
-           tm.tm_year));
-
   tm.tm_isdst = -1;
 
   if (tp)
index ab47a38..4129fda 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -23,7 +23,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -226,7 +225,6 @@ void mutt_decode_base64 (STATE * s, long len, int istext, iconv_t cd)
         buf[i++] = ch;
     }
     if (i != 4) {
-      debug_print (2, ("didn't get a multiple of 4 chars.\n"));
       break;
     }
 
index 5dc14e5..532a2b8 100644 (file)
--- a/hcache.c
+++ b/hcache.c
@@ -42,7 +42,6 @@
 
 #include <lib-lib/mem.h>
 #include <lib-hash/hash.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
index e05a7ea..d94019d 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -18,7 +18,6 @@
 #include <lib-lib/macros.h>
 #include <lib-lib/ascii.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 #include "alias.h"
@@ -70,7 +69,6 @@ void mutt_edit_headers (const char *editor,
   mutt_edit_file (editor, path);
   stat (path, &st);
   if (mtime == st.st_mtime) {
-    debug_print (1, ("temp file was not modified.\n"));
     /* the file has not changed! */
     mutt_unlink (path);
     return;
index 74aee4c..d4b4efd 100644 (file)
@@ -16,7 +16,6 @@
 #endif
 
 #include <lib-lib/mem.h>
-#include <lib-lib/debug.h>
 
 #include <lib-lib/macros.h>
 #include <lib-lib/ascii.h>
@@ -64,7 +63,6 @@ int imap_authenticate (IMAP_DATA * idata)
       if (!method[0])
         continue;
 
-      debug_print (2, ("Trying method %s\n", method));
       authenticator = imap_authenticators;
 
       while (authenticator->authenticate) {
@@ -84,7 +82,6 @@ int imap_authenticate (IMAP_DATA * idata)
   }
   else {
     /* Fall back to default: any authenticator */
-    debug_print (2, ("Using any available method.\n"));
     authenticator = imap_authenticators;
 
     while (authenticator->authenticate) {
index cb3fe72..16ef189 100644 (file)
@@ -18,7 +18,6 @@
 #include "auth.h"
 
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 /* this is basically a stripped-down version of the cram-md5 method. */
 imap_auth_res_t imap_auth_anon (IMAP_DATA * idata, const char *method __attribute__ ((unused)))
@@ -43,7 +42,6 @@ imap_auth_res_t imap_auth_anon (IMAP_DATA * idata, const char *method __attribut
   while (rc == IMAP_CMD_CONTINUE);
 
   if (rc != IMAP_CMD_RESPOND) {
-    debug_print (1, ("Invalid response from server.\n"));
     goto bail;
   }
 
@@ -54,7 +52,6 @@ imap_auth_res_t imap_auth_anon (IMAP_DATA * idata, const char *method __attribut
   while (rc == IMAP_CMD_CONTINUE);
 
   if (rc != IMAP_CMD_OK) {
-    debug_print (1, ("Error receiving server response.\n"));
     goto bail;
   }
 
index d70afb8..7728526 100644 (file)
@@ -21,7 +21,6 @@
 #define MD5_DIGEST_LEN 16
 
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 #include <lib-hash/hash.h>
 
 /* forward declarations */
@@ -60,17 +59,14 @@ imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA * idata, const char *method __attr
   while (rc == IMAP_CMD_CONTINUE);
 
   if (rc != IMAP_CMD_RESPOND) {
-    debug_print (1, ("Invalid response from server: %s\n", ibuf));
     goto bail;
   }
 
   if ((len = mutt_from_base64 (obuf, idata->cmd.buf + 2)) == -1) {
-    debug_print (1, ("Error decoding base64 response.\n"));
     goto bail;
   }
 
   obuf[len] = '\0';
-  debug_print (2, ("CRAM challenge: %s\n", obuf));
 
   /* The client makes note of the data and then responds with a string
    * consisting of the user name, a space, and a 'digest'. The latter is
@@ -94,7 +90,6 @@ imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA * idata, const char *method __attr
             hmac_response[9], hmac_response[10], hmac_response[11],
             hmac_response[12], hmac_response[13], hmac_response[14],
             hmac_response[15]);
-  debug_print (2, ("CRAM response: %s\n", obuf));
 
   /* XXX - ibuf must be long enough to store the base64 encoding of obuf, 
    * plus the additional debris
@@ -110,7 +105,6 @@ imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA * idata, const char *method __attr
   while (rc == IMAP_CMD_CONTINUE);
 
   if (rc != IMAP_CMD_OK) {
-    debug_print (1, ("Error receiving server response.\n"));
     goto bail;
   }
 
index 23e528e..8fe099c 100644 (file)
@@ -18,7 +18,6 @@
 #include "auth.h"
 
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include <netinet/in.h>
 
@@ -64,18 +63,9 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
   maj_stat = gss_import_name (&min_stat, &request_buf, gss_nt_service_name,
                               &target_name);
   if (maj_stat != GSS_S_COMPLETE) {
-    debug_print (2, ("Couldn't get service name for [%s]\n", buf1));
     return IMAP_AUTH_UNAVAIL;
   }
-#ifdef DEBUG
-  else if (DebugLevel >= 2) {
-    maj_stat = gss_display_name (&min_stat, target_name, &request_buf,
-                                 &mech_name);
-    debug_print (2, ("Using service name [%s]\n",
-                (char *) request_buf.value));
-    maj_stat = gss_release_buffer (&min_stat, &request_buf);
-  }
-#endif
+
   /* Acquire initial credentials - without a TGT GSSAPI is UNAVAIL */
   sec_token = GSS_C_NO_BUFFER;
   context = GSS_C_NO_CONTEXT;
@@ -88,7 +78,6 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
                                    &send_token, (unsigned int *) &cflags,
                                    NULL);
   if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED) {
-    debug_print (1, ("Error acquiring credentials - no TGT?\n"));
     gss_release_name (&min_stat, &target_name);
 
     return IMAP_AUTH_UNAVAIL;
@@ -105,13 +94,11 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
   while (rc == IMAP_CMD_CONTINUE);
 
   if (rc != IMAP_CMD_RESPOND) {
-    debug_print (2, ("Invalid response from server: %s\n", buf1));
     gss_release_name (&min_stat, &target_name);
     goto bail;
   }
 
   /* now start the security context initialisation loop... */
-  debug_print (2, ("Sending credentials\n"));
   mutt_to_base64 ((unsigned char *) buf1, send_token.value, send_token.length,
                   sizeof (buf1) - 2);
   gss_release_buffer (&min_stat, &send_token);
@@ -125,7 +112,6 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
     while (rc == IMAP_CMD_CONTINUE);
 
     if (rc != IMAP_CMD_RESPOND) {
-      debug_print (1, ("Error receiving server response.\n"));
       gss_release_name (&min_stat, &target_name);
       goto bail;
     }
@@ -142,7 +128,6 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
                                      NULL, &send_token,
                                      (unsigned int *) &cflags, NULL);
     if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED) {
-      debug_print (1, ("Error exchanging credentials\n"));
       gss_release_name (&min_stat, &target_name);
 
       goto err_abort_cmd;
@@ -162,7 +147,6 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
   while (rc == IMAP_CMD_CONTINUE);
 
   if (rc != IMAP_CMD_RESPOND) {
-    debug_print (1, ("Error receiving server response.\n"));
     goto bail;
   }
   request_buf.length = mutt_from_base64 (buf2, idata->cmd.buf + 2);
@@ -171,16 +155,13 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
   maj_stat = gss_unwrap (&min_stat, context, &request_buf, &send_token,
                          &cflags, &quality);
   if (maj_stat != GSS_S_COMPLETE) {
-    debug_print (2, ("Couldn't unwrap security level data\n"));
     gss_release_buffer (&min_stat, &send_token);
     goto err_abort_cmd;
   }
-  debug_print (2, ("Credential exchange complete\n"));
 
   /* first octet is security levels supported. We want NONE */
   server_conf_flags = ((char *) send_token.value)[0];
   if (!(((char *) send_token.value)[0] & GSS_AUTH_P_NONE)) {
-    debug_print (2, ("Server requires integrity or privacy\n"));
     gss_release_buffer (&min_stat, &send_token);
     goto err_abort_cmd;
   }
@@ -189,11 +170,6 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
   ((char *) send_token.value)[0] = 0;
   buf_size = ntohl (*((long *) send_token.value));
   gss_release_buffer (&min_stat, &send_token);
-  debug_print (2, ("Unwrapped security level flags: %c%c%c\n",
-              server_conf_flags & GSS_AUTH_P_NONE ? 'N' : '-',
-              server_conf_flags & GSS_AUTH_P_INTEGRITY ? 'I' : '-',
-              server_conf_flags & GSS_AUTH_P_PRIVACY ? 'P' : '-'));
-  debug_print (2, ("Maximum GSS token size is %ld\n", buf_size));
 
   /* agree to terms (hack!) */
   buf_size = htonl (buf_size);  /* not relevant without integrity/privacy */
@@ -206,13 +182,11 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
   maj_stat = gss_wrap (&min_stat, context, 0, GSS_C_QOP_DEFAULT, &request_buf,
                        &cflags, &send_token);
   if (maj_stat != GSS_S_COMPLETE) {
-    debug_print (2, ("Error creating login request\n"));
     goto err_abort_cmd;
   }
 
   mutt_to_base64 ((unsigned char *) buf1, send_token.value, send_token.length,
                   sizeof (buf1) - 2);
-  debug_print (2, ("Requesting authorisation as %s\n", idata->conn->account.user));
   m_strcat(buf1, sizeof(buf1), "\r\n");
   mutt_socket_write (idata->conn, buf1);
 
@@ -221,15 +195,11 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method __attribute
     rc = imap_cmd_step (idata);
   while (rc == IMAP_CMD_CONTINUE);
   if (rc == IMAP_CMD_RESPOND) {
-    debug_print (1, ("Unexpected server continuation request.\n"));
     goto err_abort_cmd;
   }
   if (imap_code (idata->cmd.buf)) {
     /* flush the security context */
-    debug_print (2, ("Releasing GSS credentials\n"));
     maj_stat = gss_delete_sec_context (&min_stat, &context, &send_token);
-    if (maj_stat != GSS_S_COMPLETE)
-      debug_print (1, ("Error releasing credentials\n"));
 
     /* send_token may contain a notification to the server to flush
      * credentials. RFC 1731 doesn't specify what to do, and since this
index 48a607a..f3eaae0 100644 (file)
@@ -14,7 +14,6 @@
 #endif
 
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 #include "imap_private.h"
index b8b1e3c..8544352 100644 (file)
@@ -22,7 +22,6 @@
 #include "auth.h"
 
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include <sasl/sasl.h>
 #include <sasl/saslutil.h>
@@ -41,7 +40,6 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
   unsigned char client_start;
 
   if (mutt_sasl_client_new (idata->conn, &saslconn) < 0) {
-    debug_print (1, ("Error allocating SASL connection.\n"));
     return IMAP_AUTH_FAILURE;
   }
 
@@ -78,12 +76,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
   client_start = (olen > 0);
 
   if (rc != SASL_OK && rc != SASL_CONTINUE) {
-    if (method)
-      debug_print (2, ("%s unavailable\n", method));
-    else
-      debug_print (1, ("Failure starting authentication exchange. No shared mechanisms?\n"));
     /* SASL doesn't support LOGIN, so fall back */
-
     return IMAP_AUTH_UNAVAIL;
   }
 
@@ -100,7 +93,6 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
     while (irc == IMAP_CMD_CONTINUE);
 
     if (method && irc == IMAP_CMD_NO) {
-      debug_print (2, ("%s failed\n", method));
       sasl_dispose (&saslconn);
       return IMAP_AUTH_UNAVAIL;
     }
@@ -109,11 +101,8 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
       goto bail;
 
     if (irc == IMAP_CMD_RESPOND) {
-      if (sasl_decode64
-          (idata->cmd.buf + 2, m_strlen(idata->cmd.buf + 2), buf,
-           LONG_STRING - 1,
-                         &len) != SASL_OK) {
-        debug_print (1, ("error base64-decoding server response.\n"));
+      if (sasl_decode64(idata->cmd.buf + 2, m_strlen(idata->cmd.buf + 2), buf,
+                        LONG_STRING - 1, &len) != SASL_OK) {
         goto bail;
       }
     }
@@ -135,7 +124,6 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
     /* send out response, or line break if none needed */
     if (olen) {
       if (sasl_encode64 (pc, olen, buf, sizeof (buf), &olen) != SASL_OK) {
-        debug_print (1, ("error base64-encoding client response.\n"));
         goto bail;
       }
     }
@@ -148,7 +136,6 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
     /* If SASL has errored out, send an abort string to the server */
     if (rc < 0) {
       mutt_socket_write (idata->conn, "*\r\n");
-      debug_print (1, ("sasl_client_step error %d\n", rc));
     }
 
     olen = 0;
index 2cc16f8..7cff939 100644 (file)
@@ -21,7 +21,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/ascii.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include <lib-ui/enter.h>
 
@@ -105,8 +104,6 @@ int imap_browse (char *path, struct browser_state *state)
     m_strcpy(mbox, sizeof(mbox), buf);
     n = m_strlen(mbox);
 
-    debug_print (3, ("mbox: %s\n", mbox));
-
     /* if our target exists and has inferiors, enter it if we
      * aren't already going to */
     if (mbox[n - 1] != idata->delim) {
@@ -154,7 +151,6 @@ int imap_browse (char *path, struct browser_state *state)
       mbox[n] = '\0';
 
       if (showparents) {
-        debug_print (3, ("adding parent %s\n", mbox));
         imap_add_folder (idata->delim, mbox, 1, 0, state, 1);
       }
 
@@ -194,17 +190,14 @@ int imap_browse (char *path, struct browser_state *state)
     /* Listing the home namespace, so INBOX should be included. Home 
      * namespace is not "", so we have to list it explicitly. We ask the 
      * server to see if it has descendants. */
-    debug_print (3, ("adding INBOX\n"));
     if (browse_add_list_result (idata, "string_list_t \"\" \"INBOX\"", state, 0))
       goto fail;
   }
 
   nsup = state->entrylen;
 
-  debug_print (3, ("Quoting mailbox scan: %s:\n", mbox));
   snprintf (buf, sizeof (buf), "%s%%", mbox);
   imap_quote_string (buf2, sizeof (buf2), buf);
-  debug_print (3, ("%s\n", buf2));
   snprintf (buf, sizeof (buf), "%s \"\" %s", list_cmd, buf2);
   if (browse_add_list_result (idata, buf, state, 0))
     goto fail;
@@ -225,7 +218,6 @@ int imap_browse (char *path, struct browser_state *state)
       if (nsi[i].listable && !nsi[i].home_namespace) {
         imap_add_folder (nsi[i].delim, nsi[i].prefix, nsi[i].noselect,
                          nsi[i].noinferiors, state, 0);
-        debug_print (3, ("adding namespace: %s\n", nsi[i].prefix));
       }
   }
 
@@ -251,12 +243,10 @@ int imap_mailbox_create (const char *folder)
   short n;
 
   if (imap_parse_path (folder, &mx) < 0) {
-    debug_print (1, ("Bad starting path %s\n", folder));
     return -1;
   }
 
   if (!(idata = imap_conn_find (&mx.account, M_IMAP_CONN_NONEW))) {
-    debug_print (1, ("Couldn't find open connection to %s\n", mx.account.host));
     goto fail;
   }
 
@@ -301,12 +291,10 @@ int imap_mailbox_rename (const char *mailbox)
   char newname[SHORT_STRING];
 
   if (imap_parse_path (mailbox, &mx) < 0) {
-    debug_print (1, ("Bad source mailbox %s\n", mailbox));
     return -1;
   }
 
   if (!(idata = imap_conn_find (&mx.account, M_IMAP_CONN_NONEW))) {
-    debug_print (1, ("Couldn't find open connection to %s\n", mx.account.host));
     goto fail;
   }
 
@@ -348,7 +336,6 @@ static int browse_add_list_result (IMAP_DATA * idata, const char *cmd,
   IMAP_MBOX mx;
 
   if (imap_parse_path (state->folder, &mx)) {
-    debug_print (2, ("current folder %s makes no sense\n", state->folder));
     return -1;
   }
 
@@ -507,7 +494,6 @@ static int browse_get_namespace (IMAP_DATA * idata, char *nsbuf, int nsblen,
             }
             /* skip "" namespaces, they are already listed at the root */
             if ((ns[0] != '\0') && (nsbused < nsblen) && (*nns < nsilen)) {
-              debug_print (3, ("adding %s\n", ns));
               nsi->type = type;
               /* Cyrus doesn't append the delimiter to the namespace,
                * but UW-IMAP does. We'll strip it here and add it back
index 3893f89..5caaee9 100644 (file)
@@ -19,8 +19,6 @@
 #include <lib-lib/mem.h>
 #include <lib-lib/ascii.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
-
 
 #include "mutt.h"
 #include "message.h"
@@ -106,7 +104,6 @@ int imap_cmd_step (IMAP_DATA * idata)
     if (len == cmd->blen) {
       p_realloc(&cmd->buf, cmd->blen + IMAP_CMD_BUFSIZE);
       cmd->blen = cmd->blen + IMAP_CMD_BUFSIZE;
-      debug_print (3, ("grew buffer to %u bytes\n", cmd->blen));
     }
 
     if (len)
@@ -114,7 +111,6 @@ int imap_cmd_step (IMAP_DATA * idata)
 
     c = mutt_socket_readln (cmd->buf + len, cmd->blen - len, idata->conn);
     if (c <= 0) {
-      debug_print (1, ("Error reading server response.\n"));
       /* cmd_handle_fatal (idata); */
       return IMAP_CMD_BAD;
     }
@@ -130,7 +126,6 @@ int imap_cmd_step (IMAP_DATA * idata)
   if ((cmd->blen > IMAP_CMD_BUFSIZE) && (len <= IMAP_CMD_BUFSIZE)) {
     p_realloc(&cmd->buf, IMAP_CMD_BUFSIZE);
     cmd->blen = IMAP_CMD_BUFSIZE;
-    debug_print (3, ("shrank buffer to %u bytes\n", cmd->blen));
   }
 
   idata->lastread = time (NULL);
@@ -216,11 +211,7 @@ int imap_exec (IMAP_DATA * idata, const char *cmd, int flags)
     return -2;
 
   if (rc != IMAP_CMD_OK) {
-    if (flags & IMAP_CMD_FAIL_OK)
-      return -2;
-
-    debug_print (1, ("command failed: %s\n", idata->cmd.buf));
-    return -1;
+    return (flags & IMAP_CMD_FAIL_OK) ? -2 : -1;
   }
 
   return 0;
@@ -257,14 +248,12 @@ void imap_cmd_finish (IMAP_DATA * idata)
         (idata->reopen & IMAP_NEWMAIL_PENDING)
         && count > idata->ctx->msgcount) {
       /* read new mail messages */
-      debug_print (2, ("Fetching new mail\n"));
       /* check_status: curs_main uses imap_check_mailbox to detect
        *   whether the index needs updating */
       idata->check_status = IMAP_NEWMAIL_PENDING;
       imap_read_headers (idata, idata->ctx->msgcount, count - 1);
     }
     else if (idata->reopen & IMAP_EXPUNGE_PENDING) {
-      debug_print (2, ("Expunging mailbox\n"));
       imap_expunge_mailbox (idata);
       /* Detect whether we've gotten unexpected EXPUNGE messages */
       if (idata->reopen & IMAP_EXPUNGE_PENDING &&
@@ -317,8 +306,6 @@ static int cmd_handle_untagged (IMAP_DATA * idata)
      * connection, so update that one.
      */
     if (ascii_strncasecmp ("EXISTS", s, 6) == 0) {
-      debug_print (2, ("Handling EXISTS\n"));
-
       /* new mail arrived */
       count = atoi (pn);
 
@@ -335,10 +322,9 @@ static int cmd_handle_untagged (IMAP_DATA * idata)
       /* at least the InterChange server sends EXISTS messages freely,
        * even when there is no new mail */
       else if (count == idata->ctx->msgcount)
-        debug_print (3, ("superfluous EXISTS message.\n"));
+        ;
       else {
         if (!(idata->reopen & IMAP_EXPUNGE_PENDING)) {
-          debug_print (2, ("New mail in %s - %d messages total.\n", idata->mailbox, count));
           idata->reopen |= IMAP_NEWMAIL_PENDING;
         }
         idata->newMailCount = count;
@@ -359,8 +345,6 @@ static int cmd_handle_untagged (IMAP_DATA * idata)
   else if (ascii_strncasecmp ("SEARCH", s, 6) == 0)
     cmd_parse_search (idata, s);
   else if (ascii_strncasecmp ("BYE", s, 3) == 0) {
-    debug_print (2, ("Handling BYE\n"));
-
     /* check if we're logging out */
     if (idata->status == IMAP_BYE)
       return 0;
@@ -374,8 +358,6 @@ static int cmd_handle_untagged (IMAP_DATA * idata)
   }
   else if (option (OPTIMAPSERVERNOISE)
            && (ascii_strncasecmp ("NO", s, 2) == 0)) {
-    debug_print (2, ("Handling untagged NO\n"));
-
     /* Display the warning message from the server */
     mutt_error ("%s", s + 3);
     mutt_sleep (2);
@@ -402,12 +384,10 @@ static void cmd_parse_search (IMAP_DATA* idata, char* s) {
   unsigned int uid;
   int msgno;
 
-  debug_print (2, ("Handling SEARCH\n"));
-
   while ((s = imap_next_word (s)) && *s != '\0') {
     uid = atoi (s);
     msgno = uid2msgno (idata, uid);
-    
+
     if (msgno >= 0)
       idata->ctx->hdrs[uid2msgno (idata, uid)]->matched = 1;
   }
@@ -428,8 +408,6 @@ static void cmd_parse_capabilities (IMAP_DATA * idata, char *s)
 {
   int x;
 
-  debug_print (2, ("Handling CAPABILITY\n"));
-
   s = imap_next_word (s);
   p_delete(&idata->capstr);
   idata->capstr = m_strdup(s);
@@ -453,8 +431,6 @@ static void cmd_parse_expunge (IMAP_DATA * idata, const char *s)
   int expno, cur;
   HEADER *h;
 
-  debug_print (2, ("Handling EXPUNGE\n"));
-
   expno = atoi (s);
 
   /* walk headers, zero seqno of expunged message, decrement seqno of those
@@ -482,8 +458,6 @@ static void cmd_parse_fetch (IMAP_DATA * idata, char *s)
   int msgno, cur;
   HEADER *h = NULL;
 
-  debug_print (2, ("Handling FETCH\n"));
-
   msgno = atoi (s);
 
   if (msgno <= idata->ctx->msgcount)
@@ -495,7 +469,6 @@ static void cmd_parse_fetch (IMAP_DATA * idata, char *s)
         break;
 
       if (h->active && h->index + 1 == msgno) {
-        debug_print (2, ("Message UID %d updated\n", HEADER_DATA (h)->uid));
         break;
       }
 
@@ -503,7 +476,6 @@ static void cmd_parse_fetch (IMAP_DATA * idata, char *s)
     }
 
   if (!h) {
-    debug_print (1, ("FETCH response ignored for this message\n"));
     return;
   }
 
@@ -512,13 +484,11 @@ static void cmd_parse_fetch (IMAP_DATA * idata, char *s)
   s = imap_next_word (s);
 
   if (*s != '(') {
-    debug_print (1, ("Malformed FETCH response\n"));
     return;
   }
   s++;
 
   if (ascii_strncasecmp ("FLAGS", s, 5) != 0) {
-    debug_print (2, ("Only handle FLAGS updates\n"));
     return;
   }
 
@@ -544,7 +514,6 @@ static void cmd_parse_lsub (IMAP_DATA* idata, char* s) {
   s = imap_next_word (s); /* flags */
 
   if (*s != '(') {
-    debug_print (1, ("Bad LSUB response\n"));
     return;
   }
 
@@ -565,7 +534,6 @@ static void cmd_parse_lsub (IMAP_DATA* idata, char* s) {
 
   if (s) {
     imap_unmunge_mbox_name (s);
-    debug_print (2, ("Subscribing to %s\n", s));
 
     m_strcpy(buf, sizeof(buf), "mailboxes \"");
     mutt_account_tourl (&idata->conn->account, &url);
@@ -577,19 +545,14 @@ static void cmd_parse_lsub (IMAP_DATA* idata, char* s) {
     p_clear(&token, 1);
     err.data = errstr;
     err.dsize = sizeof (errstr);
-    if (mutt_parse_rc_line (buf, &token, &err))
-      debug_print (1, ("Error adding subscribed mailbox: %s\n", errstr));
+    mutt_parse_rc_line (buf, &token, &err);
     p_delete(&token.data);
   }
-  else
-    debug_print (1, ("Bad LSUB response\n"));
 }
 
 /* cmd_parse_myrights: set rights bits according to MYRIGHTS response */
 static void cmd_parse_myrights (IMAP_DATA * idata, char *s)
 {
-  debug_print (2, ("Handling MYRIGHTS\n"));
-
   s = imap_next_word (s);
   s = imap_next_word (s);
 
index f7b30f4..9f356ba 100644 (file)
@@ -19,7 +19,6 @@
 #include <lib-lib/ascii.h>
 #include <lib-lib/str.h>
 #include <lib-lib/buffer.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 #include "mx.h"
@@ -87,12 +86,10 @@ int imap_access (const char *path, int flags __attribute__ ((unused)))
   else if (mutt_bit_isset (idata->capabilities, STATUS))
     snprintf (buf, sizeof (buf), "STATUS %s (UID-VALIDITY)", mbox);
   else {
-    debug_print (2, ("STATUS not supported?\n"));
     return -1;
   }
 
   if (imap_exec (idata, buf, IMAP_CMD_FAIL_OK) < 0) {
-    debug_print (1, ("Can't check STATUS of %s\n", mbox));
     return -1;
   }
 
@@ -190,11 +187,8 @@ int imap_read_literal (FILE * fp, IMAP_DATA * idata, long bytes, progress_t* bar
 
   int r = 0;
 
-  debug_print (2, ("reading %ld bytes\n", bytes));
-
   for (pos = 0; pos < bytes; pos++) {
     if (mutt_socket_readchar (idata->conn, &c) != 1) {
-      debug_print (1, ("error during read, %ld bytes read\n", pos));
       idata->status = IMAP_FATAL;
 
       return -1;
@@ -214,10 +208,6 @@ int imap_read_literal (FILE * fp, IMAP_DATA * idata, long bytes, progress_t* bar
     fputc (c, fp);
     if (bar && !(pos % 1024))
       mutt_progress_bar (bar, pos);
-#ifdef DEBUG
-    if (DebugFile && DebugLevel >= IMAP_LOG_LTRL)
-      fputc (c, DebugFile);
-#endif
   }
 
   return 0;
@@ -235,8 +225,6 @@ void imap_expunge_mailbox (IMAP_DATA * idata)
     h = idata->ctx->hdrs[i];
 
     if (h->index == -1) {
-      debug_print (2, ("Expunging message UID %d.\n", HEADER_DATA (h)->uid));
-
       h->active = 0;
 
       /* free cached body from disk, if neccessary */
@@ -285,13 +273,6 @@ static int imap_get_delim (IMAP_DATA * idata)
   }
   while (rc == IMAP_CMD_CONTINUE);
 
-  if (rc != IMAP_CMD_OK) {
-    debug_print (1, ("failed.\n"));
-    return -1;
-  }
-
-  debug_print (2, ("Delimiter: %c\n", idata->delim));
-
   return -1;
 }
 
@@ -382,8 +363,6 @@ IMAP_DATA *imap_conn_find (const ACCOUNT * account, int flags)
   if (idata->state == IMAP_CONNECTED) {
     if (!imap_authenticate (idata)) {
       idata->state = IMAP_AUTHENTICATED;
-      if (idata->conn->ssf)
-        debug_print (2, ("Communication encrypted at %d bits\n", idata->conn->ssf));
     }
     else
       mutt_account_unsetpass (&idata->conn->account);
@@ -490,12 +469,10 @@ static char *imap_get_flags (string_list_t ** hflags, char *s)
 
   /* sanity-check string */
   if (ascii_strncasecmp ("FLAGS", s, 5) != 0) {
-    debug_print (1, ("not a FLAGS response: %s\n", s));
     return NULL;
   }
   s = vskipspaces(s + 5);
   if (*s != '(') {
-    debug_print (1, ("bogus FLAGS response: %s\n", s));
     return NULL;
   }
 
@@ -517,7 +494,6 @@ static char *imap_get_flags (string_list_t ** hflags, char *s)
 
   /* note bad flags response */
   if (*s != ')') {
-    debug_print (1, ("Unterminated FLAGS response: %s\n", s));
     string_list_wipe(hflags);
 
     return NULL;
@@ -592,14 +568,12 @@ int imap_open_mailbox (CONTEXT * ctx)
     if (ascii_strncasecmp ("FLAGS", pc, 5) == 0) {
       /* don't override PERMANENTFLAGS */
       if (!idata->flags) {
-        debug_print (2, ("Getting mailbox FLAGS\n"));
         if ((pc = imap_get_flags (&(idata->flags), pc)) == NULL)
           goto fail;
       }
     }
     /* PERMANENTFLAGS are massaged to look like FLAGS, then override FLAGS */
     else if (ascii_strncasecmp ("OK [PERMANENTFLAGS", pc, 18) == 0) {
-      debug_print (2, ("Getting mailbox PERMANENTFLAGS\n"));
       /* safe to call on NULL */
       string_list_wipe(&(idata->flags));
       /* skip "OK [PERMANENT" so syntax is the same as FLAGS */
@@ -610,7 +584,6 @@ int imap_open_mailbox (CONTEXT * ctx)
 #ifdef USE_HCACHE
     /* save UIDVALIDITY for the header cache */
     else if (ascii_strncasecmp ("OK [UIDVALIDITY", pc, 14) == 0) {
-      debug_print (2, ("Getting mailbox UIDVALIDITY\n"));
       pc += 3;
       pc = imap_next_word (pc);
 
@@ -644,29 +617,9 @@ int imap_open_mailbox (CONTEXT * ctx)
   if (!ascii_strncasecmp
       (imap_get_qualifier (idata->cmd.buf), "[READ-ONLY]", 11)
       && !mutt_bit_isset (idata->capabilities, ACL)) {
-    debug_print (2, ("Mailbox is read-only.\n"));
     ctx->readonly = 1;
   }
 
-#ifdef DEBUG
-  /* dump the mailbox flags we've found */
-  if (DebugLevel > 2) {
-    if (!idata->flags)
-      debug_print (3, ("No folder flags found\n"));
-    else {
-      string_list_t *t = idata->flags;
-
-      debug_print (3, ("Mailbox flags:\n"));
-
-      t = t->next;
-      while (t) {
-        debug_print (3, ("[%s]\n", t->data));
-        t = t->next;
-      }
-    }
-  }
-#endif
-
   if (mutt_bit_isset (idata->capabilities, ACL)) {
     if (imap_check_acl (idata))
       goto fail;
@@ -699,7 +652,6 @@ int imap_open_mailbox (CONTEXT * ctx)
     goto fail;
   }
 
-  debug_print (2, ("msgcount is %d\n", ctx->msgcount));
   p_delete(&mx.mbox);
   return 0;
 
@@ -767,7 +719,6 @@ void imap_logout (IMAP_DATA * idata)
 /*
 int imap_close_connection (CONTEXT *ctx)
 {
-  debug_print (1, (debugfile, "imap_close_connection(): closing connection\n"));
   if (CTX_DATA->status != IMAP_BYE)
   {
     mutt_message _("Closing connection to IMAP server...");
@@ -963,7 +914,6 @@ int imap_sync_mailbox (CONTEXT * ctx, int expunge, int *index_hint)
   idata = (IMAP_DATA *) ctx->data;
 
   if (idata->state != IMAP_SELECTED) {
-    debug_print (2, ("no mailbox selected\n"));
     return -1;
   }
 
@@ -1011,14 +961,11 @@ int imap_sync_mailbox (CONTEXT * ctx, int expunge, int *index_hint)
        * This works better if we're expunging, of course. */
       if ((ctx->hdrs[n]->env && (ctx->hdrs[n]->env->refs_changed || ctx->hdrs[n]->env->irt_changed)) ||
           ctx->hdrs[n]->attach_del) {
-        debug_print (3, ("Attachments to be deleted, falling back to _mutt_save_message\n"));
         if (!appendctx)
           appendctx = mx_open_mailbox (ctx->path, M_APPEND | M_QUIET, NULL);
-        if (!appendctx) {
-          debug_print (1, ("Error opening mailbox in append mode\n"));
-        }
-        else
+        if (appendctx) {
           _mutt_save_message (ctx->hdrs[n], appendctx, 1, 0, 0);
+        }
       }
 
       if (imap_sync_message (idata, ctx->hdrs[n], &cmd, &err_continue) < 0) {
@@ -1214,12 +1161,9 @@ int imap_mailbox_check (char *path, int new)
         if (isdigit ((unsigned char) *s)) {
           if (*s != '0') {
             msgcount = atoi (s);
-            debug_print (2, ("%d new messages in %s\n", msgcount, path));
           }
         }
       }
-      else
-        debug_print (1, ("STATUS response doesn't match requested mailbox.\n"));
     }
   }
   while (rc == IMAP_CMD_CONTINUE);
@@ -1460,8 +1404,7 @@ int imap_subscribe (char *path, int subscribe)
     err.dsize = sizeof (errstr);
     snprintf (mbox, sizeof (mbox), "%smailboxes \"%s\"",
               subscribe ? "" : "un", path);
-    if (mutt_parse_rc_line (mbox, &token, &err))
-      debug_print (1, ("Error adding subscribed mailbox: %s\n", errstr));
+    mutt_parse_rc_line (mbox, &token, &err);
     p_delete(&token.data);
   }
 
index e9b98d5..8de66df 100644 (file)
@@ -21,7 +21,6 @@
 #include <lib-lib/ascii.h>
 #include <lib-lib/str.h>
 #include <lib-lib/buffer.h>
-#include <lib-lib/debug.h>
 
 #include <lib-ui/curses.h>
 
@@ -158,8 +157,6 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend)
         if (uid_validity != NULL && *uid_validity == idata->uid_validity) {
           ctx->hdrs[msgno] = mutt_hcache_restore((unsigned char *) uid_validity, 0);
           ctx->hdrs[msgno]->index = h.sid - 1;
-          if (h.sid != ctx->msgcount + 1)
-            debug_print (1, ("imap_read_headers: msgcount and sequence ID are inconsistent!"));
           /* messages which have not been expunged are ACTIVE (borrowed from mh 
           * folders) */
           ctx->hdrs[msgno]->active = 1;
@@ -251,8 +248,6 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend)
       ctx->hdrs[msgno] = header_new();
 
       ctx->hdrs[msgno]->index = h.sid - 1;
-      if (h.sid != ctx->msgcount + 1)
-        debug_print (1, ("msgcount and sequence ID are inconsistent!\n"));
       /* messages which have not been expunged are ACTIVE (borrowed from mh 
        * folders) */
       ctx->hdrs[msgno]->active = 1;
@@ -551,8 +546,6 @@ int imap_append_message (CONTEXT * ctx, MESSAGE * msg)
   if (rc != IMAP_CMD_RESPOND) {
     char *pc;
 
-    debug_print (1, ("command failed: %s\n", idata->cmd.buf));
-
     pc = vskipspaces(idata->cmd.buf + SEQLEN);
     pc = imap_next_word (pc);
     mutt_error ("%s", pc);
@@ -587,7 +580,6 @@ int imap_append_message (CONTEXT * ctx, MESSAGE * msg)
   if (!imap_code (idata->cmd.buf)) {
     char *pc;
 
-    debug_print (1, ("command failed: %s\n", idata->cmd.buf));
     pc = vskipspaces(idata->cmd.buf + SEQLEN);
     pc = imap_next_word (pc);
     mutt_error ("%s", pc);
@@ -624,18 +616,15 @@ int imap_copy_messages (CONTEXT * ctx, HEADER * h, char *dest, int delete)
   idata = (IMAP_DATA *) ctx->data;
 
   if (imap_parse_path (dest, &mx)) {
-    debug_print (1, ("bad destination %s\n", dest));
     return -1;
   }
 
   /* check that the save-to folder is in the same account */
   if (!mutt_account_match (&(CTX_DATA->conn->account), &(mx.account))) {
-    debug_print (3, ("%s not same server as %s\n", dest, ctx->path));
     return 1;
   }
 
   if (h && h->attach_del) {
-    debug_print (3, ("Message contains attachments to be deleted\n"));
     return 1;
   }
 
@@ -652,7 +641,6 @@ int imap_copy_messages (CONTEXT * ctx, HEADER * h, char *dest, int delete)
      * remainder. */
     for (n = 0; n < ctx->msgcount; n++) {
       if (ctx->hdrs[n]->tagged && ctx->hdrs[n]->attach_del) {
-        debug_print (3, ("Message contains attachments to be deleted\n"));
         return 1;
       }
 
@@ -662,7 +650,6 @@ int imap_copy_messages (CONTEXT * ctx, HEADER * h, char *dest, int delete)
        rc = imap_sync_message (idata, ctx->hdrs[n], &sync_cmd, &err_continue);
        if (rc < 0)
        {
-         debug_print (1, ("could not sync\n"));
          goto fail;
        }
       }
@@ -670,7 +657,6 @@ int imap_copy_messages (CONTEXT * ctx, HEADER * h, char *dest, int delete)
 
     rc = imap_make_msg_set (idata, &cmd, M_TAG, 0);
     if (!rc) {
-      debug_print (1, ("No messages tagged\n"));
       goto fail;
     }
     mutt_message (_("Copying %d messages to %s..."), rc, mbox);
@@ -685,7 +671,6 @@ int imap_copy_messages (CONTEXT * ctx, HEADER * h, char *dest, int delete)
       rc = imap_sync_message (idata, h, &sync_cmd, &err_continue);
       if (rc < 0)
       {
-       debug_print (1, ("could not sync\n"));
        goto fail;
       }
     }
@@ -704,7 +689,6 @@ int imap_copy_messages (CONTEXT * ctx, HEADER * h, char *dest, int delete)
       imap_error ("imap_copy_messages", idata->cmd.buf);
       goto fail;
     }
-    debug_print (2, ("server suggests TRYCREATE\n"));
     snprintf (mmbox, sizeof (mmbox), _("Create %s?"), mbox);
     if (option (OPTCONFIRMCREATE) && mutt_yesorno (mmbox, 1) < 1) {
       mutt_clear_error ();
@@ -797,7 +781,6 @@ char *imap_set_flags (IMAP_DATA * idata, HEADER * h, char *s)
   p_clear(&newh, 1);
   newh.data = p_new(IMAP_HEADER_DATA, 1);
 
-  debug_print (2, ("parsing FLAGS\n"));
   if ((s = msg_parse_flags (&newh, s)) == NULL) {
     p_delete(&newh.data);
     return NULL;
@@ -984,7 +967,6 @@ static int msg_parse_fetch (IMAP_HEADER * h, char *s)
     else if (ascii_strncasecmp ("INTERNALDATE", s, 12) == 0) {
       s = vskipspaces(s + 12);
       if (*s != '\"') {
-        debug_print (1, ("bogus INTERNALDATE entry: %s\n", s));
         return -1;
       }
       s++;
@@ -1029,12 +1011,10 @@ static char *msg_parse_flags (IMAP_HEADER * h, char *s)
 
   /* sanity-check string */
   if (ascii_strncasecmp ("FLAGS", s, 5) != 0) {
-    debug_print (1, ("not a FLAGS response: %s\n", s));
     return NULL;
   }
   s = vskipspaces(s + 5);
   if (*s != '(') {
-    debug_print (1, ("bogus FLAGS response: %s\n", s));
     return NULL;
   }
   s++;
@@ -1087,7 +1067,6 @@ static char *msg_parse_flags (IMAP_HEADER * h, char *s)
     s++;
   }
   else {
-    debug_print (1, ("Unterminated FLAGS response: %s\n", s));
     return NULL;
   }
 
index 8ddca9e..caf1616 100644 (file)
@@ -23,7 +23,6 @@
 #include <lib-sys/mutt_ssl.h>
 
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include <stdlib.h>
 #include <ctype.h>
@@ -80,7 +79,6 @@ int imap_parse_path (const char *path, IMAP_MBOX * mx)
       ImapPort = ntohs (service->s_port);
     else
       ImapPort = IMAP_PORT;
-    debug_print (3, ("Using default IMAP port %d\n", ImapPort));
   }
   if (!ImapsPort) {
     service = getservbyname ("imaps", "tcp");
@@ -88,7 +86,6 @@ int imap_parse_path (const char *path, IMAP_MBOX * mx)
       ImapsPort = ntohs (service->s_port);
     else
       ImapsPort = IMAP_SSL_PORT;
-    debug_print (3, ("Using default IMAPS port %d\n", ImapsPort));
   }
 
   /* Defaults */
diff --git a/init.c b/init.c
index e9e1cf6..d452111 100644 (file)
--- a/init.c
+++ b/init.c
@@ -29,7 +29,6 @@
 #include <lib-lib/macros.h>
 #include <lib-lib/buffer.h>
 #include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
 #include <lib-lib/rx.h>
 
 #include <lib-sys/unix.h>
@@ -90,10 +89,6 @@ static int check_history    (const char* option, unsigned long val,
 /* this checks that numbers are >= 0 */
 static int check_num        (const char* option, unsigned long val,
                              char* errbuf, ssize_t errlen);
-#ifdef DEBUG
-static int check_debug      (const char* option, unsigned long val,
-                             char* errbuf, ssize_t errlen);
-#endif
 
 /* use this to check only */
 static int check_special (const char* option, unsigned long val,
@@ -115,9 +110,6 @@ static struct {
 #endif
   { "history",                  check_history },
   { "pager_index_lines",        check_num },
-#ifdef DEBUG
-  { "debug_level",              check_debug },
-#endif
   /* last */
   { NULL,         NULL }
 };
@@ -538,7 +530,6 @@ int mutt_option_value (const char* val, char* dst, ssize_t dstlen) {
   ssize_t l = 0;
 
   if (!(option = hash_find (ConfigOptions, val))) {
-    debug_print (1, ("var '%s' not found\n", val));
     *dst = '\0';
     return (0);
   }
@@ -547,7 +538,6 @@ int mutt_option_value (const char* val, char* dst, ssize_t dstlen) {
 
   /* as we get things of type $var=value and don't want to bloat the
    * above "just" for expansion, we do the stripping here */
-  debug_print (1, ("orig == '%s'\n", tmp));
   t = strchr (tmp, '=');
   t++;
   l = m_strlen(t);
@@ -559,7 +549,6 @@ int mutt_option_value (const char* val, char* dst, ssize_t dstlen) {
   }
   memcpy (dst, t, l+1);
   p_delete(&tmp);
-  debug_print (1, ("stripped == '%s'\n", dst));
 
   return (1);
 }
@@ -1099,11 +1088,8 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, string_list_t **ldata,
 
   /* Find the last item in the list that data points to. */
   lastp = NULL;
-  debug_print (5, ("parse_attach_list: ldata = %p, *ldata = %p\n",
-                   ldata, *ldata));
   for (listp = *ldata; listp; listp = listp->next) {
     a = (ATTACH_MATCH *)listp->data;
-    debug_print (5, ("parse_attach_list: skipping %s/%s\n", a->major, a->minor));
     lastp = listp;
   }
 
@@ -1143,9 +1129,6 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, string_list_t **ldata,
 
     p_delete(&tmpminor);
 
-    debug_print (5, ("parse_attach_list: added %s/%s [%d]\n",
-                     a->major, a->minor, a->major_int));
-
     listp = p_new(string_list_t, 1);
     listp->data = (char *)a;
     listp->next = NULL;
@@ -1193,11 +1176,7 @@ static int parse_unattach_list (BUFFER *buf, BUFFER *s, string_list_t **ldata,
     lastp = NULL;
     for(lp = *ldata; lp; ) {
       a = (ATTACH_MATCH *)lp->data;
-      debug_print(5, ("parse_unattach_list: check %s/%s [%d] : %s/%s [%d]\n",
-                      a->major, a->minor, a->major_int, tmp, minor, major));
       if (a->major_int == major && !m_strcasecmp(minor, a->minor)) {
-        debug_print(5, ("parse_unattach_list: removed %s/%s [%d]\n",
-                        a->major, a->minor, a->major_int));
         regfree(&a->minor_rx);
         p_delete(&a->major);
 
@@ -1435,8 +1414,6 @@ static int parse_alias (BUFFER * buf, BUFFER * s,
 
   mutt_extract_token (buf, s, 0);
 
-  debug_print (2, ("first token is '%s'.\n", buf->data));
-
   /* check to see if an alias with this name already exists */
   for (; tmp; tmp = tmp->next) {
     if (!m_strcasecmp(tmp->name, buf->data))
@@ -1461,7 +1438,6 @@ static int parse_alias (BUFFER * buf, BUFFER * s,
 
   mutt_extract_token (buf, s,
                       M_TOKEN_QUOTE | M_TOKEN_SPACE | M_TOKEN_SEMICOLON);
-  debug_print (2, ("second token is '%s'.\n", buf->data));
   tmp->addr = mutt_parse_adrlist (tmp->addr, buf->data);
   if (last)
     last->next = tmp;
@@ -1472,19 +1448,7 @@ static int parse_alias (BUFFER * buf, BUFFER * s,
               _("Warning: Bad IDN '%s' in alias '%s'.\n"), estr, tmp->name);
     return -1;
   }
-#ifdef DEBUG
-  if (DebugLevel >= 2) {
-    address_t *a;
 
-    /* A group is terminated with an empty address, so check a->mailbox */
-    for (a = tmp->addr; a && a->mailbox; a = a->next) {
-      if (!a->group)
-        debug_print (2, ("%s\n", a->mailbox));
-      else
-        debug_print (2, ("group %s\n", a->mailbox));
-    }
-  }
-#endif
   return 0;
 }
 
@@ -1620,8 +1584,6 @@ static struct option_t* add_option (const char* name, const char* init,
                                     short type, short dodup) {
   struct option_t* option = p_new(struct option_t, 1);
 
-  debug_print (1, ("adding $%s\n", name));
-
   option->option = m_strdup(name);
   option->type = type;
   if (init)
@@ -1638,7 +1600,6 @@ static struct option_t* add_user_option (const char* name) {
 static void del_option (void* p) {
   struct option_t *ptr = (struct option_t*) p;
   char* s = (char*) ptr->data;
-  debug_print (1, ("removing option '%s' from table\n", NONULL (ptr->option)));
   p_delete(&ptr->option);
   p_delete(&s);
   p_delete(&ptr->init);
@@ -1772,19 +1733,6 @@ static int check_num (const char* option, unsigned long p,
   return (1);
 }
 
-#ifdef DEBUG
-static int check_debug (const char* option, unsigned long p,
-                        char* errbuf, ssize_t errlen) {
-  if ((int) p <= DEBUG_MAX_LEVEL &&
-      (int) p >= DEBUG_MIN_LEVEL)
-    return (1);
-
-  if (errbuf)
-    snprintf (errbuf, errlen, _("'%d' is invalid for $%s"), (int) p, option);
-  return (0);
-}
-#endif
-
 static int check_history (const char* option __attribute__ ((unused)), unsigned long p,
                           char* errbuf, ssize_t errlen) {
   if (!check_num ("history", p, errbuf, errlen))
@@ -1884,7 +1832,6 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
       /* there's no option named like this yet so only add one
        * if the action isn't any of: reset, unset, query */
       if (!(reset || unset || query || *s->dptr != '=')) {
-        debug_print (1, ("adding user option '%s'\n", tmp->data));
         option = add_user_option (tmp->data);
         hash_insert (ConfigOptions, option->option, option, 0);
       }
@@ -2092,8 +2039,6 @@ static int source_rc (const char *rcfile, BUFFER * err)
   ssize_t buflen;
   pid_t pid;
 
-  debug_print (2, ("reading configuration file '%s'.\n", rcfile));
-
   if ((f = mutt_open_read (rcfile, &pid)) == NULL) {
     snprintf (err->data, err->dsize, "%s: %s", rcfile, strerror (errno));
     return (-1);
@@ -2191,8 +2136,6 @@ int mutt_parse_rc_line ( /* const */ char *line, BUFFER * token, BUFFER * err)
 
   *err->data = 0;
 
-  debug_print (1, ("expand '%s'\n", line));
-
   expn.dptr = vskipspaces(expn.dptr);
   while (*expn.dptr) {
     if (*expn.dptr == '#')
@@ -2627,8 +2570,6 @@ void mutt_init (int skip_sys_rc, string_list_t * commands)
     Shell = m_strdup((p = getenv ("SHELL")) ? p : "/bin/sh");
   }
 
-  debug_start(Homedir);
-
   /* And about the host... */
   uname (&utsname);
   /* some systems report the FQDN instead of just the hostname */
diff --git a/init.h b/init.h
index 1c93283..3f149ca 100644 (file)
--- a/init.h
+++ b/init.h
@@ -17,8 +17,6 @@
 # include "sort.h"
 #endif
 
-#include <lib-lib/debug.h>
-
 #include "buffy.h"
 #include "mutt.h"
 #include "version.h"
@@ -513,24 +511,6 @@ struct option_t MuttVars[] = {
    ** rest of the string are expanded in the \fIC\fP locale (that is in US
    ** English).
    */
-#ifdef DEBUG
-  {"debug_level", DT_NUM, R_NONE, UL &DebugLevel, "1" },
-  /*
-   ** .pp
-   ** Availability: debug
-   **
-   ** .pp
-   ** This variable specifies the current debug level and
-   ** may be used to increase or decrease the verbosity level
-   ** during runtime. It overrides the level given with the
-   ** \fT-d\fP command line option.
-   **
-   ** .pp
-   ** Currently, this number must be >= 0 and <= 5 and madmutt
-   ** must be started with \fT-d\fP to enable debugging at all;
-   ** enabling at runtime is not possible.
-   */
-#endif
   {"default_hook", DT_STR, R_NONE, UL &DefaultHook, "~f %s !~P | (~P ~C %s)"},
   /*
    ** .pp
index 43907ca..8311f5a 100644 (file)
@@ -46,7 +46,6 @@
 #include <lib-lib/ascii.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -1315,7 +1314,6 @@ static int verify_one (BODY * sigbdy, STATE * s,
   gpgme_release (ctx);
 
   state_attach_puts (_("[-- End signature information --]\n\n"), s);
-  debug_print (1, ("returning %d.\n", badsig));
 
   return badsig ? 1 : anywarn ? 2 : 0;
 }
@@ -1783,8 +1781,6 @@ int pgp_gpgme_application_handler (BODY * m, STATE * s)
 
   char body_charset[STRING];    /* Only used for clearsigned messages. */
 
-  debug_print (2, ("Entering pgp_application_pgp handler\n"));
-
   /* For clearsigned messages we won't be able to get a character set
      but we know that this may only be text thus we assume Latin-1
      here. */
@@ -1988,7 +1984,6 @@ int pgp_gpgme_application_handler (BODY * m, STATE * s)
                          " of PGP message! --]\n\n"), s);
     return (-1);
   }
-  debug_print (2, ("Leaving pgp_application_pgp handler\n"));
   return (err);
 }
 
@@ -2006,7 +2001,6 @@ int pgp_gpgme_encrypted_handler (BODY * a, STATE * s)
   int is_signed;
   int rc = 0;
 
-  debug_print (2, ("Entering pgp_encrypted handler\n"));
   a = a->parts;
   if (!a || a->type != TYPEAPPLICATION || !a->subtype
       || ascii_strcasecmp ("pgp-encrypted", a->subtype)
@@ -2068,7 +2062,6 @@ int pgp_gpgme_encrypted_handler (BODY * a, STATE * s)
 
   fclose (fpout);
   mutt_unlink (tempfile);
-  debug_print (2, ("Leaving pgp_encrypted handler\n"));
   return (rc);
 }
 
@@ -2081,8 +2074,6 @@ int smime_gpgme_application_handler (BODY * a, STATE * s)
   int is_signed;
   int rc = 0;
 
-  debug_print (2, ("Entering smime_encrypted handler\n"));
-
   a->warnsig = 0;
   mutt_mktemp (tempfile);
   if (!(fpout = safe_fopen (tempfile, "w+"))) {
@@ -2135,7 +2126,6 @@ int smime_gpgme_application_handler (BODY * a, STATE * s)
 
   fclose (fpout);
   mutt_unlink (tempfile);
-  debug_print (2, ("Leaving smime_encrypted handler\n"));
   return (rc);
 }
 
@@ -3454,13 +3444,8 @@ static crypt_key_t *crypt_getkeybyaddr (address_t * a, short abilities,
   if (!keys)
     return NULL;
 
-  debug_print (5, ("looking for %s <%s>.\n", a->personal, a->mailbox));
-
   for (k = keys; k; k = k->next) {
-    debug_print (5, ("  looking at key: %s `%.15s'\n", crypt_keyid (k), k->uid));
-
     if (abilities && !(k->flags & abilities)) {
-      debug_print (5, ("  insufficient abilities: Has %x, want %x\n", k->flags, abilities));
       continue;
     }
 
@@ -3564,7 +3549,6 @@ static crypt_key_t *crypt_getkeybystr (char *p, short abilities,
       continue;
 
     match = 0;
-    debug_print (5, ("matching \"%s\" against " "key %s, \"%s\":\n", p, crypt_keyid (k), k->uid));
 
     if (!*p || !m_strcasecmp(p, crypt_keyid (k))
         || (!m_strncasecmp(p, "0x", 2)
@@ -3575,8 +3559,6 @@ static crypt_key_t *crypt_getkeybystr (char *p, short abilities,
         || m_stristr(k->uid, p)) {
       crypt_key_t *tmp;
 
-      debug_print (5, ("match.\n"));
-
       *matches_endp = tmp = crypt_copy_key (k);
       matches_endp = &tmp->next;
     }
index 194c48f..af29c47 100644 (file)
@@ -81,7 +81,7 @@ void crypt_forget_passphrase (void)
 }
 
 
-#if defined(HAVE_SETRLIMIT) && (!defined(DEBUG))
+#if defined(HAVE_SETRLIMIT)
 
 static void disable_coredumps (void)
 {
@@ -101,7 +101,7 @@ int crypt_valid_passphrase (int flags)
 {
   int ret = 0;
 
-# if defined(HAVE_SETRLIMIT) &&(!defined(DEBUG))
+# if defined(HAVE_SETRLIMIT)
   disable_coredumps ();
 # endif
 
index 392d735..f2a105c 100644 (file)
@@ -36,7 +36,6 @@
 #include <lib-lib/mem.h>
 #include <lib-lib/str.h>
 #include <lib-lib/date.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -117,8 +116,6 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
   if (!*buf)
     return NULL;
 
-  debug_print (2, ("buf = `%s'\n", buf));
-
   for (p = buf; p; p = pend) {
     if ((pend = strchr (p, ':')))
       *pend++ = 0;
@@ -129,8 +126,6 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
     switch (field) {
     case 1:                    /* record type */
       {
-        debug_print (2, ("record type: %s\n", p));
-
         if (!m_strcmp(p, "pub"));
         else if (!m_strcmp(p, "sub"))
           *is_subkey = 1;
@@ -149,8 +144,6 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
       }
     case 2:                    /* trust info */
       {
-        debug_print (2, ("trust info: %s\n", p));
-
         switch (*p) {           /* look only at the first letter */
         case 'e':
           flags |= KEYFLAG_EXPIRED;
@@ -182,18 +175,12 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
       }
     case 3:                    /* key length  */
       {
-
-        debug_print (2, ("key len: %s\n", p));
-
         if (!(*is_subkey && option (OPTPGPIGNORESUB)))
           k->keylen = atoi (p); /* fixme: add validation checks */
         break;
       }
     case 4:                    /* pubkey algo */
       {
-
-        debug_print (2, ("pubkey algorithm: %s\n", p));
-
         if (!(*is_subkey && option (OPTPGPIGNORESUB))) {
           k->numalg = atoi (p);
           k->algorithm = pgp_pkalgbytype (atoi (p));
@@ -202,8 +189,6 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
       }
     case 5:                    /* 16 hex digits with the long keyid. */
       {
-        debug_print (2, ("key id: %s\n", p));
-
         if (!(*is_subkey && option (OPTPGPIGNORESUB)))
           m_strreplace(&k->keyid, p);
         break;
@@ -214,8 +199,6 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
         char tstr[11];
         struct tm st_time;
 
-        debug_print (2, ("time stamp: %s\n", p));
-
         if (!p)
           break;
         st_time.tm_sec = 0;
@@ -245,8 +228,6 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
         if (!is_uid && (*is_subkey && option (OPTPGPIGNORESUB)))
           break;
 
-        debug_print (2, ("user ID: %s\n", p));
-
         uid = p_new(pgp_uid_t, 1);
         fix_uid (p);
         uid->addr = m_strdup(p);
@@ -266,8 +247,6 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
     case 11:                   /* signature class  */
       break;
     case 12:                   /* key capabilities */
-      debug_print (2, ("capabilities info: %s\n", p));
-
       while (*p) {
         switch (*p++) {
         case 'D':
index 82f874e..5c0d497 100644 (file)
@@ -32,7 +32,6 @@
 #include <lib-ui/curses.h>
 #include <lib-ui/enter.h>
 #include <lib-ui/menu.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 #include "handler.h"
@@ -152,11 +151,8 @@ static int pgp_copy_checksig (FILE * fpin, FILE * fpout)
 
     while ((line = mutt_read_line (line, &linelen, fpin, &lineno)) != NULL) {
       if (regexec (PgpGoodSign.rx, line, 0, NULL, 0) == 0) {
-        debug_print (2, ("\"%s\" matches regexp.\n", line));
         rv = 0;
       }
-      else
-        debug_print (2, ("\"%s\" doesn't match regexp.\n", line));
 
       if (strncmp (line, "[GNUPG:] ", 9) == 0)
         continue;
@@ -166,7 +162,6 @@ static int pgp_copy_checksig (FILE * fpin, FILE * fpout)
     p_delete(&line);
   }
   else {
-    debug_print (2, ("No pattern.\n"));
     mutt_copy_stream (fpin, fpout);
     rv = 1;
   }
@@ -601,8 +596,6 @@ int pgp_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
 
     if ((rv = mutt_wait_filter (thepid)))
       badsig = -1;
-
-    debug_print (1, ("mutt_wait_filter returned %d.\n", rv));
   }
 
   safe_fclose (&pgperr);
@@ -612,8 +605,6 @@ int pgp_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
   mutt_unlink (sigfile);
   mutt_unlink (pgperrfile);
 
-  debug_print (1, ("returning %d.\n", badsig));
-
   return badsig;
 }
 
index f95cc81..08f5d32 100644 (file)
@@ -29,7 +29,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-sys/unix.h>
 
@@ -143,7 +142,6 @@ void mutt_pgp_command (char *d, ssize_t dlen, struct pgp_command_context *cctx,
 {
   mutt_FormatString (d, dlen, NONULL (fmt), _mutt_fmt_pgp_command,
                      (unsigned long) cctx, 0);
-  debug_print (2, ("%s\n", d));
 }
 
 /*
index ef99d75..a4549cf 100644 (file)
@@ -17,7 +17,6 @@
 #include <lib-lib/ascii.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -814,16 +813,10 @@ pgp_key_t pgp_getkeybyaddr (address_t * a, short abilities, pgp_ring_t keyring)
   if (!keys)
     return NULL;
 
-  debug_print (5, ("looking for %s <%s>\n", a->personal, a->mailbox));
-
   for (k = keys; k; k = kn) {
     kn = k->next;
 
-    debug_print (5, ("  looking at key: %s\n", pgp_keyid (k)));
-
     if (abilities && !(k->flags & abilities)) {
-      debug_print (5, ("  insufficient abilities: Has %x, want %x\n",
-                  k->flags, abilities));
       continue;
     }
 
@@ -929,14 +922,12 @@ pgp_key_t pgp_getkeybystr (char *p, short abilities, pgp_ring_t keyring)
     match = 0;
 
     for (a = k->address; a; a = a->next) {
-      debug_print (5, ("matching \"%s\" against key %s, \"%s\":\n", p, pgp_keyid (k), a->addr));
       if (!*p || m_strcasecmp(p, pgp_keyid (k)) == 0
           || (!m_strncasecmp(p, "0x", 2)
               && !m_strcasecmp(p + 2, pgp_keyid (k)))
           || (option (OPTPGPLONGIDS) && !m_strncasecmp(p, "0x", 2)
               && !m_strcasecmp(p + 2, k->keyid + 8))
           || m_stristr(a->addr, p)) {
-        debug_print (5, ("match.\n"));
         match = 1;
         break;
       }
index 959ac36..8fe6a5e 100644 (file)
@@ -27,7 +27,6 @@
 #include <ctype.h>
 
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -78,7 +77,6 @@ static void pgp_dearmor (FILE * in, FILE * out)
       break;
   }
   if (r == NULL) {
-    debug_print (1, ("Can't find begin of ASCII armor.\n"));
     return;
   }
 
@@ -90,7 +88,6 @@ static void pgp_dearmor (FILE * in, FILE * out)
       break;
   }
   if (r == NULL) {
-    debug_print (1, ("Armor header doesn't end.\n"));
     return;
   }
 
@@ -104,17 +101,14 @@ static void pgp_dearmor (FILE * in, FILE * out)
       break;
   }
   if (r == NULL) {
-    debug_print (1, ("Can't find end of ASCII armor.\n"));
     return;
   }
 
   if ((end = ftello (in) - m_strlen(line)) < start) {
-    debug_print (1, ("end < start???\n"));
     return;
   }
 
   if (fseeko (in, start, SEEK_SET) == -1) {
-    debug_print (1, ("Can't seekto start.\n"));
     return;
   }
 
@@ -125,7 +119,6 @@ static short pgp_mic_from_packet (unsigned char *p, size_t len)
 {
   /* is signature? */
   if ((p[0] & 0x3f) != PT_SIG) {
-    debug_print (1, ("tag = %d, want %d.\n", p[0] & 0x3f, PT_SIG));
     return -1;
   }
 
@@ -136,7 +129,6 @@ static short pgp_mic_from_packet (unsigned char *p, size_t len)
     /* version 4 signature */
     return (short) p[4];
   else {
-    debug_print (1, ("Bad signature packet.\n"));
     return -1;
   }
 }
@@ -171,9 +163,6 @@ static short pgp_find_hash (const char *fname)
   if ((p = pgp_read_packet (out, &l)) != NULL) {
     rv = pgp_mic_from_packet (p, l);
   }
-  else {
-    debug_print (1, ("No packet.\n"));
-  }
 
 bye:
 
index 5d773cd..d455a3a 100644 (file)
@@ -35,7 +35,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -256,7 +255,6 @@ static void mutt_smime_command (char *d, ssize_t dlen,
 {
   mutt_FormatString (d, dlen, NONULL (fmt), _mutt_fmt_smime_command,
                      (unsigned long) cctx, 0);
-  debug_print (2, ("%s\n", d));
 }
 
 static pid_t smime_invoke (FILE ** smimein, FILE ** smimeout,
index 035dcba..c93a18a 100644 (file)
@@ -3,10 +3,10 @@ noinst_LIBRARIES = liblib.a
 liblib_a_SOURCES = mem.h str.h ascii.h buffer.h hash.h list.h file.h mapping.h \
                          str.c ascii.c buffer.c hash.c list.c file.c mapping.c \
                   \
-                  date.h debug.h rx.h url.h                                   \
-                  date.c debug.c rx.c url.c
+                  date.h rx.h url.h                                   \
+                  date.c rx.c url.c
 
 noinst_HEADERS   = mem.h str.h ascii.h buffer.h hash.h list.h file.h mapping.h \
-                  date.h debug.h rx.h url.h
+                  date.h rx.h url.h
 
 -include ../cflags.mk
index dccca24..0a506bb 100644 (file)
@@ -35,7 +35,6 @@
 #include "ascii.h"
 #include "buffer.h"
 #include "file.h"
-#include "debug.h"
 
 #include "mutt.h"
 
@@ -207,13 +206,11 @@ int mutt_extract_token(BUFFER *dest, BUFFER *tok, int flags)
                 }
             } while (pc && *pc != '`');
             if (!pc) {
-                debug_print (1, ("mismatched backtics\n"));
                 return (-1);
             }
 
             cmd = p_dupstr(tok->dptr, pc - tok->dptr);
             if ((pid = mutt_create_filter(cmd, NULL, &fp, NULL)) < 0) {
-                debug_print(1, ("unable to fork command: %s\n", cmd));
                 p_delete(&cmd);
                 return -1;
             }
diff --git a/lib-lib/debug.c b/lib-lib/debug.c
deleted file mode 100644 (file)
index bdf8b0c..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or (at
- *  your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- *  MA 02110-1301, USA.
- *
- *  Copyright Â© 2006 Pierre Habouzit
- */
-/*
- * written for mutt-ng by:
- * Rocco Rutte <pdmef@cs.tu-berlin.de>
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if DEBUG
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <time.h>
-
-#include "str.h"
-#include "file.h"
-#include "debug.h"
-
-#include "mutt.h"
-#include "globals.h"
-
-short DebugLevel = -1;
-FILE* DebugFile = NULL;
-
-void debug_setlevel(short level) {
-    DebugLevel = level;
-}
-
-void debug_start(const char* basedir) {
-    time_t t;
-    int i;
-    char buf[_POSIX_PATH_MAX];
-    char buf2[_POSIX_PATH_MAX];
-
-    if (DebugLevel < DEBUG_MIN_LEVEL || DebugLevel > DEBUG_MAX_LEVEL
-    || !basedir || !*basedir)
-        return;
-    /* rotate the old debug logs */
-    for (i = 3; i >= 0; i--) {
-        snprintf(buf, sizeof (buf), "%s/.madmuttdebug%d", NONULL(basedir), i);
-        snprintf(buf2, sizeof (buf2), "%s/.madmuttdebug%d", NONULL(basedir), i + 1);
-        rename (buf, buf2);
-    }
-
-    if ((DebugFile = safe_fopen (buf, "w")) != NULL) {
-        t = time (NULL);
-        setbuf(DebugFile, NULL);   /* don't buffer the debugging output! */
-        fprintf(DebugFile,
-                "Madmutt %s started at %s\nDebugging at level %d\n\n",
-                MUTT_VERSION, asctime (localtime (&t)), DebugLevel);
-    }
-}
-
-void _debug_print_intro(const char* file, int line, const char *function, int level) {
-    if (!DebugFile || DebugLevel < DEBUG_MIN_LEVEL || DebugLevel > DEBUG_MAX_LEVEL)
-        return;
-    fprintf(DebugFile, "[%d:%s:%d", level, NONULL(file), line);
-    if (function && *function)
-        fprintf(DebugFile, ":%s()", function);
-    fprintf(DebugFile, "] ");
-}
-
-void _debug_print_msg (const char* fmt, ...) {
-    va_list ap;
-
-    if (!DebugFile || DebugLevel < 0)
-        return;
-    va_start(ap, fmt);
-    vfprintf(DebugFile, fmt, ap);
-    va_end(ap);
-}
-
-#endif /* DEBUG */
diff --git a/lib-lib/debug.h b/lib-lib/debug.h
deleted file mode 100644 (file)
index bdb9d8f..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or (at
- *  your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- *  MA 02110-1301, USA.
- *
- *  Copyright Â© 2006 Pierre Habouzit
- */
-/*
- * written for mutt-ng by:
- * Rocco Rutte <pdmef@cs.tu-berlin.de>
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-
-/* generic interface for debug messages */
-
-#ifndef MUTT_LIB_LIB_DEBUG_H
-#define MUTT_LIB_LIB_DEBUG_H
-
-#include <stdio.h>
-
-#define DEBUG_MIN_LEVEL         1
-#define DEBUG_MIN_LEVEL_S       "1"
-#define DEBUG_MAX_LEVEL         5
-#define DEBUG_MAX_LEVEL_S       "5"
-
-#ifdef DEBUG
-
-extern short DebugLevel;
-extern FILE* DebugFile;
-
-void debug_setlevel (short);
-void debug_start (const char*);
-
-void _debug_print_intro (const char*, int, const char*, int);
-void _debug_print_msg (const char*, ...);
-
-/*
- * the debug_print() macro will (in the end) print debug messages of the
- * following format:
- *
- *      (file:line:function:level): message
- *
- * for GCC and:
- *
- *      (file:line:level): message
- *
- * otherwise
- */
-#ifdef __GNUC__
-
-#define debug_print(level,msg)                                      \
-    do {                                                            \
-        if (DebugLevel >= level) {                                  \
-            _debug_print_intro (__FILE__,__LINE__,__func__,level);  \
-            _debug_print_msg msg;                                   \
-        }                                                           \
-    } while(0)
-
-#else /* __GNUC__ */
-
-#define debug_print(level,msg)                                      \
-    do {                                                            \
-        if (DebugLevel >= level) {                                  \
-            _debug_print_intro (__FILE__,__LINE__,NULL,level);      \
-            _debug_print_msg msg;                                   \
-        }                                                           \
-    } while(0)
-
-#endif /* !__GNUC__ */
-
-#else /* DEBUG */
-
-/*
- * without debug support, we don't need these
- * (this also kills the dozens of #ifdef for debug...
- */
-#define debug_start(basedir)
-#define debug_setlevel(level)
-#define debug_print(level,msg)
-
-#endif /* !DEBUG */
-
-#endif /* MUTT_LIB_LIB_DEBUG_H */
index 985015f..b51b1ff 100644 (file)
@@ -37,7 +37,6 @@
 #include "mem.h"
 #include "str.h"
 #include "file.h"
-#include "debug.h"
 
 #ifndef O_NOFOLLOW
 #  define O_NOFOLLOW  0
@@ -75,7 +74,6 @@ int safe_open(const char *path, int flags)
     if (lstat (path, &osb) < 0 || fstat(fd, &nsb) < 0
     ||  compare_stat(&osb, &nsb) == -1)
     {
-        debug_print(1, ("%s is a symlink!\n", path));
         close(fd);
         return -1;
     }
@@ -328,7 +326,6 @@ int mutt_copy_bytes(FILE *in, FILE *out, ssize_t size)
         if ((chunk = fread(buf, 1, chunk, in)) < 1)
             break;
         if (fwrite(buf, 1, chunk, out) != chunk) {
-            debug_print(1, ("fwrite() returned short byte count\n"));
             return -1;
         }
         size -= chunk;
index d4e18c1..77cbe47 100644 (file)
@@ -38,7 +38,6 @@
 #include <lib-lib/macros.h>
 #include <lib-lib/buffer.h>
 #include <lib-lib/date.h>
-#include <lib-lib/debug.h>
 #include <lib-lib/url.h>
 
 #include "recvattach.h"
@@ -403,7 +402,6 @@ BODY *mutt_read_mime_header(FILE *fp, int digest)
             if (!*p)
                 continue;
         } else {
-            debug_print (1, ("bogus MIME header: %s\n", line));
             break;
         }
 
@@ -782,7 +780,6 @@ time_t mutt_parse_date(const char *s, HEADER *h)
     }
 
     if (count < 4) {  /* don't check for missing timezone */
-        debug_print (1, ("error parsing date format, using received time\n"));
         return -1;
     }
 
@@ -1176,8 +1173,6 @@ mutt_read_rfc822_header(FILE *f, HEADER *hdr, short user_hdrs, short weed)
         rfc2047_decode_envelope(e);
         /* check for missing or invalid date */
         if (hdr->date_sent <= 0) {
-            debug_print(1, ("no date found, using received "
-                            "time from msg separator\n"));
             hdr->date_sent = hdr->received;
         }
     }
index b085c17..78a609f 100644 (file)
@@ -26,7 +26,6 @@
 #include <lib-lib/mem.h>
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 #include "globals.h"
@@ -60,9 +59,7 @@ int mutt_socket_close (CONNECTION * conn)
 {
   int rc = -1;
 
-  if (conn->fd < 0)
-    debug_print (1, ("Attempt to close closed connection.\n"));
-  else
+  if (conn->fd >= 0)
     rc = conn->conn_close (conn);
 
   conn->fd = -1;
@@ -76,7 +73,6 @@ int mutt_socket_read (CONNECTION * conn, char *buf, ssize_t len)
   int rc;
 
   if (conn->fd < 0) {
-    debug_print (1, ("attempt to read from closed connection\n"));
     return -1;
   }
 
@@ -97,25 +93,17 @@ int mutt_socket_write_d (CONNECTION * conn, const char *buf, int dbg)
   int rc;
   int len;
 
-  debug_print (dbg, ("> %s", buf));
-
   if (conn->fd < 0) {
-    debug_print (1, ("attempt to write to closed connection\n"));
     return -1;
   }
 
   len = m_strlen(buf);
   if ((rc = conn->conn_write (conn, buf, len)) < 0) {
-    debug_print (1, ("error writing, closing socket\n"));
     mutt_socket_close (conn);
 
     return -1;
   }
 
-  if (rc < len) {
-    debug_print (1, ("ERROR: wrote %d of %d bytes!\n", rc, len));
-  }
-
   return rc;
 }
 
@@ -127,7 +115,6 @@ int mutt_socket_readchar (CONNECTION * conn, char *c)
       conn->available =
         conn->conn_read (conn, conn->inbuf, sizeof (conn->inbuf));
     else {
-      debug_print (1, ("attempt to read from closed connection.\n"));
       return -1;
     }
     conn->bufpos = 0;
@@ -168,8 +155,6 @@ int mutt_socket_readln_d (char *buf, ssize_t buflen, CONNECTION * conn,
   else
     buf[i] = '\0';
 
-  debug_print (dbg, ("< %s\n", buf));
-
   /* number of bytes read, not m_strlen*/
   return i + 1;
 }
@@ -268,9 +253,7 @@ static int socket_preconnect (void)
   int save_errno;
 
   if (m_strlen(Preconnect)) {
-    debug_print (2, ("Executing preconnect: %s\n", Preconnect));
     rc = mutt_system (Preconnect);
-    debug_print (2, ("Preconnect result: %d\n", rc));
     if (rc) {
       save_errno = errno;
       mutt_perror (_("Preconnect command failed."));
@@ -296,7 +279,6 @@ static int socket_connect (int fd, struct sockaddr *sa)
     sa_size = sizeof (struct sockaddr_in6);
 #endif
   else {
-    debug_print (1, ("Unknown address family!\n"));
     return -1;
   }
 
@@ -309,7 +291,6 @@ static int socket_connect (int fd, struct sockaddr *sa)
 
   if (connect (fd, sa, sa_size) < 0) {
     save_errno = errno;
-    debug_print (2, ("Connection failed. errno: %d...\n", errno));
     SigInt = 0;                 /* reset in case we caught SIGINTR while in connect() */
   }
 
index c7dcc7a..bfb09a8 100644 (file)
@@ -23,7 +23,6 @@
 #include <lib-lib/mem.h>
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include <lib-ui/curses.h>
 #include <lib-ui/menu.h>
@@ -89,19 +88,16 @@ int mutt_ssl_starttls (CONNECTION * conn)
   ssldata = p_new(sslsockdata, 1);
   /* the ssl_use_xxx protocol options don't apply. We must use TLS in TLS. */
   if (!(ssldata->ctx = SSL_CTX_new (TLSv1_client_method ()))) {
-    debug_print (1, ("Error allocating SSL_CTX\n"));
     goto bail_ssldata;
   }
 
   ssl_get_client_cert (ssldata, conn);
 
   if (!(ssldata->ssl = SSL_new (ssldata->ctx))) {
-    debug_print (1, ("Error allocating SSL\n"));
     goto bail_ctx;
   }
 
   if (SSL_set_fd (ssldata->ssl, conn->fd) != 1) {
-    debug_print (1, ("Error setting fd\n"));
     goto bail_ssl;
   }
 
@@ -478,14 +474,10 @@ static int check_certificate_by_signer (X509 * peercert)
   if (option (OPTSSLSYSTEMCERTS)) {
     if (X509_STORE_set_default_paths (ctx))
       pass++;
-    else
-      debug_print (2, ("X509_STORE_set_default_paths failed\n"));
   }
 
   if (X509_STORE_load_locations (ctx, SslCertFile, NULL))
     pass++;
-  else
-    debug_print (2, ("X509_STORE_load_locations_failed\n"));
 
   if (pass == 0) {
     /* nothing to do */
@@ -496,17 +488,6 @@ static int check_certificate_by_signer (X509 * peercert)
   X509_STORE_CTX_init (&xsc, ctx, peercert, NULL);
 
   pass = (X509_verify_cert (&xsc) > 0);
-#ifdef DEBUG
-  if (!pass) {
-    char buf[SHORT_STRING];
-    int err;
-
-    err = X509_STORE_CTX_get_error (&xsc);
-    snprintf (buf, sizeof (buf), "%s (%d)",
-              X509_verify_cert_error_string (err), err);
-    debug_print (2, ("X509_verify_cert: %s\n", buf));
-  }
-#endif
   X509_STORE_CTX_cleanup (&xsc);
   X509_STORE_free (ctx);
 
@@ -523,13 +504,11 @@ static int check_certificate_by_digest (X509 * peercert)
 
   /* expiration check */
   if (X509_cmp_current_time (X509_get_notBefore (peercert)) >= 0) {
-    debug_print (2, ("Server certificate is not yet valid\n"));
     mutt_error (_("Server certificate is not yet valid"));
     mutt_sleep (2);
     return 0;
   }
   if (X509_cmp_current_time (X509_get_notAfter (peercert)) <= 0) {
-    debug_print (2, ("Server certificate has expired\n"));
     mutt_error (_("Server certificate has expired"));
     mutt_sleep (2);
     return 0;
@@ -566,18 +545,15 @@ static int ssl_check_certificate (sslsockdata * data)
 
   /* check session cache first */
   if (check_certificate_cache (data->cert)) {
-    debug_print (1, ("ssl_check_certificate: using cached certificate\n"));
     return 1;
   }
 
   if (check_certificate_by_signer (data->cert)) {
-    debug_print (1, ("signer check passed\n"));
     return 1;
   }
 
   /* automatic check from user's database */
   if (SslCertFile && check_certificate_by_digest (data->cert)) {
-    debug_print (1, ("digest check passed\n"));
     return 1;
   }
 
@@ -684,7 +660,6 @@ static int ssl_check_certificate (sslsockdata * data)
 static void ssl_get_client_cert (sslsockdata * ssldata, CONNECTION * conn)
 {
   if (SslClientCert) {
-    debug_print (2, ("Using client certificate %s\n", SslClientCert));
     SSL_CTX_set_default_passwd_cb_userdata (ssldata->ctx, &conn->account);
     SSL_CTX_set_default_passwd_cb (ssldata->ctx, ssl_passwd_cb);
     SSL_CTX_use_certificate_file (ssldata->ctx, SslClientCert,
@@ -701,9 +676,6 @@ static int ssl_passwd_cb (char *buf, int size, int rwflag, void *userdata)
   if (mutt_account_getuser (account))
     return 0;
 
-  debug_print (2, ("getting password for %s@%s:%u\n",
-              account->user, account->host, account->port));
-
   if (mutt_account_getpass (account))
     return 0;
 
index 2f286f4..ca0ab98 100644 (file)
@@ -21,7 +21,6 @@
 #include <lib-lib/macros.h>
 #include <lib-lib/buffer.h>
 #include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
 
 #include "curses.h"
 
@@ -249,8 +248,6 @@ int mutt_alloc_color (int fg, int bg)
 
   init_pair (i, fg, bg);
 
-  debug_print (1, ("Color pairs used so far: %d\n", UserColors));
-
   return (COLOR_PAIR (p->index));
 }
 
@@ -266,7 +263,6 @@ void mutt_free_color (int fg, int bg)
         return;
 
       UserColors--;
-      debug_print (1, ("Color pairs used so far: %d\n", UserColors));
 
       if (p == ColorList) {
         ColorList = ColorList->next;
@@ -418,7 +414,6 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data __attribute__
         if (!m_strcmp(buf->data, tmp->pattern)) {
           if (!do_cache)
             do_cache = 1;
-          debug_print (1, ("Freeing pattern \"%s\" from ColorIndexList\n", tmp->pattern));
           if (last)
             last->next = tmp->next;
           else
index 1cc7aa6..0bbe168 100644 (file)
@@ -34,7 +34,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-sys/unix.h>
 #include <lib-sys/mutt_signal.h>
@@ -221,11 +220,11 @@ int mutt_yesorno (const char *msg, int def)
 
 #ifdef HAVE_LANGINFO_YESEXPR
     answer[0] = ch.ch;
-    if (reyes_ok ? (regexec (&reyes, answer, 0, 0, 0) == 0) :
+    if (reyes_ok ? (regexec (&reyes, answer, 0, 0, 0) == 0) : tolower (ch.ch) == *yes)
 #else
-    if (
+    if (tolower (ch.ch) == *yes)
 #endif
-         (tolower (ch.ch) == *yes)) {
+    {
       def = M_YES;
       break;
     }
@@ -236,8 +235,7 @@ int mutt_yesorno (const char *msg, int def)
               (tolower (ch.ch) == *no)) {
       def = M_NO;
       break;
-    }
-    else {
+    } else {
       BEEP ();
     }
   }
@@ -281,7 +279,6 @@ void mutt_curses_error (const char *fmt, ...)
   vsnprintf (Errorbuf, sizeof (Errorbuf), fmt, ap);
   va_end (ap);
 
-  debug_print (1, ("%s\n", Errorbuf));
   mutt_format_string (TmpErrorbuf, sizeof (TmpErrorbuf),
                       0, COLS - 2, 0, 0, Errorbuf, sizeof (Errorbuf), 0);
   snprintf (Errorbuf, sizeof (Errorbuf), "%s", TmpErrorbuf);    /* overkill */
@@ -380,8 +377,6 @@ void mutt_endwin (const char *msg)
 void _mutt_perror (const char *s, const char* filename, int line)
 {
   char *p = strerror (errno);
-
-  debug_print (1, ("%s: %s (errno = %d)\n", s, p ? p : "unknown error", errno));
   mutt_error ("%s: %s (errno = %d) from %s:%i", s, p ? p : _("unknown error"), errno, filename, line);
 }
 
index 5b40ceb..7b5b5ee 100644 (file)
@@ -26,7 +26,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
 
 #include <pop/pop.h>
 
@@ -605,8 +604,6 @@ int mutt_index_menu (void)
 
       op = km_dokey (MENU_MAIN);
 
-      debug_print (4, ("Got op %d\n", op));
-
       if (op == -1)
         continue;               /* either user abort or timeout */
 
diff --git a/main.c b/main.c
index 8f1c8b4..3d1e21c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -31,7 +31,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 #include <lib-lib/url.h>
 
 #include <lib-sys/mutt_signal.h>
@@ -162,9 +161,6 @@ options:\n\
   -a <file>\tattach a file to the message\n\
   -b <address>\tspecify a blind carbon-copy (BCC) address\n\
   -c <address>\tspecify a carbon-copy (CC) address");
-#if DEBUG
-  puts _("  -d <level>\tlog debugging output to ~/.madmuttdebug0");
-#endif
   puts _("\
   -e <command>\tspecify a command to be executed after initialization\n\
   -f <file>\tspecify which mailbox to read\n\
@@ -261,12 +257,6 @@ static void show_version (void)
 
   puts (_("Compile Options:"));
 
-#ifdef DEBUG
-  puts ("  +DEBUG");
-#else
-  puts ("  -DEBUG");
-#endif
-
   puts (
 #ifdef HOMESPOOL
          "  +HOMESPOOL  "
@@ -548,10 +538,10 @@ int main (int argc, char **argv)
 #ifdef USE_NNTP
   while ((i =
           getopt (argc, argv,
-                  "A:a:b:F:f:c:d:e:g:GH:s:i:hm:npQ:RTtvyzZ")) != EOF)
+                  "A:a:b:F:f:c:e:g:GH:s:i:hm:npQ:RTtvyzZ")) != EOF)
 #else
   while ((i =
-          getopt (argc, argv, "A:a:b:F:f:c:d:e:H:s:i:hm:npQ:RTtvyzZ")) != EOF)
+          getopt (argc, argv, "A:a:b:F:f:c:e:H:s:i:hm:npQ:RTtvyzZ")) != EOF)
 #endif
     switch (i) {
     case 'A':
@@ -587,17 +577,6 @@ int main (int argc, char **argv)
         msg->env->cc = rfc822_parse_adrlist (msg->env->cc, optarg);
       break;
 
-    case 'd':
-      {
-        char buf[LONG_STRING];
-        int level = atoi (optarg);
-
-        snprintf (buf, sizeof (buf), "set debug_level=%d", level);
-        commands = mutt_add_list (commands, buf);
-        debug_setlevel (level);
-      }
-      break;
-
     case 't':
       dump_variables = 2;
       break;
index df72d5d..3844569 100644 (file)
--- a/makedoc.c
+++ b/makedoc.c
@@ -108,7 +108,6 @@ enum {
 
 enum output_formats_t OutputFormat = F_NONE;
 char *Progname;
-short Debug = 0;
 
 static char *get_token (char *, size_t, char *);
 static char *skip_ws (char *);
@@ -148,9 +147,6 @@ int main (int argc, char *argv[])
     case 's':
       OutputFormat = F_SGML;
       break;
-    case 'd':
-      Debug++;
-      break;
     default:
       {
         fprintf (stderr, "%s: bad command line parameter.\n", Progname);
@@ -248,11 +244,6 @@ static void makedoc (FILE * in, FILE * out)
     if (!(p = get_token (token, sizeof (token), buffer)))
       continue;
 
-    if (Debug) {
-      fprintf (stderr, "%s: line %d.  first token: \"%s\".\n",
-               Progname, line, token);
-    }
-
     if (!strcmp (token, "/*++*/"))
       active = 1;
     else if (!strcmp (token, "/*--*/")) {
@@ -299,35 +290,19 @@ static char *get_token (char *d, size_t l, char *s)
   short is_quoted = 0;
   char *dd = d;
 
-  if (Debug)
-    fprintf (stderr, "%s: get_token called for `%s'.\n", Progname, s);
-
   s = skip_ws (s);
 
-  if (Debug > 1)
-    fprintf (stderr, "%s: argumet after skip_ws():  `%s'.\n", Progname, s);
-
   if (!*s) {
-    if (Debug)
-      fprintf (stderr, "%s: no more tokens on this line.\n", Progname);
     return NULL;
   }
 
   if (strchr (single_char_tokens, *s)) {
-    if (Debug) {
-      fprintf (stderr, "%s: found single character token `%c'.\n",
-               Progname, *s);
-    }
     d[0] = *s++;
     d[1] = 0;
     return s;
   }
 
   if (*s == '"') {
-    if (Debug) {
-      fprintf (stderr, "%s: found quote character.\n", Progname);
-    }
-
     s++;
     is_quoted = 1;
   }
@@ -370,12 +345,6 @@ static char *get_token (char *d, size_t l, char *s)
 
   *d = '\0';
 
-  if (Debug) {
-    fprintf (stderr, "%s: Got %stoken: `%s'.\n",
-             Progname, is_quoted ? "quoted " : "", dd);
-    fprintf (stderr, "%s: Remainder: `%s'.\n", Progname, t);
-  }
-
   return t;
 }
 
@@ -472,8 +441,6 @@ static void handle_confline (char *s)
     return;
 
   if (!strcmp (buff, "|")) {
-    if (Debug)
-      fprintf (stderr, "%s: Expecting <subtype> <comma>.\n", Progname);
     /* ignore subtype and comma */
     if (!(s = get_token (buff, sizeof (buff), s)))
       return;
@@ -501,15 +468,10 @@ static void handle_confline (char *s)
   if (!(s = get_token (buff, sizeof (buff), s)))
     return;
 
-  if (Debug)
-    fprintf (stderr, "%s: Expecting default value.\n", Progname);
-
   /* <default value> or UL <default value> */
   if (!(s = get_token (buff, sizeof (buff), s)))
     return;
   if (!strcmp (buff, "UL")) {
-    if (Debug)
-      fprintf (stderr, "%s: Skipping UL.\n", Progname);
     if (!(s = get_token (buff, sizeof (buff), s)))
       return;
   }
@@ -1229,9 +1191,6 @@ static int handle_docline (char *l, int docstat)
 
   l = skip_ws (l);
 
-  if (Debug)
-    fprintf (stderr, "%s: handle_docline `%s'\n", Progname, l);
-
   if (!strncmp (l, ".pp", 3))
     return print_it (SP_NEWPAR, NULL, docstat);
   else if (!strncmp (l, ".ts", 3))
diff --git a/mbox.c b/mbox.c
index 5f76334..618fbdf 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -26,7 +26,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-sys/mutt_signal.h>
 
@@ -132,7 +131,6 @@ static int mmdf_parse_mailbox (CONTEXT * ctx)
 
       if (fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL) {
         /* TODO: memory leak??? */
-        debug_print (1, ("unexpected EOF\n"));
         break;
       }
 
@@ -140,7 +138,6 @@ static int mmdf_parse_mailbox (CONTEXT * ctx)
 
       if (!is_from (buf, return_path, sizeof (return_path), &t)) {
         if (fseeko (ctx->fp, loc, SEEK_SET) != 0) {
-          debug_print (1, ("fseeko() failed\n"));
           mutt_error _("Mailbox is corrupt!");
 
           return (-1);
@@ -160,8 +157,7 @@ static int mmdf_parse_mailbox (CONTEXT * ctx)
           if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0 ||
               fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL ||
               m_strcmp(MMDF_SEP, buf) != 0) {
-            if (fseeko (ctx->fp, loc, SEEK_SET) != 0)
-              debug_print (1, ("fseeko() failed\n"));
+            fseeko (ctx->fp, loc, SEEK_SET);
             hdr->content->length = -1;
           }
         }
@@ -194,7 +190,6 @@ static int mmdf_parse_mailbox (CONTEXT * ctx)
       ctx->msgcount++;
     }
     else {
-      debug_print (1, ("corrupt mailbox!\n"));
       mutt_error _("Mailbox is corrupt!");
 
       return (-1);
@@ -288,12 +283,7 @@ static int mbox_parse_mailbox (CONTEXT * ctx)
           if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0 ||
               fgets (buf, sizeof (buf), ctx->fp) == NULL ||
               m_strncmp("From ", buf, 5) != 0) {
-            debug_print (1, ("bad content-length in message %d (cl=%zd)\n",
-                             curhdr->index, curhdr->content->length));
-            debug_print (1, ("LINE: %s\n", buf));
-            if (fseeko (ctx->fp, loc, SEEK_SET) != 0) {  /* nope, return the previous position */
-              debug_print (1, ("fseeko() failed\n"));
-            }
+            fseeko (ctx->fp, loc, SEEK_SET); /* nope, return the previous position */
             curhdr->content->length = -1;
           }
         }
@@ -312,8 +302,7 @@ static int mbox_parse_mailbox (CONTEXT * ctx)
             int cl = curhdr->content->length;
 
             /* count the number of lines in this message */
-            if (fseeko (ctx->fp, loc, SEEK_SET) != 0)
-              debug_print (1, ("fseeko() failed\n"));
+            fseeko (ctx->fp, loc, SEEK_SET);
             while (cl-- > 0) {
               if (fgetc (ctx->fp) == '\n')
                 curhdr->lines++;
@@ -321,8 +310,7 @@ static int mbox_parse_mailbox (CONTEXT * ctx)
           }
 
           /* return to the offset of the next message separator */
-          if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0)
-            debug_print (1, ("fseeko() failed\n"));
+          fseeko(ctx->fp, tmploc, SEEK_SET);
         }
       }
 
@@ -441,13 +429,11 @@ static int _mbox_check_mailbox (CONTEXT * ctx, int *index_hint)
        * see the message separator at *exactly* what used to be the end of the
        * folder.
        */
-      if (fseeko (ctx->fp, ctx->size, SEEK_SET) != 0)
-        debug_print (1, ("fseeko() failed\n"));
+      fseeko (ctx->fp, ctx->size, SEEK_SET);
       if (fgets (buffer, sizeof (buffer), ctx->fp) != NULL) {
         if ((ctx->magic == M_MBOX && m_strncmp("From ", buffer, 5) == 0)
             || (ctx->magic == M_MMDF && m_strcmp(MMDF_SEP, buffer) == 0)) {
-          if (fseeko (ctx->fp, ctx->size, SEEK_SET) != 0)
-            debug_print (1, ("fseeko() failed\n"));
+          fseeko (ctx->fp, ctx->size, SEEK_SET);
           if (ctx->magic == M_MBOX)
             mbox_parse_mailbox (ctx);
           else
@@ -467,14 +453,12 @@ static int _mbox_check_mailbox (CONTEXT * ctx, int *index_hint)
         }
         else
           modified = 1;
-      }
-      else {
-        debug_print (1, ("fgets returned NULL.\n"));
+      } else {
         modified = 1;
       }
-    }
-    else
+    } else {
       modified = 1;
+    }
   }
 
   if (modified) {
@@ -603,7 +587,6 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused)
     mutt_error
       _("sync: mbox modified, but no modified messages! (report this bug)");
     mutt_sleep (5);             /* the mutt_error /will/ get cleared! */
-    debug_print (1, ("no modified messages.\n"));
     unlink (tempfile);
     goto bail;
   }
@@ -698,7 +681,6 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused)
 
   if (fclose (fp) != 0) {
     fp = NULL;
-    debug_print (1, ("fclose() returned non-zero.\n"));
     unlink (tempfile);
     mutt_perror (tempfile);
     mutt_sleep (5);
@@ -717,7 +699,6 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused)
   if ((fp = fopen (tempfile, "r")) == NULL) {
     mutt_unblock_signals ();
     mx_fastclose_mailbox (ctx);
-    debug_print (1, ("unable to reopen temp copy of mailbox!\n"));
     mutt_perror (tempfile);
     mutt_sleep (5);
     return (-1);
@@ -728,16 +709,12 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused)
       fgets (buf, sizeof (buf), ctx->fp) == NULL ||
       (ctx->magic == M_MBOX && m_strncmp("From ", buf, 5) != 0) ||
       (ctx->magic == M_MMDF && m_strcmp(MMDF_SEP, buf) != 0)) {
-    debug_print (1, ("message not in expected position.\n"));
-    debug_print (1, ("LINE: %s\n", buf));
     i = -1;
   }
   else {
     if (fseeko (ctx->fp, offset, SEEK_SET) != 0) {       /* return to proper offset */
       i = -1;
-      debug_print (1, ("fseeko() failed\n"));
-    }
-    else {
+    } else {
       /* copy the temp mailbox back into place starting at the first
        * change/deleted message
        */
@@ -933,7 +910,6 @@ static int mbox_reopen_mailbox (CONTEXT * ctx, int *index_hint)
   case M_MBOX:
   case M_MMDF:
     if (fseeko (ctx->fp, 0, SEEK_SET) != 0) {
-      debug_print (1, ("fseeko() failed\n"));
       rc = -1;
     }
     else {
diff --git a/mh.c b/mh.c
index 5ca542f..49302fc 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -39,7 +39,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 #include "mx.h"
@@ -696,7 +695,6 @@ static int maildir_parse_dir (CONTEXT * ctx, struct maildir ***last,
 
     /* FOO - really ignore the return value? */
 
-    debug_print (2, ("parsing %s\n", de->d_name));
     maildir_parse_entry (ctx, last, subdir, de->d_name, count, is_old,
 #if HAVE_DIRENT_D_INO
                          de->d_ino
@@ -716,12 +714,7 @@ static int maildir_add_to_context (CONTEXT * ctx, struct maildir *md)
 
   while (md) {
 
-    debug_print (2, ("considering %s\n", NONULL (md->canon_fname)));
-
     if (md->h) {
-      debug_print (2, ("flags: %s%s%s%s%s\n", md->h->flagged ? "f" : "",
-                  md->h->deleted ? "D" : "", md->h->replied ? "r" : "",
-                  md->h->old ? "O" : "", md->h->read ? "R" : ""));
       if (ctx->msgcount == ctx->hdrmax)
         mx_alloc_memory (ctx);
 
@@ -961,17 +954,13 @@ static int maildir_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr
               dest->path, subdir, (long) time (NULL),
               (unsigned int) getpid (), Counter++, NONULL (Hostname), suffix);
 
-    debug_print (2, ("trying %s.\n", path));
-
     umask (Umask);
     if ((fd = open (path, O_WRONLY | O_EXCL | O_CREAT, 0666)) == -1) {
       if (errno != EEXIST) {
         mutt_perror (path);
         return -1;
       }
-    }
-    else {
-      debug_print (2, ("success.\n"));
+    } else {
       msg->path = m_strdup(path);
       break;
     }
@@ -1038,8 +1027,6 @@ static int maildir_commit_message (MESSAGE * msg, CONTEXT * ctx, HEADER * hdr)
               NONULL (Hostname), suffix);
     snprintf (full, _POSIX_PATH_MAX, "%s/%s", ctx->path, path);
 
-    debug_print (2, ("renaming %s to %s.\n", msg->path, full));
-
     if (safe_rename (msg->path, full) == 0) {
       if (hdr)
         m_strreplace(&hdr->path, path);
@@ -1256,7 +1243,6 @@ static int maildir_sync_message (CONTEXT * ctx, int msgno)
     char *p;
 
     if ((p = strrchr (h->path, '/')) == NULL) {
-      debug_print (1, ("%s: unable to find subdir!\n", h->path));
       return (-1);
     }
     p++;
index bab9f8f..e2919ff 100644 (file)
@@ -15,7 +15,6 @@
 #include <lib-lib/ascii.h>
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 #include "charset.h"
@@ -70,7 +69,6 @@ int mutt_idna_to_local (const char *in, char **out, int flags)
     if (!irrev && idna_to_ascii_8z (tmp, &t2, 1) != IDNA_SUCCESS)
       irrev = 1;
     if (!irrev && ascii_strcasecmp (t2, in)) {
-      debug_print (1, ("not reversible. in = '%s', t2 = '%s'.\n", in, t2));
       irrev = 1;
     }
 
index d904164..5952752 100644 (file)
@@ -20,7 +20,6 @@
 #include <netinet/in.h>
 
 #include <lib-lib/mem.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 #include "account.h"
@@ -33,36 +32,27 @@ static int getnameinfo_err (int ret)
 
   switch (ret) {
   case EAI_AGAIN:
-    debug_print (1, ("The name could not be resolved at this time. Future attempts may succeed.\n"));
     err = SASL_TRYAGAIN;
     break;
   case EAI_BADFLAGS:
-    debug_print (1, ("The flags had an invalid value.\n"));
     err = SASL_BADPARAM;
     break;
   case EAI_FAIL:
-    debug_print (1, ("A non-recoverable error occurred.\n"));
     err = SASL_FAIL;
     break;
   case EAI_FAMILY:
-    debug_print (1, ("The address family was not recognized or the address length was invalid for the specified family.\n"));
     err = SASL_BADPROT;
     break;
   case EAI_MEMORY:
-    debug_print (1, ("There was a memory allocation failure.\n"));
     err = SASL_NOMEM;
     break;
   case EAI_NONAME:
-    debug_print (1, ("The name does not resolve for the supplied parameters. NI_NAMEREQD is set and the host's name cannot be located, or both nodename and servname were null.\n"));
     err = SASL_FAIL;            /* no real equivalent */
     break;
   case EAI_SYSTEM:
-    debug_print (1, ("A system error occurred.  The error code can be found in errno(%d,%s)).\n", 
-                errno, strerror (errno)));
     err = SASL_FAIL;            /* no real equivalent */
     break;
   default:
-    debug_print (1, ("Unknown error %d\n", ret));
     err = SASL_FAIL;            /* no real equivalent */
     break;
   }
@@ -81,8 +71,6 @@ static sasl_callback_t mutt_sasl_callbacks[5];
 static int mutt_sasl_start (void);
 
 /* callbacks */
-static int mutt_sasl_cb_log (void *context, int priority,
-                             const char *message);
 static int mutt_sasl_cb_authname (void *context, int id, const char **result,
                                   unsigned int *len);
 static int mutt_sasl_cb_pass (sasl_conn_t * conn, void *context, int id,
@@ -122,6 +110,12 @@ static int iptostring (const struct sockaddr *addr, socklen_t addrlen,
   return SASL_OK;
 }
 
+/* mutt_sasl_cb_log: callback to log SASL messages */
+static int mutt_sasl_cb_log (void *context, int priority, const char *message)
+{
+  return SASL_OK;
+}
+
 /* mutt_sasl_start: called before doing a SASL exchange - initialises library
  *   (if necessary). */
 int mutt_sasl_start (void)
@@ -146,7 +140,6 @@ int mutt_sasl_start (void)
   rc = sasl_client_init (callbacks);
 
   if (rc != SASL_OK) {
-    debug_print (1, ("libsasl initialisation failed.\n"));
     return SASL_FAIL;
   }
 
@@ -179,44 +172,34 @@ int mutt_sasl_client_new (CONNECTION * conn, sasl_conn_t ** saslconn)
     service = "pop";
     break;
   default:
-    debug_print (1, ("account type unset\n"));
     return -1;
   }
 
   size = sizeof (local);
   if (getsockname (conn->fd, (struct sockaddr *) &local, &size)) {
-    debug_print (1, ("getsockname for local failed\n"));
     return -1;
   }
   else
-    if (iptostring
-        ((struct sockaddr *) &local, size, iplocalport,
+    if (iptostring((struct sockaddr *)&local, size, iplocalport,
          IP_PORT_BUFLEN) != SASL_OK) {
-    debug_print (1, ("iptostring for local failed\n"));
     return -1;
   }
 
   size = sizeof (remote);
   if (getpeername (conn->fd, (struct sockaddr *) &remote, &size)) {
-    debug_print (1, ("getsockname for remote failed\n"));
     return -1;
   }
   else
     if (iptostring
         ((struct sockaddr *) &remote, size, ipremoteport,
          IP_PORT_BUFLEN) != SASL_OK) {
-    debug_print (1, ("iptostring for remote failed\n"));
     return -1;
   }
 
-  debug_print (1, ("local ip: %s, remote ip:%s\n", iplocalport, ipremoteport));
-
-  rc =
-    sasl_client_new (service, conn->account.host, iplocalport, ipremoteport,
-                     mutt_sasl_get_callbacks (&conn->account), 0, saslconn);
+  rc = sasl_client_new(service, conn->account.host, iplocalport, ipremoteport,
+                       mutt_sasl_get_callbacks(&conn->account), 0, saslconn);
 
   if (rc != SASL_OK) {
-    debug_print (1, ("Error allocating SASL connection\n"));
     return -1;
   }
 
@@ -238,14 +221,12 @@ int mutt_sasl_client_new (CONNECTION * conn, sasl_conn_t ** saslconn)
 
 #ifdef SASL_IP_LOCAL
     if (sasl_setprop (*saslconn, SASL_IP_LOCAL, &local) != SASL_OK) {
-      debug_print (1, ("Error setting local IP address\n"));
       return -1;
     }
 #endif
 
 #ifdef SASL_IP_REMOTE
     if (sasl_setprop (*saslconn, SASL_IP_REMOTE, &remote) != SASL_OK) {
-      debug_print (1, ("Error setting remote IP address\n"));
       return -1;
     }
 #endif
@@ -261,21 +242,16 @@ int mutt_sasl_client_new (CONNECTION * conn, sasl_conn_t ** saslconn)
   secprops.maxbufsize = M_SASL_MAXBUF;
   secprops.security_flags |= SASL_SEC_NOPLAINTEXT;
   if (sasl_setprop (*saslconn, SASL_SEC_PROPS, &secprops) != SASL_OK) {
-    debug_print (1, ("Error setting security properties\n"));
     return -1;
   }
 
   if (conn->ssf) {
-    debug_print (2, ("External SSF: %d\n", conn->ssf));
     if (sasl_setprop (*saslconn, SASL_SSF_EXTERNAL, &(conn->ssf)) != SASL_OK)
     {
-      debug_print (1, ("Error setting external properties\n"));
       return -1;
     }
-    debug_print (2, ("External authentication name: %s\n", conn->account.user));
     if (sasl_setprop (*saslconn, SASL_AUTH_EXTERNAL, conn->account.user) !=
         SASL_OK) {
-      debug_print (1, ("Error setting external properties\n"));
       return -1;
     }
   }
@@ -322,8 +298,6 @@ int mutt_sasl_interact (sasl_interact_t * interaction)
   char resp[SHORT_STRING];
 
   while (interaction->id != SASL_CB_LIST_END) {
-    debug_print (2, ("filling in SASL interaction %ld.\n", interaction->id));
-
     snprintf (prompt, sizeof (prompt), "%s: ", interaction->prompt);
     resp[0] = '\0';
     if (mutt_get_field (prompt, resp, sizeof (resp), 0))
@@ -360,12 +334,11 @@ void mutt_sasl_setup_conn (CONNECTION * conn, sasl_conn_t * saslconn)
   sasldata->saslconn = saslconn;
   /* get ssf so we know whether we have to (en|de)code read/write */
   sasl_getprop (saslconn, SASL_SSF, (const void **)(void *)&sasldata->ssf);
-  debug_print (3, ("SASL protection strength: %u\n", *sasldata->ssf));
+
   /* Add SASL SSF to transport SSF */
   conn->ssf += *sasldata->ssf;
   sasl_getprop (saslconn, SASL_MAXOUTBUF,
                 (const void **)(void *)&sasldata->pbufsize);
-  debug_print (3, ("SASL protection buffer size: %u\n", *sasldata->pbufsize));
 
   /* clear input buffer */
   sasldata->buf = NULL;
@@ -391,14 +364,6 @@ void mutt_sasl_done (void) {
   sasl_done ();
 }
 
-/* mutt_sasl_cb_log: callback to log SASL messages */
-static int mutt_sasl_cb_log (void *context, int priority, const char *message)
-{
-  debug_print (priority, ("SASL: %s\n", message));
-
-  return SASL_OK;
-}
-
 /* mutt_sasl_cb_authname: callback to retrieve authname or user from ACCOUNT */
 static int mutt_sasl_cb_authname (void *context, int id, const char **result,
                                   unsigned *len)
@@ -412,10 +377,6 @@ static int mutt_sasl_cb_authname (void *context, int id, const char **result,
   if (!account)
     return SASL_BADPARAM;
 
-  debug_print (2, ("getting %s for %s:%u\n",
-              id == SASL_CB_AUTHNAME ? "authname" : "user",
-              account->host, account->port));
-
   if (id == SASL_CB_AUTHNAME) {
     if (mutt_account_getlogin (account))
       return SASL_FAIL;
@@ -441,9 +402,6 @@ static int mutt_sasl_cb_pass (sasl_conn_t * conn, void *context, int id,
   if (!account || !psecret)
     return SASL_BADPARAM;
 
-  debug_print (2, ("getting password for %s@%s:%u\n",
-              account->login, account->host, account->port));
-
   if (mutt_account_getpass (account))
     return SASL_FAIL;
 
@@ -537,8 +495,6 @@ static int mutt_sasl_conn_read (CONNECTION * conn, char *buf, ssize_t len)
       rc = sasl_decode (sasldata->saslconn, buf, rc, &sasldata->buf,
                         &sasldata->blen);
       if (rc != SASL_OK) {
-        debug_print (1, ("SASL decode failed: %s\n",
-                    sasl_errstring (rc, NULL, NULL)));
         goto out;
       }
     }
@@ -581,8 +537,6 @@ static int mutt_sasl_conn_write (CONNECTION * conn, const char *buf,
 
       rc = sasl_encode (sasldata->saslconn, buf, olen, &pbuf, &plen);
       if (rc != SASL_OK) {
-        debug_print (1, ("SASL encoding failed: %s\n",
-                    sasl_errstring (rc, NULL, NULL)));
         goto fail;
       }
 
index 3e8bc09..7e89aff 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -32,7 +32,6 @@
 #include <lib-lib/macros.h>
 #include <lib-lib/buffer.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 #include <lib-lib/url.h>
 
 #include <lib-mime/mime.h>
@@ -181,11 +180,8 @@ void mutt_free_body (BODY ** p)
     if (b->parameter)
       parameter_list_wipe(&b->parameter);
     if (b->unlink && b->filename) {
-      debug_print (1, ("unlinking %s.\n", b->filename));
       unlink (b->filename);
     }
-    else if (b->filename)
-      debug_print (1, ("not unlinking %s.\n", b->filename));
 
     p_delete(&b->filename);
     p_delete(&b->content);
@@ -552,7 +548,6 @@ void _mutt_mktemp (char *s, const char *src, int line)
   snprintf (s, _POSIX_PATH_MAX, "%s/madmutt-%s-%d-%d-%d-%x%x", NONULL (Tempdir),
             NONULL (Hostname), (int) getuid (), (int) getpid (), Counter++, 
             (unsigned int) rand(), (unsigned int) rand());
-  debug_print (1, ("%s:%d: mutt_mktemp returns \"%s\".\n", src, line, s));
   unlink (s);
 }
 
@@ -1210,8 +1205,6 @@ int mutt_match_spam_list (const char *s, SPAM_LIST * l, char *text, int x)
     /* Does this pattern match? */
     if (regexec(l->rx->rx, s, l->nmatch, (regmatch_t *)pmatch, (int) 0) == 0)
     {
-      debug_print (5, ("%s matches %s\n%d subst", s, l->rx->pattern, l->rx->rx->re_nsub));
-
       /* Copy template into text, with substitutions. */
       for (p = l->template; *p;) {
         if (*p == '%') {
@@ -1226,7 +1219,6 @@ int mutt_match_spam_list (const char *s, SPAM_LIST * l, char *text, int x)
         }
       }
       text[tlen] = '\0';
-      debug_print (5, ("\"%s\"\n", text));
       return 1;
     }
   }
diff --git a/mx.c b/mx.c
index c5576d6..190f527 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -28,7 +28,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 #include <lib-lib/url.h>
 
 #include <lib-sys/unix.h>
@@ -192,7 +191,6 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int time_out)
   while (fcntl (fd, F_SETLK, &lck) == -1) {
     struct stat sb;
 
-    debug_print (1, ("fcntl errno %d.\n", errno));
     if (errno != EAGAIN && errno != EACCES) {
       mutt_perror ("fcntl");
       return (-1);
@@ -1087,7 +1085,6 @@ MESSAGE *mx_open_new_message (CONTEXT * dest, HEADER * hdr, int flags)
   address_t *p = NULL;
 
   if (!MX_IDX(dest->magic-1)) {
-    debug_print (1, ("function unimplemented for mailbox type %d.\n", dest->magic));
     return (NULL);
   }
 
@@ -1141,9 +1138,7 @@ int mx_check_mailbox (CONTEXT * ctx, int *index_hint, int lock) {
       return (MX_COMMAND(ctx->magic-1,mx_check_mailbox)(ctx, index_hint, lock));
   }
 
-  debug_print (1, ("null or invalid context.\n"));
   return (-1);
-
 }
 
 /* return a stream pointer for a message */
@@ -1172,7 +1167,6 @@ MESSAGE *mx_open_message (CONTEXT * ctx, int msgno)
 
       if (msg->fp == NULL) {
         mutt_perror (path);
-        debug_print (1, ("fopen: %s: %s (errno %d).\n", path, strerror (errno), errno));
         p_delete(&msg);
       }
     }
@@ -1202,7 +1196,6 @@ MESSAGE *mx_open_message (CONTEXT * ctx, int msgno)
 #endif /* USE_NNTP */
 
   default:
-    debug_print (1, ("function not implemented for mailbox type %d.\n", ctx->magic));
     p_delete(&msg);
     break;
   }
@@ -1213,7 +1206,6 @@ MESSAGE *mx_open_message (CONTEXT * ctx, int msgno)
 
 int mx_commit_message (MESSAGE * msg, CONTEXT * ctx) {
   if (!(msg->write && ctx->append)) {
-    debug_print (1, ("msg->write = %d, ctx->append = %d\n", msg->write, ctx->append));
     return -1;
   }
   if (!ctx || !MX_IDX(ctx->magic-1) || !MX_COMMAND(ctx->magic-1,mx_commit_message))
@@ -1239,7 +1231,6 @@ int mx_close_message (MESSAGE ** msg)
     (*msg)->fp = NULL;
 
   if ((*msg)->path) {
-    debug_print (1, ("unlinking %s\n", (*msg)->path));
     unlink ((*msg)->path);
     p_delete(&(*msg)->path);
   }
@@ -1364,9 +1355,6 @@ int mx_acl_check (CONTEXT* ctx, int flag) {
 }
 
 void mx_init (void) {
-#ifdef DEBUG
-  int i = 0;
-#endif
   list_push_back (&MailboxFormats, (void*) mbox_reg_mx ());
   list_push_back (&MailboxFormats, (void*) mmdf_reg_mx ());
   list_push_back (&MailboxFormats, (void*) mh_reg_mx ());
@@ -1377,17 +1365,6 @@ void mx_init (void) {
   list_push_back (&MailboxFormats, (void*) nntp_reg_mx ());
 #endif
   list_push_back (&MailboxFormats, (void*) compress_reg_mx ());
-#ifdef DEBUG
-  /* check module registration for completeness with debug versions */
-#define EXITWITHERR(m) do { fprintf(stderr, "error: incomplete mx module: %s is missing for type %i\n",m,i);exit(1); } while (0)
-  for (i = 0; i < MailboxFormats->length; i++) {
-    if (MX_COMMAND(i,type) < 1)         EXITWITHERR("type");
-    if (!MX_COMMAND(i,mx_is_magic))     EXITWITHERR("mx_is_magic");
-    if (!MX_COMMAND(i,mx_open_mailbox)) EXITWITHERR("mx_open_mailbox");
-/*    if (!MX_COMMAND(i,mx_sync_mailbox)) EXITWITHERR("mx_sync_mailbox");*/
-  }
-#undef EXITWITHERR
-#endif /* DEBUG */
 }
 
 int mx_rebuild_cache (void) {
index e9709f7..4d45c0d 100644 (file)
@@ -24,7 +24,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/file.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -126,7 +125,6 @@ static int nntp_parse_newsrc_line (NNTP_SERVER * news, char *line)
     data->lastMessage = data->entries[x - 1].last;
   data->num = x;
   mutt_newsgroup_stat (data);
-  debug_print (2, ("Newsgroup %s\n", data->group));
 
   return 0;
 }
@@ -437,10 +435,6 @@ void nntp_get_status (CONTEXT * ctx, HEADER * h, char *group, int article)
     data = (NNTP_DATA *) hash_find (data->nserv->newsgroups, group);
 
   if (!data) {
-#ifdef DEBUG
-    if (group)
-      debug_print (3, ("newsgroup %s not found\n", group));
-#endif
     return;
   }
 
@@ -640,7 +634,6 @@ static int mutt_update_list_file (char *filename, char *section,
   /* if file not exist, create it */
   if ((ifp = safe_fopen (filename, "a")))
     fclose (ifp);
-  debug_print (1, ("Opening %s\n", filename));
   if (!(ifp = safe_fopen (filename, "r"))) {
     mutt_error (_("Unable to open %s for reading"), filename);
     return -1;
@@ -658,7 +651,6 @@ static int mutt_update_list_file (char *filename, char *section,
   m_strcpy(buf, sizeof(buf), filename);
   m_strcpy(tmpfile, sizeof(tmpfile), basename(filename));
   mutt_adv_mktemp ((const char*) dirname (buf), tmpfile, sizeof (tmpfile));
-  debug_print (1, ("Opening %s\n", tmpfile));
   if (!(ofp = fopen (tmpfile, "w"))) {
     fclose (ifp);
     mutt_error (_("Unable to open %s for writing"), tmpfile);
@@ -732,7 +724,6 @@ static int mutt_update_list_file (char *filename, char *section,
   link[0] = '\0';
   if ((l = readlink (filename, link, sizeof (link)-1)) > 0)
     link[l] = '\0';
-  debug_print (1, ("Renaming %s to %s\n",tmpfile, l > 0 ? link : filename));
   if (rename (tmpfile, l > 0 ? link : filename) < 0) {
     unlink (tmpfile);
     mutt_error (_("Can't rename %s to %s"), tmpfile, l > 0 ? link : filename);
@@ -759,7 +750,6 @@ int mutt_newsrc_update (NNTP_SERVER * news)
     if (!data || !data->rc)
       continue;
     nntp_create_newsrc_line (data, &buf, &line, &llen);
-    debug_print (2, ("Added to newsrc: %s\n", line));
     line += m_strlen(line);
   }
   /* newrc being fully rewritten */
@@ -831,7 +821,6 @@ void nntp_clear_cacheindex (NNTP_SERVER * news)
     if (!data || data->subscribed || !data->cache)
       continue;
     nntp_delete_cache (data);
-    debug_print (2, ("Removed from .index: %s\n", data->group));
   }
   return;
 }
index 7eae011..aa9d915 100644 (file)
@@ -17,7 +17,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/file.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -83,10 +82,6 @@ void nntp_sync_sidebar (NNTP_DATA* data) {
   tmp->msgcount = data->lastMessage - data->firstMessage;
 }
 
-static void nntp_error (const char *where, const char *msg) {
-  debug_print (1, ("unexpected response in %s: %s\n", where, msg));
-}
-
 static int nntp_auth (NNTP_SERVER * serv)
 {
   CONNECTION *conn = serv->conn;
@@ -108,11 +103,6 @@ static int nntp_auth (NNTP_SERVER * serv)
     return -1;
   }
 
-#ifdef DEBUG
-  /* don't print the password unless we're at the ungodly debugging level */
-  if (DebugLevel < M_SOCK_LOG_FULL)
-    debug_print (M_SOCK_LOG_CMD, ("> AUTHINFO PASS *\n"));
-#endif
   snprintf (buf, sizeof (buf), "AUTHINFO PASS %s\r\n", conn->account.pass);
   mutt_socket_write_d (conn, buf, M_SOCK_LOG_FULL);
   if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) {
@@ -475,8 +465,6 @@ static int nntp_read_header (CONTEXT * ctx, const char *msgid,
 
   ret = mutt_nntp_fetch (nntp_data, buf, NULL, NULL, nntp_read_tempfile, f, 0);
   if (ret) {
-    if (ret != -1)
-      debug_print (1, ("%s\n", buf));
     fclose (f);
     unlink (tempfile);
     return (ret == -1 ? -1 : 1);
@@ -512,7 +500,6 @@ static int parse_description (char *line, void *n)
   d++;
   while (*d && (*d == '\t' || *d == ' '))
     d++;
-  debug_print (2, ("group: %s, desc: %s\n", line, d));
   if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL &&
       m_strcmp(d, data->desc)) {
     p_delete(&data->desc);
@@ -536,9 +523,6 @@ static void nntp_get_desc (NNTP_DATA * data, const char *mask, char *msg, progre
     snprintf (buf, sizeof (buf), "string_list_t NEWSGROUPS %s\r\n", mask);
   if (mutt_nntp_fetch (data, buf, msg, bar, parse_description, data->nserv, 0) !=
       0) {
-#ifdef DEBUG
-    nntp_error ("nntp_get_desc()", buf);
-#endif
   }
 }
 
@@ -722,9 +706,6 @@ static int nntp_fetch_headers (CONTEXT * ctx, unsigned int first,
         0) {
       mutt_error (_("LISTGROUP command failed: %s"), buf);
       sleep (2);
-#ifdef DEBUG
-      nntp_error ("nntp_fetch_headers()", buf);
-#endif
       p_delete(&fc.messages);
       return -1;
     }
@@ -792,9 +773,6 @@ static int nntp_fetch_headers (CONTEXT * ctx, unsigned int first,
       mx_update_context (ctx, ctx->msgcount - oldmsgcount);
     if (ret != 0) {
       mutt_error (_("XOVER command failed: %s"), buf);
-#ifdef DEBUG
-      nntp_error ("nntp_fetch_headers()", buf);
-#endif
       p_delete(&fc.messages);
       return -1;
     }
@@ -886,9 +864,6 @@ int nntp_open_mailbox (CONTEXT * ctx)
 
   buf[0] = 0;
   if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
-#ifdef DEBUG
-    nntp_error ("nntp_open_mailbox()", buf);
-#endif
     return -1;
   }
 
@@ -980,7 +955,6 @@ int nntp_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
   if (ret == 1) {
     mutt_error (_("Article %d not found on server"),
                 ctx->hdrs[msgno]->article_num);
-    debug_print (1, ("%s\n", buf));
   }
 
   if (ret) {
@@ -1204,17 +1178,11 @@ static int _nntp_check_mailbox (CONTEXT * ctx, NNTP_DATA * nntp_data)
 
   buf[0] = 0;
   if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
-#ifdef DEBUG
-    nntp_error ("nntp_check_mailbox()", buf);
-#endif
     return -1;
   }
   if (m_strncmp("211", buf, 3)) {
     buf[0] = 0;
     if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
-#ifdef DEBUG
-      nntp_error ("nntp_check_mailbox()", buf);
-#endif
       return -1;
     }
   }
@@ -1355,9 +1323,6 @@ int nntp_check_newgroups (NNTP_SERVER * serv, int force)
   l = serv->tail;
   if (mutt_nntp_fetch (&nntp_data, buf, _("Adding new newsgroups..."), NULL,
                        add_group, serv, 0) != 0) {
-#ifdef DEBUG
-    nntp_error ("nntp_check_newgroups()", buf);
-#endif
     return -1;
   }
 
@@ -1426,9 +1391,6 @@ int nntp_get_active (NNTP_SERVER * serv)
   nntp_data.group = NULL;
 
   if (mutt_nntp_fetch (&nntp_data, "string_list_t\r\n", msg, NULL, add_group, serv, 0) < 0) {
-#ifdef DEBUG
-    nntp_error ("nntp_get_active()", "string_list_t\r\n");
-#endif
     return -1;
   }
 
diff --git a/pager.c b/pager.c
index 6b99c6e..ea3ec2b 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -28,7 +28,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
 #include <lib-lib/rx.h>
 
 #include <lib-ui/curses.h>
@@ -944,7 +943,6 @@ fill_buffer (FILE * f, off_t *last_pos, off_t offset, unsigned char *buf,
       }
       else if (*p == '\033' && *(p + 1) == ']'
                && check_attachment_marker ((char *) p) == 0) {
-        debug_print (2, ("seen attachment marker.\n"));
         while (*p++ != '\a')    /* skip pseudo-ANSI sequence */
           ;
       }
@@ -1003,7 +1001,6 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
 
     k = mbrtowc (&wc, (char *) buf + ch, cnt - ch, &mbstate);
     if (k == -2 || k == -1) {
-      debug_print (1, ("mbrtowc returned %d; errno = %d.\n", k, errno));
       if (col + 4 > wrap_cols)
         break;
       col += 4;
index 5f8933e..5fe55e4 100644 (file)
--- a/pop/pop.c
+++ b/pop/pop.c
@@ -18,7 +18,6 @@
 #include <lib-lib/file.h>
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include <lib-ui/curses.h>
 
@@ -73,14 +72,10 @@ static pop_query_status pop_read_header (POP_DATA * pop_data, HEADER * h)
     if (pop_data->cmd_top == CMD_UNKNOWN) {
       if (ret == PQ_OK) {
         pop_data->cmd_top = CMD_AVAILABLE;
-
-        debug_print (1, ("set TOP capability\n"));
       }
 
       if (ret == PQ_ERR) {
         pop_data->cmd_top = CMD_NOT_AVAILABLE;
-
-        debug_print (1, ("unset TOP capability\n"));
         snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),
                   _("Command TOP is not supported by server."));
       }
@@ -136,8 +131,6 @@ static int fetch_uidl (char *line, void *data)
       break;
 
   if (i == ctx->msgcount) {
-    debug_print (1, ("new header %d %s\n", idx, line));
-
     if (i >= ctx->hdrmax)
       mx_alloc_memory (ctx);
 
@@ -182,14 +175,11 @@ static int pop_fetch_headers (CONTEXT * ctx)
   if (pop_data->cmd_uidl == CMD_UNKNOWN) {
     if (ret == PQ_OK) {
       pop_data->cmd_uidl = CMD_AVAILABLE;
-
-      debug_print (1, ("set UIDL capability\n"));
     }
 
     if (ret == PQ_ERR && pop_data->cmd_uidl == CMD_UNKNOWN) {
       pop_data->cmd_uidl = CMD_NOT_AVAILABLE;
 
-      debug_print (1, ("unset UIDL capability\n"));
       snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),
                 _("Command UIDL is not supported by server."));
     }
@@ -288,8 +278,6 @@ static void pop_clear_cache (POP_DATA * pop_data)
   if (!pop_data->clear_cache)
     return;
 
-  debug_print (1, ("delete cached messages\n"));
-
   for (i = 0; i < POP_CACHE_LEN; i++) {
     if (pop_data->cache[i].path) {
       unlink (pop_data->cache[i].path);
index eb575bf..5cb2519 100644 (file)
@@ -15,7 +15,6 @@
 #include <lib-lib/ascii.h>
 #include <lib-lib/macros.h>
 #include <lib-hash/hash.h>
-#include <lib-lib/debug.h>
 
 #include "mutt.h"
 #include "mx.h"
@@ -49,7 +48,6 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method)
   unsigned char client_start;
 
   if (mutt_sasl_client_new (pop_data->conn, &saslconn) < 0) {
-    debug_print (1, ("Error allocating SASL connection.\n"));
     return POP_A_FAILURE;
   }
 
@@ -67,8 +65,6 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method)
   }
 
   if (rc != SASL_OK && rc != SASL_CONTINUE) {
-    debug_print (1, ("Failure starting authentication exchange. No shared mechanisms?\n"));
-
     /* SASL doesn't support suggested mechanisms, so fall back */
     return POP_A_UNAVAIL;
   }
@@ -99,7 +95,6 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method)
                           &len) != SASL_OK)
 #endif
     {
-      debug_print (1, ("error base64-decoding server response.\n"));
       goto bail;
     }
 
@@ -119,7 +114,6 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method)
     /* send out response, or line break if none needed */
     if (pc) {
       if (sasl_encode64 (pc, olen, buf, sizeof (buf), &olen) != SASL_OK) {
-        debug_print (1, ("error base64-encoding client response.\n"));
         goto bail;
       }
 
@@ -235,14 +229,11 @@ static pop_auth_res_t pop_auth_user (POP_DATA * pop_data,
   if (pop_data->cmd_user == CMD_UNKNOWN) {
     if (ret == PQ_OK) {
       pop_data->cmd_user = CMD_AVAILABLE;
-
-      debug_print (1, ("set USER capability\n"));
     }
 
     if (ret == PQ_ERR) {
       pop_data->cmd_user = CMD_NOT_AVAILABLE;
 
-      debug_print (1, ("unset USER capability\n"));
       snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),
                 _("Command USER is not supported by server."));
     }
@@ -250,12 +241,7 @@ static pop_auth_res_t pop_auth_user (POP_DATA * pop_data,
 
   if (ret == PQ_OK) {
     snprintf (buf, sizeof (buf), "PASS %s\r\n", pop_data->conn->account.pass);
-    ret = pop_query_d (pop_data, buf, sizeof (buf),
-#ifdef DEBUG
-    /* don't print the password unless we're at the ungodly debugging level */
-    DebugLevel < M_SOCK_LOG_FULL ? "PASS *\r\n" :
-#endif
-    NULL);
+    ret = pop_query_d (pop_data, buf, sizeof (buf), NULL);
   }
 
   switch (ret) {
@@ -314,7 +300,6 @@ pop_query_status pop_authenticate (POP_DATA * pop_data)
       comma = strchr (method, ':');
       if (comma)
         *comma++ = '\0';
-      debug_print (2, ("Trying method %s\n", method));
       authenticator = pop_authenticators;
 
       while (authenticator->authenticate) {
@@ -350,7 +335,6 @@ pop_query_status pop_authenticate (POP_DATA * pop_data)
   }
   else {
     /* Fall back to default: any authenticator */
-    debug_print (2, ("Using any available method.\n"));
     authenticator = pop_authenticators;
 
     while (authenticator->authenticate) {
index 0052e5d..424ca73 100644 (file)
@@ -19,7 +19,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/ascii.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 #include <lib-lib/url.h>
 
 #include "mutt.h"
@@ -389,14 +388,6 @@ pop_query_status pop_query_d (POP_DATA * pop_data, char *buf, size_t buflen, con
   if (pop_data->status != POP_CONNECTED)
     return PQ_NOT_CONNECTED;
 
-#ifdef DEBUG
-  /* print msg instaed of real command */
-  if (msg) {
-    dbg = M_SOCK_LOG_FULL;
-    debug_print (M_SOCK_LOG_CMD, ("> %s", msg));
-  }
-#endif
-
   mutt_socket_write_d (pop_data->conn, buf, dbg);
 
   c = strpbrk (buf, " \r\n");
index b5193ec..4b91fe8 100644 (file)
@@ -23,7 +23,6 @@
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
 #include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -89,10 +88,7 @@ int mutt_num_postponed (int force)
       newpc = imap_mailbox_check (Postponed, 0);
       if (newpc >= 0) {
         PostCount = newpc;
-        debug_print (2, ("%d postponed IMAP messages found.\n", PostCount));
       }
-      else
-        debug_print (2, ("using old IMAP postponed count.\n"));
     }
     return PostCount;
   }
diff --git a/query.c b/query.c
index ce1f052..2a60afa 100644 (file)
--- a/query.c
+++ b/query.c
@@ -20,7 +20,6 @@
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
 #include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
 
 #include <lib-ui/menu.h>
 
@@ -89,7 +88,6 @@ static QUERY *run_query (char *s, int quiet)
   mutt_expand_file_fmt (cmd, sizeof (cmd), QueryCmd, s);
 
   if ((thepid = mutt_create_filter (cmd, NULL, &fp, NULL)) < 0) {
-    debug_print (1, ("unable to fork command: %s\n", cmd));
     return 0;
   }
   if (!quiet)
@@ -132,7 +130,6 @@ static QUERY *run_query (char *s, int quiet)
   p_delete(&buf);
   fclose (fp);
   if (mutt_wait_filter (thepid)) {
-    debug_print (1, ("Error: %s\n", msg));
     if (!quiet)
       mutt_error ("%s", msg);
   }
index bc954c7..bef1144 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -35,7 +35,6 @@
 #include <lib-lib/ascii.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-sys/unix.h>
 
@@ -193,7 +192,6 @@ static int rfc1524_mailcap_parse (BODY * a,
       /* ignore comments */
       if (*buf == '#')
         continue;
-      debug_print (2, ("mailcap entry: %s\n", buf));
 
       /* check type */
       ch = get_field (buf);
@@ -217,7 +215,6 @@ static int rfc1524_mailcap_parse (BODY * a,
       while (ch) {
         field = ch;
         ch = get_field (ch);
-        debug_print (2, ("field: %s\n", field));
 
         if (!ascii_strcasecmp (field, "needsterminal")) {
           if (entry)
@@ -381,7 +378,6 @@ int rfc1524_mailcap_lookup (BODY * a, char *type, rfc1524_entry * entry,
     path[x] = '\0';
     mutt_expand_path (path, sizeof (path));
 
-    debug_print (2, ("Checking mailcap file: %s\n", path));
     found = rfc1524_mailcap_parse (a, path, type, entry, opt);
   }
 
index d578190..51b6450 100644 (file)
--- a/rfc3676.c
+++ b/rfc3676.c
@@ -25,7 +25,6 @@
 #include <lib-lib/ascii.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-ui/curses.h>
 
@@ -89,35 +88,26 @@ static void print_flowed_line (char *line, STATE * s, int ql) {
      * the end of the string w/ pos */
     if (pos < line + len) {
       if (*pos == ' ') {
-        debug_print (4, ("f=f: found space directly at width\n"));
         *pos = '\0';
         ++pos;
       }
       else {
         char *save = pos;
-        debug_print (4, ("f=f: need to search for space\n"));
 
         while (pos >= oldpos && *pos != ' ') {
           --pos;
         }
         if (pos < oldpos) {
-          debug_print (4, ("f=f: no space found while searching "
-                           "to left; going right\n"));
           pos = save;
           while (pos < line + len && *pos && *pos != ' ') {
             ++pos;
           }
-          debug_print (4, ("f=f: found space at pos %d\n", pos-line));
-        } else {
-          debug_print (4, ("f=f: found space while searching to left\n"));
         }
         *pos = '\0';
         ++pos;
       }
     }
-    else {
-      debug_print (4, ("f=f: line completely fits on screen\n"));
-    }
+
     if (s->prefix)
       state_puts (s->prefix, s);
 
@@ -153,7 +143,6 @@ int rfc3676_handler (BODY * a, STATE * s) {
     t = NULL;
   }
 
-  debug_print (2, ("f=f: DelSp: %s\n", delsp ? "yes" : "no"));
 
   while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) {
 
@@ -229,11 +218,6 @@ int rfc3676_handler (BODY * a, STATE * s) {
 }
 
 void rfc3676_space_stuff (HEADER* hdr) {
-#if DEBUG
-  int lc = 0;
-  size_t len = 0;
-  unsigned char c = '\0';
-#endif
   FILE* in = NULL, *out = NULL;
   char buf[LONG_STRING];
   char tmpfile[_POSIX_PATH_MAX];
@@ -241,7 +225,6 @@ void rfc3676_space_stuff (HEADER* hdr) {
   if (!hdr || !hdr->content || !hdr->content->filename)
     return;
 
-  debug_print (2, ("f=f: postprocess %s\n", hdr->content->filename));
   if ((in = safe_fopen (hdr->content->filename, "r")) == NULL)
     return;
   mutt_mktemp (tmpfile);
@@ -253,18 +236,6 @@ void rfc3676_space_stuff (HEADER* hdr) {
   while (fgets (buf, sizeof (buf), in)) {
     if (ascii_strncmp ("From ", buf, 4) == 0 || buf[0] == ' ') {
       fputc (' ', out);
-#if DEBUG
-      lc++;
-      len = m_strlen(buf);
-      if (len > 0) {
-        c = buf[len-1];
-        buf[len-1] = '\0';
-      }
-      debug_print (4, ("f=f: line %d needs space-stuffing: '%s'\n",
-                       lc, buf));
-      if (len > 0)
-        buf[len-1] = c;
-#endif
     }
     fputs (buf, out);
   }
diff --git a/send.c b/send.c
index bbebca3..9d85a9e 100644 (file)
--- a/send.c
+++ b/send.c
@@ -28,7 +28,6 @@
 #include <lib-lib/ascii.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 #include <lib-lib/url.h>
 
 #include <lib-mime/mime.h>
@@ -1209,8 +1208,6 @@ int ci_send_message (int flags, /* send mode */
     }
 
     if (!tempfp) {
-      debug_print (1, ("can't create tempfile %s (errno=%d)\n", 
-                  msg->content->filename, errno));
       mutt_perror (msg->content->filename);
       goto cleanup;
     }
index 5b9b56f..63399e4 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -29,7 +29,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
-#include <lib-lib/debug.h>
 
 #include <lib-sys/exit.h>
 #include <lib-sys/mutt_signal.h>
@@ -379,7 +378,6 @@ int mutt_write_mime_body (BODY * a, FILE * f)
   if (a->type == TYPEMULTIPART) {
     /* First, find the boundary to use */
     if (!(p = mutt_get_parameter ("boundary", a->parameter))) {
-      debug_print (1, ("no boundary parameter found!\n"));
       mutt_error _("No boundary parameter found! [report this error]");
 
       return (-1);
@@ -405,7 +403,6 @@ int mutt_write_mime_body (BODY * a, FILE * f)
   }
 
   if ((fpin = fopen (a->filename, "r")) == NULL) {
-    debug_print (1, ("%s no longer exists!\n", a->filename));
     mutt_error (_("%s no longer exists!"), a->filename);
     return -1;
   }
@@ -815,7 +812,6 @@ CONTENT *mutt_get_content_info (const char *fname, BODY * b)
   }
 
   if ((fp = fopen (fname, "r")) == NULL) {
-    debug_print (1, ("%s: %s (errno %d).\n", fname, strerror (errno), errno));
     return (NULL);
   }
 
@@ -899,7 +895,6 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
       m_strcpy(buf, sizeof(buf), SYSCONFDIR "/mime.types");
       break;
     default:
-      debug_print (1, ("Internal error, count = %d.\n", count));
       goto bye;                 /* shouldn't happen */
     }
 
@@ -2292,8 +2287,6 @@ address_t *mutt_remove_duplicates (address_t * addr)
     }
 
     if (dup) {
-      debug_print (2, ("Removing %s\n", addr->mailbox));
-
       *last = addr->next;
 
       addr->next = NULL;
@@ -2337,7 +2330,6 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid,
     set_noconv_flags (hdr->content, 1);
 
   if (mx_open_mailbox (path, M_APPEND | M_QUIET, &f) == NULL) {
-    debug_print (1, ("unable to open mailbox %s in append-mode, aborting.\n", path));
     return (-1);
   }
 
@@ -2450,7 +2442,6 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid,
 
     fflush (tempfp);
     if (ferror (tempfp)) {
-      debug_print (1, ("%s: write failed.\n", tempfile));
       fclose (tempfp);
       unlink (tempfile);
       mx_commit_message (msg, &f);      /* XXX - really? */
diff --git a/state.c b/state.c
index f5642af..12f3e99 100644 (file)
--- a/state.c
+++ b/state.c
@@ -14,8 +14,6 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-#include <lib-lib/debug.h>
-
 #include "mutt.h"
 #include "state.h"
 #include "rfc3676.h"
@@ -78,9 +76,6 @@ void state_prefix_putc (char c, STATE * s)
       char buf[2 * SHORT_STRING];
       int j = 0, offset = 0;
       regmatch_t pmatch[1];
-#ifdef DEBUG
-      unsigned char save = '\0';
-#endif
 
       state_reset_prefix (s);
       while (regexec
@@ -102,15 +97,6 @@ void state_prefix_putc (char c, STATE * s)
       else
         snprintf (buf, sizeof (buf), "%s%s", NONULL (s->prefix), Quotebuf);
 
-#ifdef DEBUG
-      if (m_strlen(buf) >= 2) {
-        save = buf[m_strlen(buf) - 1];
-        buf[m_strlen(buf) - 1] = '\0';
-        debug_print (2, ("buf = '%s'\n", buf));
-        buf[m_strlen(buf)] = save;
-      }
-#endif
-
       state_puts (buf, s);
     }
   }