From: pdmef Date: Thu, 11 Aug 2005 12:13:13 +0000 (+0000) Subject: Rocco Rutte: X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=bbc4fd52516a8afefbd14c77e34f8389d6f0a6ed Rocco Rutte: - correct some more locations of prototype defs git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@388 e385b8ad-14ed-0310-8656-cc95a2468c6d --- diff --git a/Makefile.am b/Makefile.am index 71d7cc4..2ab3042 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,7 +38,7 @@ muttng_SOURCES = $(BUILT_SOURCES) \ handler.c hash.c hcache.c hdrline.c headers.c help.c history.c hook.c \ init.c \ keymap.c \ - lib.c \ + lib.c list.c \ main.c mbox.c mbyte.c md5c.c menu.c mh.c muttlib.c mutt_idna.c mx.c \ pager.c parse.c pattern.c postpone.c \ query.c \ @@ -83,6 +83,7 @@ EXTRA_muttng_SOURCES = \ alias.h \ buffer.h browser.h \ enter.h \ + list.h \ mbyte.h remailer.h url.h state.h \ pgppacket.c mutt_idna.h mutt_libesmtp.c \ crypt-mod-pgp-classic.c crypt-mod-smime-classic.c \ @@ -90,11 +91,12 @@ EXTRA_muttng_SOURCES = \ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \ configure acconfig.h \ - account.h alias.h attach.h \ + account.h alias.h attach.h recvattach.h handler.h thread.h \ buffer.h buffy.h \ charset.h compress.h copy.h crypthash.h \ dotlock.h functions.h gen_defs \ - enter.h \ + enter.h recvattach.h handler.h thread.h \ + list.h \ globals.h hash.h history.h init.h keymap.h mutt_crypt.h \ mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \ mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \ diff --git a/account.c b/account.c index 7006935..7c8fa3c 100644 --- a/account.c +++ b/account.c @@ -14,6 +14,8 @@ #endif #include "mutt.h" +#include "enter.h" +#include "ascii.h" #include "account.h" #include "url.h" diff --git a/alias.c b/alias.c index beb6ad2..65fa634 100644 --- a/alias.c +++ b/alias.c @@ -21,6 +21,8 @@ #include "lib/debug.h" #include "mutt.h" +#include "enter.h" +#include "ascii.h" #include "mutt_curses.h" #include "mutt_idna.h" #include "mutt_menu.h" diff --git a/attach.c b/attach.c index 33eacb1..4e985c1 100644 --- a/attach.c +++ b/attach.c @@ -13,6 +13,9 @@ #endif #include "mutt.h" +#include "ascii.h" +#include "handler.h" +#include "recvattach.h" #include "mutt_menu.h" #include "mutt_curses.h" #include "keymap.h" diff --git a/attach.h b/attach.h index 3bc1b82..f34816a 100644 --- a/attach.h +++ b/attach.h @@ -9,8 +9,6 @@ #ifndef _MUTT_ATTACH_H #define _MUTT_ATTACH_H -#include "mutt_menu.h" - typedef struct attachptr { BODY *content; int parent_type; @@ -20,27 +18,11 @@ typedef struct attachptr { unsigned int unowned:1; /* don't unlink on detach */ } ATTACHPTR; -int mutt_tag_attach (MUTTMENU * menu, int n, int m); -int mutt_attach_display_loop (MUTTMENU * menu, int op, FILE * fp, - HEADER * hdr, BODY * cur, ATTACHPTR *** idxp, - short *idxlen, short *idxmax, int recv); - - -void mutt_save_attachment_list (FILE * fp, int tag, BODY * top, HEADER * hdr, - MUTTMENU * menu); -void mutt_pipe_attachment_list (FILE * fp, int tag, BODY * top, int filter); -void mutt_print_attachment_list (FILE * fp, int tag, BODY * top); - void mutt_attach_bounce (FILE *, HEADER *, ATTACHPTR **, short, BODY *); void mutt_attach_resend (FILE *, HEADER *, ATTACHPTR **, short, BODY *); void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int); void mutt_attach_reply (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int); -ATTACHPTR **mutt_gen_attach_list (BODY *, int, ATTACHPTR **, short *, short *, - int, int); - -void mutt_update_tree (ATTACHPTR **, short); - int mutt_print_attachment (FILE *, BODY *); int mutt_decode_save_attachment (FILE *, BODY *, char *, int, int); int mutt_save_attachment (FILE *, BODY *, char *, int, HEADER *); diff --git a/browser.c b/browser.c index 3ed8a11..585dc1b 100644 --- a/browser.c +++ b/browser.c @@ -12,6 +12,7 @@ #endif #include "mutt.h" +#include "enter.h" #include "mx.h" #include "mutt_curses.h" #include "mutt_menu.h" diff --git a/buffer.c b/buffer.c index adbc8f6..e8c638f 100644 --- a/buffer.c +++ b/buffer.c @@ -12,11 +12,13 @@ #include #include +#include #include "buffer.h" #include "lib/mem.h" #include "lib/str.h" +#include "lib/debug.h" /* * Creates and initializes a BUFFER*. If passed an existing BUFFER*, @@ -96,3 +98,174 @@ void mutt_buffer_add (BUFFER * buf, const char *s, size_t len) buf->dptr += len; *(buf->dptr) = '\0'; } + +int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags) +{ + char ch; + char qc = 0; /* quote char */ + char *pc; + + /* reset the destination pointer to the beginning of the buffer */ + dest->dptr = dest->data; + + SKIPWS (tok->dptr); + while ((ch = *tok->dptr)) { + if (!qc) { + if ((ISSPACE (ch) && !(flags & M_TOKEN_SPACE)) || + (ch == '#' && !(flags & M_TOKEN_COMMENT)) || + (ch == '=' && (flags & M_TOKEN_EQUAL)) || + (ch == ';' && !(flags & M_TOKEN_SEMICOLON)) || + ((flags & M_TOKEN_PATTERN) && strchr ("~!|", ch))) + break; + } + + tok->dptr++; + + if (ch == qc) + qc = 0; /* end of quote */ + else if (!qc && (ch == '\'' || ch == '"') && !(flags & M_TOKEN_QUOTE)) + qc = ch; + else if (ch == '\\' && qc != '\'') { + if (!*tok->dptr) + return -1; /* premature end of token */ + switch (ch = *tok->dptr++) { + case 'c': + case 'C': + if (!*tok->dptr) + return -1; /* premature end of token */ + mutt_buffer_addch (dest, (toupper ((unsigned char) *tok->dptr) + - '@') & 0x7f); + tok->dptr++; + break; + case 'r': + mutt_buffer_addch (dest, '\r'); + break; + case 'n': + mutt_buffer_addch (dest, '\n'); + break; + case 't': + mutt_buffer_addch (dest, '\t'); + break; + case 'f': + mutt_buffer_addch (dest, '\f'); + break; + case 'e': + mutt_buffer_addch (dest, '\033'); + break; + default: + if (isdigit ((unsigned char) ch) && + isdigit ((unsigned char) *tok->dptr) && + isdigit ((unsigned char) *(tok->dptr + 1))) { + + mutt_buffer_addch (dest, + (ch << 6) + (*tok->dptr << 3) + *(tok->dptr + + 1) - 3504); + tok->dptr += 2; + } + else + mutt_buffer_addch (dest, ch); + } + } + else if (ch == '^' && (flags & M_TOKEN_CONDENSE)) { + if (!*tok->dptr) + return -1; /* premature end of token */ + ch = *tok->dptr++; + if (ch == '^') + mutt_buffer_addch (dest, ch); + else if (ch == '[') + mutt_buffer_addch (dest, '\033'); + else if (isalpha ((unsigned char) ch)) + mutt_buffer_addch (dest, toupper ((unsigned char) ch) - '@'); + else { + mutt_buffer_addch (dest, '^'); + mutt_buffer_addch (dest, ch); + } + } + else if (ch == '`' && (!qc || qc == '"')) { + FILE *fp; + pid_t pid; + char *cmd, *ptr; + size_t expnlen; + BUFFER expn; + int line = 0; + + pc = tok->dptr; + do { + if ((pc = strpbrk (pc, "\\`"))) { + /* skip any quoted chars */ + if (*pc == '\\') + pc += 2; + } + } while (pc && *pc != '`'); + if (!pc) { + debug_print (1, ("mismatched backtics\n")); + return (-1); + } + cmd = str_substrdup (tok->dptr, pc); + if ((pid = mutt_create_filter (cmd, NULL, &fp, NULL)) < 0) { + debug_print (1, ("unable to fork command: %s\n", cmd)); + mem_free (&cmd); + return (-1); + } + mem_free (&cmd); + + tok->dptr = pc + 1; + + /* read line */ + memset (&expn, 0, sizeof (expn)); + expn.data = mutt_read_line (NULL, &expn.dsize, fp, &line); + fclose (fp); + mutt_wait_filter (pid); + + /* if we got output, make a new string consiting of the shell ouptput + plus whatever else was left on the original line */ + /* BUT: If this is inside a quoted string, directly add output to + * the token */ + if (expn.data && qc) { + mutt_buffer_addstr (dest, expn.data); + mem_free (&expn.data); + } + else if (expn.data) { + expnlen = str_len (expn.data); + tok->dsize = expnlen + str_len (tok->dptr) + 1; + ptr = mem_malloc (tok->dsize); + memcpy (ptr, expn.data, expnlen); + strcpy (ptr + expnlen, tok->dptr); /* __STRCPY_CHECKED__ */ + if (tok->destroy) + mem_free (&tok->data); + tok->data = ptr; + tok->dptr = ptr; + tok->destroy = 1; /* mark that the caller should destroy this data */ + ptr = NULL; + mem_free (&expn.data); + } + } + else if (ch == '$' && (!qc || qc == '"') + && (*tok->dptr == '{' || isalpha ((unsigned char) *tok->dptr))) { + char *env = NULL, *var = NULL; + + if (*tok->dptr == '{') { + tok->dptr++; + if ((pc = strchr (tok->dptr, '}'))) { + var = str_substrdup (tok->dptr, pc); + tok->dptr = pc + 1; + } + } + else { + for (pc = tok->dptr; isalnum ((unsigned char) *pc) || *pc == '_'; + pc++); + var = str_substrdup (tok->dptr, pc); + tok->dptr = pc; + } + if (var && (env = getenv (var))) + mutt_buffer_addstr (dest, env); + mem_free (&var); + } + else + mutt_buffer_addch (dest, ch); + } + mutt_buffer_addch (dest, 0); /* terminate the string */ + SKIPWS (tok->dptr); + return 0; +} + diff --git a/buffy.c b/buffy.c index b468fd1..e259a11 100644 --- a/buffy.c +++ b/buffy.c @@ -16,6 +16,7 @@ #include "mutt.h" #include "buffy.h" +#include "buffer.h" #include "mx.h" #include "mh.h" #include "sidebar.h" diff --git a/charset.c b/charset.c index 0b2d979..de6c5c9 100644 --- a/charset.c +++ b/charset.c @@ -24,6 +24,7 @@ #include "mutt.h" #include "charset.h" +#include "ascii.h" #include "lib/mem.h" #include "lib/intl.h" diff --git a/color.c b/color.c index 8980b0b..5484bba 100644 --- a/color.c +++ b/color.c @@ -12,6 +12,8 @@ #endif #include "mutt.h" +#include "buffer.h" +#include "ascii.h" #include "mutt_curses.h" #include "mapping.h" diff --git a/commands.c b/commands.c index 20ed011..3bf5de5 100644 --- a/commands.c +++ b/commands.c @@ -13,6 +13,9 @@ #endif #include "mutt.h" +#include "enter.h" +#include "recvattach.h" +#include "ascii.h" #include "mutt_curses.h" #include "mutt_menu.h" #include "mime.h" diff --git a/compose.c b/compose.c index 0530751..4e283b0 100644 --- a/compose.c +++ b/compose.c @@ -16,12 +16,14 @@ #endif #include "mutt.h" +#include "enter.h" #include "mutt_curses.h" #include "mutt_idna.h" #include "mutt_menu.h" #include "rfc1524.h" #include "mime.h" #include "attach.h" +#include "recvattach.h" #include "mapping.h" #include "sort.h" #include "charset.h" diff --git a/copy.c b/copy.c index 567d0e4..3d4cc18 100644 --- a/copy.c +++ b/copy.c @@ -12,6 +12,8 @@ #endif #include "mutt.h" +#include "ascii.h" +#include "handler.h" #include "mx.h" #include "copy.h" #include "rfc2047.h" diff --git a/crypt.c b/crypt.c index 9d175d9..d60e184 100644 --- a/crypt.c +++ b/crypt.c @@ -17,6 +17,8 @@ #endif #include "mutt.h" +#include "ascii.h" +#include "handler.h" #include "mutt_curses.h" #include "mime.h" #include "copy.h" diff --git a/curs_lib.c b/curs_lib.c index b9c4557..afd34b6 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -16,6 +16,7 @@ #endif #include "mutt.h" +#include "enter.h" #include "mutt_menu.h" #include "mutt_curses.h" #include "pager.h" diff --git a/curs_main.c b/curs_main.c index cb39d66..8469724 100644 --- a/curs_main.c +++ b/curs_main.c @@ -20,9 +20,11 @@ #include "mutt_menu.h" #include "mapping.h" #include "sort.h" +#include "recvattach.h" #include "buffy.h" #include "mx.h" #include "sidebar.h" +#include "thread.h" #include "xterm.h" #ifdef USE_POP diff --git a/edit.c b/edit.c index 88eeca3..d9a667a 100644 --- a/edit.c +++ b/edit.c @@ -14,6 +14,8 @@ #endif #include "mutt.h" +#include "ascii.h" +#include "enter.h" #include "mutt_curses.h" #include "mutt_idna.h" diff --git a/enter.c b/enter.c index 2f7a0f3..7cd96dc 100644 --- a/enter.c +++ b/enter.c @@ -13,6 +13,7 @@ #endif #include "mutt.h" +#include "enter.h" #include "mutt_menu.h" #include "mutt_curses.h" #include "keymap.h" diff --git a/globals.h b/globals.h index e5df1df..0626062 100644 --- a/globals.h +++ b/globals.h @@ -9,6 +9,8 @@ #ifndef _GLOBALS_H #define _GLOBALS_H +#include "alias.h" + #include "lib/str.h" #include "lib/list.h" #include "lib/rx.h" diff --git a/handler.c b/handler.c index 2eb2dc1..a39bc0c 100644 --- a/handler.c +++ b/handler.c @@ -19,6 +19,9 @@ #include #include "mutt.h" +#include "ascii.h" +#include "recvattach.h" +#include "handler.h" #include "mutt_curses.h" #include "rfc1524.h" #include "keymap.h" diff --git a/handler.h b/handler.h new file mode 100644 index 0000000..b75d83b --- /dev/null +++ b/handler.h @@ -0,0 +1,18 @@ +/* + * Copyright notice from original mutt: + * Copyright (C) 1996-2000 Michael R. Elkins + * + * 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. + */ +#ifndef _MUTT_HANDLER_H +#define _MUTT_HANDLER_H + +#include "state.h" + +void mutt_body_handler (BODY *, STATE *); +void mutt_decode_attachment (BODY *, STATE *); +void mutt_decode_base64 (STATE * s, long len, int istext, iconv_t cd); + +#endif /* !_MUTT_HANDLER_H */ diff --git a/hdrline.c b/hdrline.c index d6135b3..0bfadd9 100644 --- a/hdrline.c +++ b/hdrline.c @@ -14,6 +14,7 @@ #include "mutt.h" #include "mutt_curses.h" #include "sort.h" +#include "thread.h" #include "charset.h" #include "mutt_crypt.h" #include "mutt_idna.h" diff --git a/headers.c b/headers.c index 7348adf..e5a1540 100644 --- a/headers.c +++ b/headers.c @@ -12,6 +12,7 @@ #endif #include "mutt.h" +#include "ascii.h" #include "mutt_crypt.h" #include "mutt_idna.h" diff --git a/hook.c b/hook.c index a87dac9..2f9345d 100644 --- a/hook.c +++ b/hook.c @@ -12,6 +12,7 @@ #endif #include "mutt.h" +#include "buffer.h" #include "mx.h" #include "mutt_crypt.h" diff --git a/imap/auth.c b/imap/auth.c index 6ec3c1b..23473e1 100644 --- a/imap/auth.c +++ b/imap/auth.c @@ -20,6 +20,7 @@ #include "lib/debug.h" #include "mutt.h" +#include "ascii.h" #include "imap_private.h" #include "auth.h" diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index e0fbfba..9230a87 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -14,6 +14,7 @@ #endif #include "mutt.h" +#include "ascii.h" #include "mutt_sasl.h" #include "imap_private.h" #include "auth.h" diff --git a/imap/browse.c b/imap/browse.c index 1410829..fd9c473 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -23,6 +23,8 @@ #include "lib/debug.h" #include "mutt.h" +#include "ascii.h" +#include "enter.h" #include "imap_private.h" /* -- forward declarations -- */ diff --git a/imap/command.c b/imap/command.c index 989bd67..45d6ba3 100644 --- a/imap/command.c +++ b/imap/command.c @@ -16,15 +16,16 @@ # include "config.h" #endif -#include "mutt.h" -#include "imap_private.h" -#include "message.h" -#include "mx.h" - #include "lib/mem.h" #include "lib/intl.h" #include "lib/debug.h" +#include "mutt.h" +#include "message.h" +#include "mx.h" +#include "ascii.h" +#include "imap_private.h" + #include #include diff --git a/imap/imap.c b/imap/imap.c index 23269b1..06e14ed 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -16,6 +16,8 @@ #endif #include "mutt.h" +#include "ascii.h" +#include "buffer.h" #include "mutt_curses.h" #include "mx.h" #include "globals.h" diff --git a/imap/message.c b/imap/message.c index e4e7361..3653c53 100644 --- a/imap/message.c +++ b/imap/message.c @@ -18,6 +18,8 @@ #include #include "mutt.h" +#include "ascii.h" +#include "buffer.h" #include "mutt_curses.h" #include "imap_private.h" #include "message.h" diff --git a/imap/util.c b/imap/util.c index ecf5d53..e60cd8c 100644 --- a/imap/util.c +++ b/imap/util.c @@ -15,6 +15,7 @@ #include "mutt.h" #include "mx.h" /* for M_IMAP */ +#include "ascii.h" #include "url.h" #include "imap_private.h" #include "mutt_ssl.h" diff --git a/init.c b/init.c index 0a0d9ab..76bb085 100644 --- a/init.c +++ b/init.c @@ -12,6 +12,8 @@ #endif #include "mutt.h" +#include "buffer.h" +#include "ascii.h" #include "mapping.h" #include "mutt_curses.h" #include "history.h" @@ -133,176 +135,6 @@ int mutt_option_index (char *s) return (-1); } -int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags) -{ - char ch; - char qc = 0; /* quote char */ - char *pc; - - /* reset the destination pointer to the beginning of the buffer */ - dest->dptr = dest->data; - - SKIPWS (tok->dptr); - while ((ch = *tok->dptr)) { - if (!qc) { - if ((ISSPACE (ch) && !(flags & M_TOKEN_SPACE)) || - (ch == '#' && !(flags & M_TOKEN_COMMENT)) || - (ch == '=' && (flags & M_TOKEN_EQUAL)) || - (ch == ';' && !(flags & M_TOKEN_SEMICOLON)) || - ((flags & M_TOKEN_PATTERN) && strchr ("~!|", ch))) - break; - } - - tok->dptr++; - - if (ch == qc) - qc = 0; /* end of quote */ - else if (!qc && (ch == '\'' || ch == '"') && !(flags & M_TOKEN_QUOTE)) - qc = ch; - else if (ch == '\\' && qc != '\'') { - if (!*tok->dptr) - return -1; /* premature end of token */ - switch (ch = *tok->dptr++) { - case 'c': - case 'C': - if (!*tok->dptr) - return -1; /* premature end of token */ - mutt_buffer_addch (dest, (toupper ((unsigned char) *tok->dptr) - - '@') & 0x7f); - tok->dptr++; - break; - case 'r': - mutt_buffer_addch (dest, '\r'); - break; - case 'n': - mutt_buffer_addch (dest, '\n'); - break; - case 't': - mutt_buffer_addch (dest, '\t'); - break; - case 'f': - mutt_buffer_addch (dest, '\f'); - break; - case 'e': - mutt_buffer_addch (dest, '\033'); - break; - default: - if (isdigit ((unsigned char) ch) && - isdigit ((unsigned char) *tok->dptr) && - isdigit ((unsigned char) *(tok->dptr + 1))) { - - mutt_buffer_addch (dest, - (ch << 6) + (*tok->dptr << 3) + *(tok->dptr + - 1) - 3504); - tok->dptr += 2; - } - else - mutt_buffer_addch (dest, ch); - } - } - else if (ch == '^' && (flags & M_TOKEN_CONDENSE)) { - if (!*tok->dptr) - return -1; /* premature end of token */ - ch = *tok->dptr++; - if (ch == '^') - mutt_buffer_addch (dest, ch); - else if (ch == '[') - mutt_buffer_addch (dest, '\033'); - else if (isalpha ((unsigned char) ch)) - mutt_buffer_addch (dest, toupper ((unsigned char) ch) - '@'); - else { - mutt_buffer_addch (dest, '^'); - mutt_buffer_addch (dest, ch); - } - } - else if (ch == '`' && (!qc || qc == '"')) { - FILE *fp; - pid_t pid; - char *cmd, *ptr; - size_t expnlen; - BUFFER expn; - int line = 0; - - pc = tok->dptr; - do { - if ((pc = strpbrk (pc, "\\`"))) { - /* skip any quoted chars */ - if (*pc == '\\') - pc += 2; - } - } while (pc && *pc != '`'); - if (!pc) { - debug_print (1, ("mismatched backtics\n")); - return (-1); - } - cmd = str_substrdup (tok->dptr, pc); - if ((pid = mutt_create_filter (cmd, NULL, &fp, NULL)) < 0) { - debug_print (1, ("unable to fork command: %s\n", cmd)); - mem_free (&cmd); - return (-1); - } - mem_free (&cmd); - - tok->dptr = pc + 1; - - /* read line */ - memset (&expn, 0, sizeof (expn)); - expn.data = mutt_read_line (NULL, &expn.dsize, fp, &line); - fclose (fp); - mutt_wait_filter (pid); - - /* if we got output, make a new string consiting of the shell ouptput - plus whatever else was left on the original line */ - /* BUT: If this is inside a quoted string, directly add output to - * the token */ - if (expn.data && qc) { - mutt_buffer_addstr (dest, expn.data); - mem_free (&expn.data); - } - else if (expn.data) { - expnlen = str_len (expn.data); - tok->dsize = expnlen + str_len (tok->dptr) + 1; - ptr = mem_malloc (tok->dsize); - memcpy (ptr, expn.data, expnlen); - strcpy (ptr + expnlen, tok->dptr); /* __STRCPY_CHECKED__ */ - if (tok->destroy) - mem_free (&tok->data); - tok->data = ptr; - tok->dptr = ptr; - tok->destroy = 1; /* mark that the caller should destroy this data */ - ptr = NULL; - mem_free (&expn.data); - } - } - else if (ch == '$' && (!qc || qc == '"') - && (*tok->dptr == '{' || isalpha ((unsigned char) *tok->dptr))) { - char *env = NULL, *var = NULL; - - if (*tok->dptr == '{') { - tok->dptr++; - if ((pc = strchr (tok->dptr, '}'))) { - var = str_substrdup (tok->dptr, pc); - tok->dptr = pc + 1; - } - } - else { - for (pc = tok->dptr; isalnum ((unsigned char) *pc) || *pc == '_'; - pc++); - var = str_substrdup (tok->dptr, pc); - tok->dptr = pc; - } - if (var && (env = getenv (var))) - mutt_buffer_addstr (dest, env); - mem_free (&var); - } - else - mutt_buffer_addch (dest, ch); - } - mutt_buffer_addch (dest, 0); /* terminate the string */ - SKIPWS (tok->dptr); - return 0; -} - static void add_to_list (LIST ** list, const char *str) { LIST *t, *last = NULL; diff --git a/keymap.c b/keymap.c index 9b501f2..61058f7 100644 --- a/keymap.c +++ b/keymap.c @@ -12,6 +12,8 @@ #endif #include "mutt.h" +#include "buffer.h" +#include "ascii.h" #include "mutt_menu.h" #include "mutt_curses.h" #include "keymap.h" diff --git a/mbox.c b/mbox.c index 75cc3cc..c18488d 100644 --- a/mbox.c +++ b/mbox.c @@ -18,6 +18,7 @@ #include "buffy.h" #include "mbox.h" #include "sort.h" +#include "thread.h" #include "copy.h" #ifdef USE_COMPRESSED diff --git a/menu.c b/menu.c index c24a248..404dc79 100644 --- a/menu.c +++ b/menu.c @@ -12,6 +12,7 @@ #endif #include "mutt.h" +#include "enter.h" #include "mutt_curses.h" #include "mutt_menu.h" #include "mbyte.h" diff --git a/mh.c b/mh.c index 4b03ef8..ca13883 100644 --- a/mh.c +++ b/mh.c @@ -24,6 +24,7 @@ #include "copy.h" #include "buffy.h" #include "sort.h" +#include "thread.h" #include "hcache.h" #include "lib/mem.h" diff --git a/mutt.h b/mutt.h index 226eda0..21d5652 100644 --- a/mutt.h +++ b/mutt.h @@ -827,11 +827,6 @@ typedef struct { unsigned int counting:1; /* do we just want to cound? */ } CONTEXT; -#include "ascii.h" -#include "alias.h" -#include "buffer.h" -#include "state.h" -#include "enter.h" #include "protos.h" #include "lib.h" #include "globals.h" diff --git a/mutt_crypt.h b/mutt_crypt.h index 182d52d..ca9acd6 100644 --- a/mutt_crypt.h +++ b/mutt_crypt.h @@ -17,6 +17,8 @@ #define MUTT_CRYPT_H #include "mutt.h" /* Need this to declare BODY, ADDRESS. STATE etc. */ +#include "state.h" + /* FIXME: They should be pointer to anonymous structures for better information hiding. */ diff --git a/mutt_idna.c b/mutt_idna.c index 82796c8..fd292f3 100644 --- a/mutt_idna.c +++ b/mutt_idna.c @@ -12,6 +12,7 @@ #endif #include "mutt.h" +#include "ascii.h" #include "charset.h" #include "mutt_idna.h" diff --git a/muttlib.c b/muttlib.c index 723043a..21ff1e4 100644 --- a/muttlib.c +++ b/muttlib.c @@ -13,6 +13,9 @@ #endif #include "mutt.h" +#include "ascii.h" +#include "buffer.h" +#include "enter.h" #include "mutt_curses.h" #include "mime.h" #include "mx.h" diff --git a/mx.c b/mx.c index 6cc2a3b..fc2a908 100644 --- a/mx.c +++ b/mx.c @@ -13,11 +13,13 @@ #endif #include "mutt.h" +#include "ascii.h" #include "mx.h" #include "mbox.h" #include "mh.h" #include "rfc2047.h" #include "sort.h" +#include "thread.h" #include "copy.h" #include "keymap.h" #include "url.h" diff --git a/pager.c b/pager.c index ecb430d..50c4cd6 100644 --- a/pager.c +++ b/pager.c @@ -16,6 +16,7 @@ #endif #include "mutt.h" +#include "enter.h" #include "mutt_curses.h" #include "keymap.h" #include "mutt_menu.h" @@ -23,6 +24,7 @@ #include "sort.h" #include "pager.h" #include "attach.h" +#include "recvattach.h" #include "mbyte.h" #include "sidebar.h" #include "buffy.h" diff --git a/parse.c b/parse.c index bd0772a..a009063 100644 --- a/parse.c +++ b/parse.c @@ -12,6 +12,10 @@ #endif #include "mutt.h" +#include "buffer.h" +#include "enter.h" +#include "ascii.h" +#include "recvattach.h" #include "mx.h" #include "mime.h" #include "rfc2047.h" diff --git a/pattern.c b/pattern.c index f804c74..ec46dca 100644 --- a/pattern.c +++ b/pattern.c @@ -12,6 +12,10 @@ #endif #include "mutt.h" +#include "buffer.h" +#include "handler.h" +#include "enter.h" +#include "ascii.h" #include "mx.h" #include "mapping.h" #include "keymap.h" diff --git a/pgp.c b/pgp.c index 1e1d2b5..a19c490 100644 --- a/pgp.c +++ b/pgp.c @@ -22,6 +22,9 @@ #endif #include "mutt.h" +#include "enter.h" +#include "ascii.h" +#include "handler.h" #include "mutt_curses.h" #include "pgp.h" #include "mime.h" diff --git a/pgpkey.c b/pgpkey.c index 68ca6ff..640f080 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -13,6 +13,9 @@ #endif #include "mutt.h" +#include "enter.h" +#include "ascii.h" +#include "recvattach.h" #include "mutt_curses.h" #include "mutt_menu.h" #include "mime.h" diff --git a/pgpmicalg.c b/pgpmicalg.c index 344eba5..0caba38 100644 --- a/pgpmicalg.c +++ b/pgpmicalg.c @@ -16,6 +16,7 @@ #endif #include "mutt.h" +#include "handler.h" #include "pgp.h" #include "pgppacket.h" #include "mime.h" diff --git a/pop/pop_auth.c b/pop/pop_auth.c index 5af14b7..1fa17ec 100644 --- a/pop/pop_auth.c +++ b/pop/pop_auth.c @@ -12,6 +12,7 @@ #endif #include "mutt.h" +#include "ascii.h" #include "mx.h" #include "md5.h" #include "pop.h" diff --git a/pop/pop_lib.c b/pop/pop_lib.c index 143868e..8e667ad 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -12,6 +12,7 @@ #endif #include "mutt.h" +#include "ascii.h" #include "mx.h" #include "url.h" #include "pop.h" diff --git a/postpone.c b/postpone.c index 67128ed..a3d7289 100644 --- a/postpone.c +++ b/postpone.c @@ -13,11 +13,15 @@ #endif #include "mutt.h" +#include "ascii.h" +#include "enter.h" +#include "handler.h" #include "mutt_menu.h" #include "rfc1524.h" #include "mime.h" #include "mapping.h" #include "sort.h" +#include "thread.h" #include "mx.h" #ifdef USE_IMAP #include "imap.h" diff --git a/protos.h b/protos.h index 8638e6a..a022cec 100644 --- a/protos.h +++ b/protos.h @@ -28,20 +28,6 @@ void _mutt_make_string (char *, size_t, const char *, CONTEXT *, #define mutt_system(x) _mutt_system(x,0) int _mutt_system (const char *, int); -#define mutt_next_thread(x) _mutt_aside_thread(x,1,0) -#define mutt_previous_thread(x) _mutt_aside_thread(x,0,0) -#define mutt_next_subthread(x) _mutt_aside_thread(x,1,1) -#define mutt_previous_subthread(x) _mutt_aside_thread(x,0,1) -int _mutt_aside_thread (HEADER *, short, short); - -#define mutt_collapse_thread(x,y) _mutt_traverse_thread (x,y,M_THREAD_COLLAPSE) -#define mutt_uncollapse_thread(x,y) _mutt_traverse_thread (x,y,M_THREAD_UNCOLLAPSE) -#define mutt_get_hidden(x,y)_mutt_traverse_thread (x,y,M_THREAD_GET_HIDDEN) -#define mutt_thread_contains_unread(x,y) _mutt_traverse_thread (x,y,M_THREAD_UNREAD) -#define mutt_thread_next_unread(x,y) _mutt_traverse_thread(x,y,M_THREAD_NEXT_UNREAD) -int _mutt_traverse_thread (CONTEXT * ctx, HEADER * hdr, int flag); - - #define mutt_new_parameter() mem_calloc (1, sizeof (PARAMETER)) #define mutt_new_header() mem_calloc (1, sizeof (HEADER)) #define mutt_new_envelope() mem_calloc (1, sizeof (ENVELOPE)) @@ -80,9 +66,6 @@ BODY *mutt_read_mime_header (FILE *, int); CONTENT *mutt_get_content_info (const char *fname, BODY * b); -HASH *mutt_make_id_hash (CONTEXT *); -HASH *mutt_make_subj_hash (CONTEXT *); - LIST *mutt_make_references (ENVELOPE * e); LIST *mutt_parse_references (char *, int); @@ -102,16 +85,6 @@ time_t mutt_mktime (struct tm *, int); time_t mutt_parse_date (const char *, HEADER *); int is_from (const char *, char *, size_t, time_t *); -const char *mutt_attach_fmt (char *dest, - size_t destlen, - char op, - const char *src, - const char *prefix, - const char *ifstring, - const char *elsestring, - unsigned long data, format_flag flags); - - char *mutt_charset_hook (const char *); char *mutt_iconv_hook (const char *); char *mutt_expand_path (char *, size_t); @@ -134,17 +107,12 @@ void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv, LIST *** pp, LIST *** qq); void mutt_adv_mktemp (char *, size_t); void mutt_allow_interrupt (int); -void mutt_attach_init (BODY *); void mutt_block_signals (void); void mutt_block_signals_system (void); -void mutt_body_handler (BODY *, STATE *); int mutt_bounce_message (FILE * fp, HEADER *, ADDRESS *); -void mutt_break_thread (HEADER *); void mutt_canonical_charset (char *, size_t, const char *); void mutt_check_rescore (CONTEXT *); void mutt_clear_error (void); -void mutt_decode_attachment (BODY *, STATE *); -void mutt_decode_base64 (STATE * s, long len, int istext, iconv_t cd); void mutt_default_save (char *, size_t, HEADER *); void mutt_display_address (ENVELOPE *); void mutt_display_sanitize (char *); @@ -221,11 +189,9 @@ void mutt_unblock_signals (void); void mutt_unblock_signals_system (int); void mutt_update_encoding (BODY * a); void mutt_version (void); -void mutt_view_attachments (HEADER *); void mutt_write_references (LIST *, FILE *); void mutt_write_address_list (ADDRESS * adr, FILE * fp, int linelen, int display); -void mutt_set_virtual (CONTEXT *); int mutt_addwch (wchar_t); int mutt_alloc_color (int fg, int bg); @@ -254,7 +220,6 @@ int mutt_chscmp (const char *s, const char *chs); #define mutt_is_utf8(a) mutt_chscmp (a, "utf-8") #define mutt_is_us_ascii(a) mutt_chscmp (a, "us-ascii") -int mutt_parent_message (CONTEXT *, HEADER *); int mutt_prepare_template (FILE *, CONTEXT *, HEADER *, HEADER *, short); int mutt_resend_message (FILE *, CONTEXT *, HEADER *); @@ -270,16 +235,13 @@ int mutt_index_menu (void); int mutt_invoke_mta (ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *, const char *, int); int mutt_is_mail_list (ADDRESS *); -int mutt_is_message_type (int, const char *); int mutt_is_list_cc (int, ADDRESS *, ADDRESS *); int mutt_is_list_recipient (int, ADDRESS *, ADDRESS *); int mutt_is_subscribed_list (ADDRESS *); int mutt_is_text_part (BODY *); int mutt_is_valid_mailbox (const char *); -int mutt_link_threads (HEADER *, HEADER *, CONTEXT *); int mutt_lookup_mime_type (BODY *, const char *); int mutt_match_spam_list (const char *, SPAM_LIST *, char *, int); -int mutt_messages_in_thread (CONTEXT *, HEADER *, int); int mutt_multi_choice (char *prompt, char *letters); int mutt_needs_mailcap (BODY *); int mutt_num_postponed (int); diff --git a/recvattach.c b/recvattach.c index 265a18c..50bc81d 100644 --- a/recvattach.c +++ b/recvattach.c @@ -13,6 +13,10 @@ #endif #include "mutt.h" +#include "ascii.h" +#include "enter.h" +#include "handler.h" +#include "recvattach.h" #include "mutt_curses.h" #include "mutt_menu.h" #include "rfc1524.h" @@ -54,7 +58,7 @@ static struct mapping_t AttachHelp[] = { {NULL} }; -int mutt_extract_path (char *filename, char *path) +static int mutt_extract_path (char *filename, char *path) { char *tmp = mem_malloc (sizeof (char) * _POSIX_PATH_MAX); char *help_ptr; @@ -345,7 +349,7 @@ const char *mutt_attach_fmt (char *dest, return (src); } -void attach_entry (char *b, size_t blen, MUTTMENU * menu, int num) +static void attach_entry (char *b, size_t blen, MUTTMENU * menu, int num) { mutt_FormatString (b, blen, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **) menu->data)[num]), @@ -738,7 +742,7 @@ void mutt_print_attachment_list (FILE * fp, int tag, BODY * top) print_attachment_list (fp, tag, top, &state); } -void +static void mutt_update_attach_index (BODY * cur, ATTACHPTR *** idxp, short *idxlen, short *idxmax, MUTTMENU * menu) { diff --git a/recvattach.h b/recvattach.h new file mode 100644 index 0000000..68a5bf1 --- /dev/null +++ b/recvattach.h @@ -0,0 +1,48 @@ +/* + * Copyright notice from original mutt: + * Copyright (C) 1996-2000 Michael R. Elkins + * + * 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. + */ +#ifndef _MUTT_RECVATTACH_H +#define _MUTT_RECVATTACH_H + +#include "mutt_menu.h" + +#include "attach.h" + +void mutt_update_tree (ATTACHPTR **, short); + +ATTACHPTR **mutt_gen_attach_list (BODY *, int, ATTACHPTR **, short *, short *, + int, int); + +const char *mutt_attach_fmt (char *dest, + size_t destlen, + char op, + const char *src, + const char *prefix, + const char *ifstring, + const char *elsestring, + unsigned long data, format_flag flags); + +int mutt_tag_attach (MUTTMENU * menu, int n, int m); + +int mutt_is_message_type (int, const char *); + +void mutt_save_attachment_list (FILE * fp, int tag, BODY * top, HEADER * hdr, + MUTTMENU * menu); + +void mutt_pipe_attachment_list (FILE * fp, int tag, BODY * top, int filter); +void mutt_print_attachment_list (FILE * fp, int tag, BODY * top); + +int mutt_attach_display_loop (MUTTMENU * menu, int op, FILE * fp, + HEADER * hdr, BODY * cur, ATTACHPTR *** idxp, + short *idxlen, short *idxmax, int recv); + +void mutt_attach_init (BODY *); + +void mutt_view_attachments (HEADER *); + +#endif /* !_MUTT_RECVATTACH_H */ diff --git a/recvcmd.c b/recvcmd.c index e7cad2e..00029bb 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -12,6 +12,10 @@ #endif #include "mutt.h" +#include "enter.h" +#include "state.h" +#include "handler.h" +#include "recvattach.h" #include "mutt_curses.h" #include "mutt_menu.h" #include "rfc1524.h" diff --git a/rfc1524.c b/rfc1524.c index ad98954..86ffc06 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -22,6 +22,7 @@ #endif #include "mutt.h" +#include "ascii.h" #include "rfc1524.h" #include "attach.h" diff --git a/rfc2047.c b/rfc2047.c index 69b884f..7fc21d0 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -13,6 +13,7 @@ #endif #include "mutt.h" +#include "ascii.h" #include "mime.h" #include "charset.h" #include "rfc2047.h" diff --git a/rfc2231.c b/rfc2231.c index 6c9d4b5..c3986a4 100644 --- a/rfc2231.c +++ b/rfc2231.c @@ -22,6 +22,7 @@ #endif #include "mutt.h" +#include "ascii.h" #include "mime.h" #include "charset.h" #include "lib/str.h" diff --git a/rfc822.c b/rfc822.c index 32dcd7b..5dc33e2 100644 --- a/rfc822.c +++ b/rfc822.c @@ -16,6 +16,7 @@ #include #include "mutt.h" +#include "ascii.h" #include "mutt_idna.h" #include "lib/mem.h" diff --git a/score.c b/score.c index 380283e..4bc13e6 100644 --- a/score.c +++ b/score.c @@ -13,6 +13,7 @@ #include "mutt.h" #include "sort.h" +#include "buffer.h" #include "lib/mem.h" #include "lib/intl.h" diff --git a/send.c b/send.c index 9fc382f..851db2d 100644 --- a/send.c +++ b/send.c @@ -12,6 +12,8 @@ #endif #include "mutt.h" +#include "enter.h" +#include "ascii.h" #include "mutt_curses.h" #include "rfc2047.h" #include "keymap.h" diff --git a/sendlib.c b/sendlib.c index 80790f4..0c1757b 100644 --- a/sendlib.c +++ b/sendlib.c @@ -14,6 +14,9 @@ #endif #include "mutt.h" +#include "ascii.h" +#include "handler.h" +#include "recvattach.h" #include "mutt_curses.h" #include "rfc2047.h" #include "rfc2231.h" diff --git a/smime.c b/smime.c index 0116684..afa7be4 100644 --- a/smime.c +++ b/smime.c @@ -14,6 +14,8 @@ #endif #include "mutt.h" +#include "enter.h" +#include "handler.h" #include "mutt_curses.h" #include "mutt_menu.h" #include "smime.h" diff --git a/sort.c b/sort.c index 93ba2e4..138d13e 100644 --- a/sort.c +++ b/sort.c @@ -12,10 +12,11 @@ #endif #include "mutt.h" -#include "lib/str.h" #include "sort.h" +#include "thread.h" #include "mutt_idna.h" +#include "lib/str.h" #include "lib/intl.h" #include diff --git a/sort.h b/sort.h index 65e8e88..76cd39d 100644 --- a/sort.h +++ b/sort.h @@ -31,11 +31,8 @@ typedef int sort_t (const void *, const void *); sort_t *mutt_get_sort_func (int); -void mutt_clear_threads (CONTEXT *); void mutt_sort_headers (CONTEXT *, int); -void mutt_sort_threads (CONTEXT *, int); int mutt_select_sort (int); -THREAD *mutt_sort_subthreads (THREAD *, int); WHERE short BrowserSort INITVAL (SORT_SUBJECT); WHERE short Sort INITVAL (SORT_DATE); diff --git a/thread.c b/thread.c index bdd676e..0f93794 100644 --- a/thread.c +++ b/thread.c @@ -13,6 +13,7 @@ #include "mutt.h" #include "sort.h" +#include "thread.h" #include "lib/mem.h" #include "lib/intl.h" @@ -512,7 +513,7 @@ void mutt_clear_threads (CONTEXT * ctx) hash_destroy (&ctx->thread_hash, free); } -int compare_threads (const void *a, const void *b) +static int compare_threads (const void *a, const void *b) { static sort_t *sort_func = NULL; diff --git a/thread.h b/thread.h new file mode 100644 index 0000000..03e725c --- /dev/null +++ b/thread.h @@ -0,0 +1,41 @@ +/* + * Copyright notice from original mutt: + * Copyright (C) 1996-2000 Michael R. Elkins + * + * 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. + */ +#ifndef _MUTT_THREAD_H +#define _MUTT_THREAD_H + +#define mutt_next_thread(x) _mutt_aside_thread(x,1,0) +#define mutt_previous_thread(x) _mutt_aside_thread(x,0,0) +#define mutt_next_subthread(x) _mutt_aside_thread(x,1,1) +#define mutt_previous_subthread(x) _mutt_aside_thread(x,0,1) +int _mutt_aside_thread (HEADER *, short, short); + +#define mutt_collapse_thread(x,y) _mutt_traverse_thread (x,y,M_THREAD_COLLAPSE) +#define mutt_uncollapse_thread(x,y) _mutt_traverse_thread (x,y,M_THREAD_UNCOLLAPSE) +#define mutt_get_hidden(x,y)_mutt_traverse_thread (x,y,M_THREAD_GET_HIDDEN) +#define mutt_thread_contains_unread(x,y) _mutt_traverse_thread (x,y,M_THREAD_UNREAD) +#define mutt_thread_next_unread(x,y) _mutt_traverse_thread(x,y,M_THREAD_NEXT_UNREAD) +int _mutt_traverse_thread (CONTEXT * ctx, HEADER * hdr, int flag); + +void mutt_clear_threads (CONTEXT *); + +void mutt_sort_threads (CONTEXT *, int); +THREAD *mutt_sort_subthreads (THREAD *, int); + +int mutt_parent_message (CONTEXT *, HEADER *); +void mutt_set_virtual (CONTEXT *); + +int mutt_messages_in_thread (CONTEXT *, HEADER *, int); + +HASH *mutt_make_id_hash (CONTEXT *); +HASH *mutt_make_subj_hash (CONTEXT *); + +int mutt_link_threads (HEADER *, HEADER *, CONTEXT *); +void mutt_break_thread (HEADER *); + +#endif /* !_MUTT_THREAD_H */ diff --git a/url.c b/url.c index 2315fc9..2597646 100644 --- a/url.c +++ b/url.c @@ -16,6 +16,7 @@ #endif #include "mutt.h" +#include "ascii.h" #include "mapping.h" #include "url.h"