improvements, fixes, parser progress, ...
authorPierre Habouzit <madcoder@debian.org>
Wed, 27 Dec 2006 18:57:10 +0000 (19:57 +0100)
committerPierre Habouzit <madcoder@debian.org>
Wed, 27 Dec 2006 18:57:10 +0000 (19:57 +0100)
ongoing work.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
buffy.c
buffy.h
init.h
keymap.c
rcparser.y
rctokens.sh

diff --git a/buffy.c b/buffy.c
index 2aaa494..6c9ef3e 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -29,13 +29,6 @@ static time_t ImapBuffyTime = 0;  /* last time we started checking for mail */
 static short  BuffyCount = 0;     /* how many boxes with new mail */
 static short  BuffyNotify = 0;    /* # of unnotified new boxes */
 
 static short  BuffyCount = 0;     /* how many boxes with new mail */
 static short  BuffyNotify = 0;    /* # of unnotified new boxes */
 
-static inline void buffy_delete(BUFFY** p)
-{
-    p_delete(&(*p)->path);
-    p_delete(p);
-}
-DO_ARRAY_FUNCS(BUFFY, buffy, buffy_delete);
-
 /* Return the index number of path in Incoming list */
 int buffy_lookup(const char* path)
 {
 /* Return the index number of path in Incoming list */
 int buffy_lookup(const char* path)
 {
diff --git a/buffy.h b/buffy.h
index 0662b94..fdd2ca3 100644 (file)
--- a/buffy.h
+++ b/buffy.h
@@ -24,7 +24,16 @@ typedef struct buffy_t {
   short magic;                  /* mailbox type */
   short newly_created;          /* mbox or mmdf just popped into existence */
 } BUFFY;
   short magic;                  /* mailbox type */
   short newly_created;          /* mbox or mmdf just popped into existence */
 } BUFFY;
+
+DO_INIT(BUFFY, buffy);
+static inline void buffy_wipe(BUFFY *p) {
+    p_delete(&p->path);
+}
+DO_NEW(BUFFY, buffy);
+DO_DELETE(BUFFY, buffy);
+
 DO_ARRAY_TYPE(BUFFY, buffy);
 DO_ARRAY_TYPE(BUFFY, buffy);
+DO_ARRAY_FUNCS(BUFFY, buffy, buffy_delete);
 
 /* folders with incomming mail (via mailboxes command) */
 WHERE buffy_array Incoming;
 
 /* folders with incomming mail (via mailboxes command) */
 WHERE buffy_array Incoming;
diff --git a/init.h b/init.h
index 238b451..970580e 100644 (file)
--- a/init.h
+++ b/init.h
@@ -142,7 +142,7 @@ struct option_t MuttVars[] = {
   {"alias_file", DT_PATH, R_NONE, UL &AliasFile, "~/.madmuttrc"},
   /*
    ** .pp
   {"alias_file", DT_PATH, R_NONE, UL &AliasFile, "~/.madmuttrc"},
   /*
    ** .pp
-   ** The default file in which to save aliases created by the 
+   ** The default file in which to save aliases created by the
    ** ``$create-alias'' function.
    ** .pp
    ** \fBNote:\fP Madmutt will not automatically source this file; you must
    ** ``$create-alias'' function.
    ** .pp
    ** \fBNote:\fP Madmutt will not automatically source this file; you must
@@ -171,7 +171,7 @@ struct option_t MuttVars[] = {
   {"allow_ansi", DT_BOOL, R_NONE, OPTALLOWANSI, "no" },
   /*
    ** .pp
   {"allow_ansi", DT_BOOL, R_NONE, OPTALLOWANSI, "no" },
   /*
    ** .pp
-   ** Controls whether ANSI color codes in messages (and color tags in 
+   ** Controls whether ANSI color codes in messages (and color tags in
    ** rich text messages) are to be interpreted.
    ** Messages containing these codes are rare, but if this option is set,
    ** their text will be colored accordingly. Note that this may override
    ** rich text messages) are to be interpreted.
    ** Messages containing these codes are rare, but if this option is set,
    ** their text will be colored accordingly. Note that this may override
@@ -343,7 +343,7 @@ struct option_t MuttVars[] = {
   {"bounce_delivered", DT_BOOL, R_NONE, OPTBOUNCEDELIVERED, "yes" },
   /*
    ** .pp
   {"bounce_delivered", DT_BOOL, R_NONE, OPTBOUNCEDELIVERED, "yes" },
   /*
    ** .pp
-   ** When this variable is \fIset\fP, Madmutt will include 
+   ** When this variable is \fIset\fP, Madmutt will include
    ** \fTDelivered-To:\fP header fields when bouncing messages.
    ** Postfix users may wish to \fIunset\fP this variable.
    */
    ** \fTDelivered-To:\fP header fields when bouncing messages.
    ** Postfix users may wish to \fIunset\fP this variable.
    */
@@ -352,8 +352,8 @@ struct option_t MuttVars[] = {
    ** .pp
    ** When this variable is set, mutt will place the cursor at the beginning
    ** of the current line in menus, even when the arrow_cursor variable
    ** .pp
    ** When this variable is set, mutt will place the cursor at the beginning
    ** of the current line in menus, even when the arrow_cursor variable
-   ** is unset, making it easier for blind persons using Braille displays to 
-   ** follow these menus.  The option is disabled by default because many 
+   ** is unset, making it easier for blind persons using Braille displays to
+   ** follow these menus.  The option is disabled by default because many
    ** visual terminals don't permit making the cursor invisible.
    */
 #ifdef USE_NNTP
    ** visual terminals don't permit making the cursor invisible.
    */
 #ifdef USE_NNTP
@@ -404,13 +404,13 @@ struct option_t MuttVars[] = {
    ** set of \fTprintf(3)\fP-like sequences:
    ** .pp
    ** .dl
    ** set of \fTprintf(3)\fP-like sequences:
    ** .pp
    ** .dl
-   ** .dt %a .dd total number of attachments 
+   ** .dt %a .dd total number of attachments
    ** .dt %h .dd local hostname
    ** .dt %l .dd approximate size (in bytes) of the current message
    ** .dt %v .dd Madmutt version string
    ** .de
    ** .pp
    ** .dt %h .dd local hostname
    ** .dt %l .dd approximate size (in bytes) of the current message
    ** .dt %v .dd Madmutt version string
    ** .de
    ** .pp
-   ** See the text describing the ``$$status_format'' option for more 
+   ** See the text describing the ``$$status_format'' option for more
    ** information on how to set ``$$compose_format''.
    */
   {"config_charset", DT_STR, R_NONE, UL &ConfigCharset, "" },
    ** information on how to set ``$$compose_format''.
    */
   {"config_charset", DT_STR, R_NONE, UL &ConfigCharset, "" },
@@ -811,7 +811,7 @@ struct option_t MuttVars[] = {
    ** ``$$reverse_name''.  This variable is ignored if ``$$use_from''
    ** is unset.
    ** .pp
    ** ``$$reverse_name''.  This variable is ignored if ``$$use_from''
    ** is unset.
    ** .pp
-   ** E.g. you can use 
+   ** E.g. you can use
    ** \fTsend-hook Madmutt-devel@lists.berlios.de 'my_hdr From: Foo Bar <foo@bar.fb>'\fP
    ** when replying to the Madmutt developer's mailing list and Madmutt takes this email address.
    ** .pp
    ** \fTsend-hook Madmutt-devel@lists.berlios.de 'my_hdr From: Foo Bar <foo@bar.fb>'\fP
    ** when replying to the Madmutt developer's mailing list and Madmutt takes this email address.
    ** .pp
@@ -827,7 +827,7 @@ struct option_t MuttVars[] = {
    ** should do: \fTset gecos_mask=".*"\fP.
    ** .pp
    ** This can be useful if you see the following behavior: you address a e-mail
    ** should do: \fTset gecos_mask=".*"\fP.
    ** .pp
    ** This can be useful if you see the following behavior: you address a e-mail
-   ** to user ID stevef whose full name is Steve Franklin.  If Madmutt expands 
+   ** to user ID stevef whose full name is Steve Franklin.  If Madmutt expands
    ** stevef to ``Franklin'' stevef@foo.bar then you should set the gecos_mask to
    ** a regular expression that will match the whole name so Madmutt will expand
    ** ``Franklin'' to ``Franklin, Steve''.
    ** stevef to ``Franklin'' stevef@foo.bar then you should set the gecos_mask to
    ** a regular expression that will match the whole name so Madmutt will expand
    ** ``Franklin'' to ``Franklin, Steve''.
@@ -888,7 +888,7 @@ struct option_t MuttVars[] = {
    ** .pp
    ** When \fIset\fP, Madmutt will skip the host name part of ``$$hostname'' variable
    ** when adding the domain part to addresses.  This variable does not
    ** .pp
    ** When \fIset\fP, Madmutt will skip the host name part of ``$$hostname'' variable
    ** when adding the domain part to addresses.  This variable does not
-   ** affect the generation of \fTMessage-ID:\fP header fields, and it will not lead to the 
+   ** affect the generation of \fTMessage-ID:\fP header fields, and it will not lead to the
    ** cut-off of first-level domains.
    */
   {"hide_limited", DT_BOOL, R_TREE|R_INDEX, OPTHIDELIMITED, "no" },
    ** cut-off of first-level domains.
    */
   {"hide_limited", DT_BOOL, R_TREE|R_INDEX, OPTHIDELIMITED, "no" },
@@ -1466,7 +1466,7 @@ struct option_t MuttVars[] = {
   {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, "|"},
   /*
    ** .pp
   {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, "|"},
   /*
    ** .pp
-   ** This specifies the delimiter between the sidebar (if visible) and 
+   ** This specifies the delimiter between the sidebar (if visible) and
    ** other screens.
    */
   {"sidebar_visible", DT_BOOL, R_BOTH, OPTMBOXPANE, "no" },
    ** other screens.
    */
   {"sidebar_visible", DT_BOOL, R_BOTH, OPTMBOXPANE, "no" },
@@ -1514,9 +1514,9 @@ struct option_t MuttVars[] = {
    ** .pp
    ** When \fIset\fP, the ``hierarchy'' of the sidebar entries will be shortened
    ** only if they cannot be printed in full length (because ``$$sidebar_width''
    ** .pp
    ** When \fIset\fP, the ``hierarchy'' of the sidebar entries will be shortened
    ** only if they cannot be printed in full length (because ``$$sidebar_width''
-   ** is set to a too low value). For example, if the newsgroup name 
+   ** is set to a too low value). For example, if the newsgroup name
    ** ``de.alt.sysadmin.recovery'' doesn't fit on the screen, it'll get shortened
    ** ``de.alt.sysadmin.recovery'' doesn't fit on the screen, it'll get shortened
-   ** ``d.a.s.recovery'' while ``de.alt.d0'' still would and thus will not get 
+   ** ``d.a.s.recovery'' while ``de.alt.d0'' still would and thus will not get
    ** shortened.
    ** .pp
    ** At which characters this compression is done is controled via the
    ** shortened.
    ** .pp
    ** At which characters this compression is done is controled via the
@@ -1634,7 +1634,7 @@ struct option_t MuttVars[] = {
   /*
    ** .pp
    ** This variable describes the format of a remailer line on the mixmaster
   /*
    ** .pp
    ** This variable describes the format of a remailer line on the mixmaster
-   ** chain selection screen.  The following \fTprintf(3)\fP-like sequences are 
+   ** chain selection screen.  The following \fTprintf(3)\fP-like sequences are
    ** supported:
    ** .pp
    ** .dl
    ** supported:
    ** .pp
    ** .dl
@@ -1682,7 +1682,7 @@ struct option_t MuttVars[] = {
    ** .dt %M .dd the current minute
    ** .dt %O .dd the current UNIX timestamp (octal)
    ** .dt %p .dd the process ID
    ** .dt %M .dd the current minute
    ** .dt %O .dd the current UNIX timestamp (octal)
    ** .dt %p .dd the process ID
-   ** .dt %P .dd the current Message-ID prefix (a character rotating with 
+   ** .dt %P .dd the current Message-ID prefix (a character rotating with
    **            every Message-ID being generated)
    ** .dt %r .dd a random integer value (decimal)
    ** .dt %R .dd a random integer value (hexadecimal)
    **            every Message-ID being generated)
    ** .dt %r .dd a random integer value (decimal)
    ** .dt %R .dd a random integer value (hexadecimal)
@@ -1953,7 +1953,7 @@ struct option_t MuttVars[] = {
   /*
    ** .pp
    ** If ``\fIyes\fP'', always attempt to verify PGP or S/MIME signatures.
   /*
    ** .pp
    ** If ``\fIyes\fP'', always attempt to verify PGP or S/MIME signatures.
-   ** If ``\fIask\fP'', ask whether or not to verify the signature. 
+   ** If ``\fIask\fP'', ask whether or not to verify the signature.
    ** If ``\fIno\fP'', never attempt to verify cryptographic signatures.
    ** (Crypto only)
    */
    ** If ``\fIno\fP'', never attempt to verify cryptographic signatures.
    ** (Crypto only)
    */
@@ -1963,7 +1963,7 @@ struct option_t MuttVars[] = {
    ** The default behaviour of Madmutt is to use PGP on all auto-sign/encryption
    ** operations. To override and to use OpenSSL instead this must be \fIset\fP.
    ** .pp
    ** The default behaviour of Madmutt is to use PGP on all auto-sign/encryption
    ** operations. To override and to use OpenSSL instead this must be \fIset\fP.
    ** .pp
-   ** However, this has no effect while replying, since Madmutt will automatically 
+   ** However, this has no effect while replying, since Madmutt will automatically
    ** select the same application that was used to sign/encrypt the original
    ** message.
    ** .pp
    ** select the same application that was used to sign/encrypt the original
    ** message.
    ** .pp
@@ -2079,7 +2079,7 @@ struct option_t MuttVars[] = {
    ** Also note that using the old-style PGP message format is \fBstrongly\fP
    ** \fBdeprecated\fP.
    ** (PGP only)
    ** Also note that using the old-style PGP message format is \fBstrongly\fP
    ** \fBdeprecated\fP.
    ** (PGP only)
-   ** 
+   **
    */
   {"pgp_show_unusable", DT_BOOL, R_NONE, OPTPGPSHOWUNUSABLE, "yes" },
   /*
    */
   {"pgp_show_unusable", DT_BOOL, R_NONE, OPTPGPSHOWUNUSABLE, "yes" },
   /*
@@ -2155,7 +2155,7 @@ struct option_t MuttVars[] = {
   {"pgp_decode_command", DT_STR, R_NONE, UL &PgpDecodeCommand, "" },
   /*
    ** .pp
   {"pgp_decode_command", DT_STR, R_NONE, UL &PgpDecodeCommand, "" },
   /*
    ** .pp
-   ** This format strings specifies a command which is used to decode 
+   ** This format strings specifies a command which is used to decode
    ** application/pgp attachments.
    ** .pp
    ** The PGP command formats have their own set of \fTprintf(3)\fP-like sequences:
    ** application/pgp attachments.
    ** .pp
    ** The PGP command formats have their own set of \fTprintf(3)\fP-like sequences:
@@ -2206,7 +2206,7 @@ struct option_t MuttVars[] = {
   {"pgp_sign_command", DT_STR, R_NONE, UL &PgpSignCommand, "" },
   /*
    ** .pp
   {"pgp_sign_command", DT_STR, R_NONE, UL &PgpSignCommand, "" },
   /*
    ** .pp
-   ** This command is used to create the detached PGP signature for a 
+   ** This command is used to create the detached PGP signature for a
    ** multipart/signed PGP/MIME body part.
    ** (PGP only)
    */
    ** multipart/signed PGP/MIME body part.
    ** (PGP only)
    */
@@ -2225,7 +2225,7 @@ struct option_t MuttVars[] = {
   {"pgp_import_command", DT_STR, R_NONE, UL &PgpImportCommand, "" },
   /*
    ** .pp
   {"pgp_import_command", DT_STR, R_NONE, UL &PgpImportCommand, "" },
   /*
    ** .pp
-   ** This command is used to import a key from a message into 
+   ** This command is used to import a key from a message into
    ** the user's public key ring.
    ** (PGP only)
    */
    ** the user's public key ring.
    ** (PGP only)
    */
@@ -2247,10 +2247,10 @@ struct option_t MuttVars[] = {
   /*
    ** .pp
    ** This command is used to list the secret key ring's contents.  The
   /*
    ** .pp
    ** This command is used to list the secret key ring's contents.  The
-   ** output format must be analogous to the one used by 
+   ** output format must be analogous to the one used by
    ** \fTgpg --list-keys --with-colons\fP.
    ** .pp
    ** \fTgpg --list-keys --with-colons\fP.
    ** .pp
-   ** This format is also generated by the \fTpgpring\fP utility which comes 
+   ** This format is also generated by the \fTpgpring\fP utility which comes
    ** with Madmutt.
    ** (PGP only)
    */
    ** with Madmutt.
    ** (PGP only)
    */
@@ -2258,10 +2258,10 @@ struct option_t MuttVars[] = {
   /*
    ** .pp
    ** This command is used to list the public key ring's contents.  The
   /*
    ** .pp
    ** This command is used to list the public key ring's contents.  The
-   ** output format must be analogous to the one used by 
+   ** output format must be analogous to the one used by
    ** \fTgpg --list-keys --with-colons\fP.
    ** .pp
    ** \fTgpg --list-keys --with-colons\fP.
    ** .pp
-   ** This format is also generated by the \fTpgpring\fP utility which comes 
+   ** This format is also generated by the \fTpgpring\fP utility which comes
    ** with Madmutt.
    ** (PGP only)
    */
    ** with Madmutt.
    ** (PGP only)
    */
@@ -2338,7 +2338,7 @@ struct option_t MuttVars[] = {
    ** .dt %c .dd One or more certificate IDs.
    ** .dt %a .dd The algorithm used for encryption.
    ** .dt %C .dd CA location:  Depending on whether $$smime_ca_location
    ** .dt %c .dd One or more certificate IDs.
    ** .dt %a .dd The algorithm used for encryption.
    ** .dt %C .dd CA location:  Depending on whether $$smime_ca_location
-   ** .          points to a directory or file, this expands to 
+   ** .          points to a directory or file, this expands to
    ** .          "-CApath $$smime_ca_location" or "-CAfile $$smime_ca_location".
    ** .de
    ** .pp
    ** .          "-CApath $$smime_ca_location" or "-CAfile $$smime_ca_location".
    ** .de
    ** .pp
@@ -2447,7 +2447,7 @@ struct option_t MuttVars[] = {
    ** .pp
    ** \fBNote:\fP Storing passwords in a configuration file
    ** presents a security risk since the superuser of your machine may read it
    ** .pp
    ** \fBNote:\fP Storing passwords in a configuration file
    ** presents a security risk since the superuser of your machine may read it
-   ** regardless of the file's permissions.  
+   ** regardless of the file's permissions.
    */
   {"smtp_envelope", DT_SYN, R_NONE, UL "envelope_from_address", 0 },
   {"smtp_host", DT_STR, R_NONE, UL &SmtpHost, "" },
    */
   {"smtp_envelope", DT_SYN, R_NONE, UL "envelope_from_address", 0 },
   {"smtp_host", DT_STR, R_NONE, UL &SmtpHost, "" },
@@ -2526,12 +2526,12 @@ struct option_t MuttVars[] = {
    ** .pp
    ** This variable specifies the file where the certificates you trust
    ** are saved. When an unknown certificate is encountered, you are asked
    ** .pp
    ** This variable specifies the file where the certificates you trust
    ** are saved. When an unknown certificate is encountered, you are asked
-   ** if you accept it or not. If you accept it, the certificate can also 
-   ** be saved in this file and further connections are automatically 
+   ** if you accept it or not. If you accept it, the certificate can also
+   ** be saved in this file and further connections are automatically
    ** accepted.
    ** .pp
    ** You can also manually add CA certificates in this file. Any server
    ** accepted.
    ** .pp
    ** You can also manually add CA certificates in this file. Any server
-   ** certificate that is signed with one of these CA certificates are 
+   ** certificate that is signed with one of these CA certificates are
    ** also automatically accepted.
    ** .pp
    ** Example: \fTset certificate_file=~/.madmutt/certificates\fP
    ** also automatically accepted.
    ** .pp
    ** Example: \fTset certificate_file=~/.madmutt/certificates\fP
@@ -2544,7 +2544,7 @@ struct option_t MuttVars[] = {
    **
    ** .pp
    ** If set to \fIyes\fP, Madmutt will use CA certificates in the
    **
    ** .pp
    ** If set to \fIyes\fP, Madmutt will use CA certificates in the
-   ** system-wide certificate store when checking if server certificate 
+   ** system-wide certificate store when checking if server certificate
    ** is signed by a trusted CA.
    */
   {"entropy_file", DT_PATH, R_NONE, UL &SslEntropyFile, "" },
    ** is signed by a trusted CA.
    */
   {"entropy_file", DT_PATH, R_NONE, UL &SslEntropyFile, "" },
@@ -2610,7 +2610,7 @@ struct option_t MuttVars[] = {
   /*
    ** .pp
    ** Used in connection with the \fIpipe-message\fP command and the ``tag-
   /*
    ** .pp
    ** Used in connection with the \fIpipe-message\fP command and the ``tag-
-   ** prefix'' or ``tag-prefix-cond'' operators. 
+   ** prefix'' or ``tag-prefix-cond'' operators.
    ** If this variable is \fIunset\fP, when piping a list of
    ** tagged messages Madmutt will concatenate the messages and will pipe them
    ** as a single folder.  When \fIset\fP, Madmutt will pipe the messages one by one.
    ** If this variable is \fIunset\fP, when piping a list of
    ** tagged messages Madmutt will concatenate the messages and will pipe them
    ** as a single folder.  When \fIset\fP, Madmutt will pipe the messages one by one.
@@ -2789,7 +2789,7 @@ struct option_t MuttVars[] = {
    ** .pp
    ** Used in connection with the print-message command.  If this option
    ** is \fIset\fP, the command specified by $$print_command is executed once for
    ** .pp
    ** Used in connection with the print-message command.  If this option
    ** is \fIset\fP, the command specified by $$print_command is executed once for
-   ** each message which is to be printed.  If this option is \fIunset\fP, 
+   ** each message which is to be printed.  If this option is \fIunset\fP,
    ** the command specified by $$print_command is executed only once, and
    ** all the messages are concatenated, with a form feed as the message
    ** separator.
    ** the command specified by $$print_command is executed only once, and
    ** all the messages are concatenated, with a form feed as the message
    ** separator.
@@ -2916,7 +2916,7 @@ struct option_t MuttVars[] = {
    ** If \fIset\fP, when replying to a message, Madmutt will use the address listed
    ** in the ``\fTReply-To:\fP'' header field as the recipient of the reply.  If \fIunset\fP,
    ** it will use the address in the ``\fTFrom:\fP'' header field instead.
    ** If \fIset\fP, when replying to a message, Madmutt will use the address listed
    ** in the ``\fTReply-To:\fP'' header field as the recipient of the reply.  If \fIunset\fP,
    ** it will use the address in the ``\fTFrom:\fP'' header field instead.
-   ** .pp 
+   ** .pp
    ** This
    ** option is useful for reading a mailing list that sets the ``\fTReply-To:\fP''
    ** header field to the list address and you want to send a private
    ** This
    ** option is useful for reading a mailing list that sets the ``\fTReply-To:\fP''
    ** header field to the list address and you want to send a private
@@ -3014,9 +3014,9 @@ struct option_t MuttVars[] = {
    ** of this variable will never mark a message for deletion.
    */
   {"score_threshold_flag", DT_NUM, R_NONE, UL &ScoreThresholdFlag, "9999" },
    ** of this variable will never mark a message for deletion.
    */
   {"score_threshold_flag", DT_NUM, R_NONE, UL &ScoreThresholdFlag, "9999" },
-  /* 
+  /*
    ** .pp
    ** .pp
-   ** Messages which have been assigned a score greater than or equal to this 
+   ** Messages which have been assigned a score greater than or equal to this
    ** variable's value are automatically marked ``flagged''.
    */
   {"score_threshold_read", DT_NUM, R_NONE, UL &ScoreThresholdRead, "-1" },
    ** variable's value are automatically marked ``flagged''.
    */
   {"score_threshold_read", DT_NUM, R_NONE, UL &ScoreThresholdRead, "-1" },
@@ -3135,7 +3135,7 @@ struct option_t MuttVars[] = {
    ** If \fIset\fP, this string will be inserted before the signature. This is useful
    ** for people that want to sign off every message they send with their name.
    ** .pp
    ** If \fIset\fP, this string will be inserted before the signature. This is useful
    ** for people that want to sign off every message they send with their name.
    ** .pp
-   ** If you want to insert your website's URL, additional contact information or 
+   ** If you want to insert your website's URL, additional contact information or
    ** witty quotes into your mails, better use a signature file instead of
    ** the signoff string.
    */
    ** witty quotes into your mails, better use a signature file instead of
    ** the signoff string.
    */
@@ -3172,7 +3172,7 @@ struct option_t MuttVars[] = {
    ** .pp
    ** Specifies time, in seconds, to pause while displaying certain informational
    ** messages, while moving from folder to folder and after expunging
    ** .pp
    ** Specifies time, in seconds, to pause while displaying certain informational
    ** messages, while moving from folder to folder and after expunging
-   ** messages from the current folder.  The default is to pause one second, so 
+   ** messages from the current folder.  The default is to pause one second, so
    ** a value of zero for this option suppresses the pause.
    */
   {"sort", DT_SORT, R_INDEX|R_RESORT, UL &Sort, "date" },
    ** a value of zero for this option suppresses the pause.
    */
   {"sort", DT_SORT, R_INDEX|R_RESORT, UL &Sort, "date" },
@@ -3303,7 +3303,7 @@ struct option_t MuttVars[] = {
    ** .dt %F  .dd number of flagged messages *
    ** .dt %h  .dd local hostname
    ** .dt %l  .dd size (in bytes) of the current mailbox *
    ** .dt %F  .dd number of flagged messages *
    ** .dt %h  .dd local hostname
    ** .dt %l  .dd size (in bytes) of the current mailbox *
-   ** .dt %L  .dd size (in bytes) of the messages shown 
+   ** .dt %L  .dd size (in bytes) of the messages shown
    **             (i.e., which match the current limit) *
    ** .dt %m  .dd the number of messages in the mailbox *
    ** .dt %M  .dd the number of messages shown (i.e., which match the current limit) *
    **             (i.e., which match the current limit) *
    ** .dt %m  .dd the number of messages in the mailbox *
    ** .dt %M  .dd the number of messages shown (i.e., which match the current limit) *
@@ -3358,7 +3358,7 @@ struct option_t MuttVars[] = {
    **  \fT%_h\fP
    ** .pp
    ** If you prefix the sequence character with a colon (\fT:\fP) character, Madmutt
    **  \fT%_h\fP
    ** .pp
    ** If you prefix the sequence character with a colon (\fT:\fP) character, Madmutt
-   ** will replace any dots in the expansion by underscores. This might be helpful 
+   ** will replace any dots in the expansion by underscores. This might be helpful
    ** with IMAP folders that don't like dots in folder names.
    */
   {"status_on_top", DT_BOOL, R_BOTH, OPTSTATUSONTOP, "no" },
    ** with IMAP folders that don't like dots in folder names.
    */
   {"status_on_top", DT_BOOL, R_BOTH, OPTSTATUSONTOP, "no" },
@@ -3426,7 +3426,7 @@ struct option_t MuttVars[] = {
    ** .pp
    ** When \fIset\fP, Madmutt will generate \fTtext/plain; format=flowed\fP attachments.
    ** This format is easier to handle for some mailing software, and generally
    ** .pp
    ** When \fIset\fP, Madmutt will generate \fTtext/plain; format=flowed\fP attachments.
    ** This format is easier to handle for some mailing software, and generally
-   ** just looks like ordinary text.  To actually make use of this format's 
+   ** just looks like ordinary text.  To actually make use of this format's
    ** features, you'll need support in your editor.
    ** .pp
    ** Note that $$indent_string is ignored when this option is set.
    ** features, you'll need support in your editor.
    ** .pp
    ** Note that $$indent_string is ignored when this option is set.
@@ -3658,7 +3658,7 @@ struct option_t MuttVars[] = {
    **
    ** .pp
    ** If \fIset\fP, Madmutt will add a ``\fTX-Comment-To:\fP'' header field
    **
    ** .pp
    ** If \fIset\fP, Madmutt will add a ``\fTX-Comment-To:\fP'' header field
-   ** (that contains full name of the original article author) to articles that 
+   ** (that contains full name of the original article author) to articles that
    ** you followup to.
    */
 #endif
    ** you followup to.
    */
 #endif
@@ -3694,7 +3694,7 @@ const struct mapping_t SortAuxMethods[] = {
     {"from", SORT_FROM},
     {"size", SORT_SIZE},
     {"threads", SORT_DATE},       /* note: sort_aux == threads
     {"from", SORT_FROM},
     {"size", SORT_SIZE},
     {"threads", SORT_DATE},       /* note: sort_aux == threads
-                                   * isn't possible. 
+                                   * isn't possible.
                                    */
     {"to", SORT_TO},
     {"score", SORT_SCORE},
                                    */
     {"to", SORT_TO},
     {"score", SORT_SCORE},
@@ -3757,66 +3757,66 @@ struct command_t {
 };
 
 struct command_t Commands[] = {
 };
 
 struct command_t Commands[] = {
+    {"mailboxes",           buffy_parse_mailboxes, M_MAILBOXES},
+    {"unmailboxes",         buffy_parse_mailboxes, M_UNMAILBOXES},
+    {"bind",                mutt_parse_bind,       0},
+    {"color",               mutt_parse_color,      0},
+    {"exec",                mutt_parse_exec,       0},
     {"account-hook",        mutt_parse_hook,       M_ACCOUNTHOOK},
     {"account-hook",        mutt_parse_hook,       M_ACCOUNTHOOK},
-    {"alias",               parse_alias,           0},
-    {"alternates",          parse_alternates,      0},
-    {"alternative_order",   parse_list,            UL &AlternativeOrderList},
     {"append-hook",         mutt_parse_hook,       M_APPENDHOOK},
     {"append-hook",         mutt_parse_hook,       M_APPENDHOOK},
-    {"attachments",         parse_attachments,     0 },
-    {"auto_view",           parse_list,            UL &AutoViewList},
-    {"bind",                mutt_parse_bind,       0},
     {"charset-hook",        mutt_parse_hook,       M_CHARSETHOOK},
     {"close-hook",          mutt_parse_hook,       M_CLOSEHOOK},
     {"charset-hook",        mutt_parse_hook,       M_CHARSETHOOK},
     {"close-hook",          mutt_parse_hook,       M_CLOSEHOOK},
-    {"color",               mutt_parse_color,      0},
-    {"exec",                mutt_parse_exec,       0},
+    {"crypt-hook",          mutt_parse_hook,       M_CRYPTHOOK},
     {"fcc-hook",            mutt_parse_hook,       M_FCCHOOK},
     {"fcc-save-hook",       mutt_parse_hook,       M_FCCHOOK|M_SAVEHOOK},
     {"folder-hook",         mutt_parse_hook,       M_FOLDERHOOK},
     {"fcc-hook",            mutt_parse_hook,       M_FCCHOOK},
     {"fcc-save-hook",       mutt_parse_hook,       M_FCCHOOK|M_SAVEHOOK},
     {"folder-hook",         mutt_parse_hook,       M_FOLDERHOOK},
-    {"hdr_order",           parse_list,            UL &HeaderOrderList},
-    {"open-hook",           mutt_parse_hook,       M_OPENHOOK},
-    {"unalternates",        parse_unalternates,    0},
-    {"unattachments",       parse_unattachments,   0},
-    {"uncolor",             mutt_parse_uncolor,    0},
 #ifdef HAVE_ICONV
     {"iconv-hook",          mutt_parse_hook,       M_ICONVHOOK},
 #endif
 #ifdef HAVE_ICONV
     {"iconv-hook",          mutt_parse_hook,       M_ICONVHOOK},
 #endif
-    {"crypt-hook",          mutt_parse_hook,       M_CRYPTHOOK},
-    {"ignore",              parse_ignore,          0},
-    {"lists",               parse_lists,           0},
-    {"macro",               mutt_parse_macro,      0},
-    {"mailboxes",           buffy_parse_mailboxes, M_MAILBOXES},
     {"mbox-hook",           mutt_parse_hook,       M_MBOXHOOK},
     {"message-hook",        mutt_parse_hook,       M_MESSAGEHOOK},
     {"mbox-hook",           mutt_parse_hook,       M_MBOXHOOK},
     {"message-hook",        mutt_parse_hook,       M_MESSAGEHOOK},
-    {"mime_lookup",         parse_list,            UL &MimeLookupList},
-    {"mono",                mutt_parse_mono,       0},
-    {"my_hdr",              parse_my_hdr,          0},
-    {"nospam",              parse_spam_list,       M_NOSPAM},
+    {"open-hook",           mutt_parse_hook,       M_OPENHOOK},
     {"pgp-hook",            mutt_parse_hook,       M_CRYPTHOOK},
     {"pgp-hook",            mutt_parse_hook,       M_CRYPTHOOK},
-    {"push",                mutt_parse_push,       0},
     {"reply-hook",          mutt_parse_hook,       M_REPLYHOOK},
     {"reply-hook",          mutt_parse_hook,       M_REPLYHOOK},
-    {"reset",               parse_set,             M_SET_RESET},
     {"save-hook",           mutt_parse_hook,       M_SAVEHOOK},
     {"save-hook",           mutt_parse_hook,       M_SAVEHOOK},
-    {"score",               mutt_parse_score,      0},
     {"send2-hook",          mutt_parse_hook,       M_SEND2HOOK},
     {"send-hook",           mutt_parse_hook,       M_SENDHOOK},
     {"send2-hook",          mutt_parse_hook,       M_SEND2HOOK},
     {"send-hook",           mutt_parse_hook,       M_SENDHOOK},
+    {"macro",               mutt_parse_macro,      0},
+    {"mono",                mutt_parse_mono,       0},
+    {"push",                mutt_parse_push,       0},
+    {"score",               mutt_parse_score,      0},
+    {"uncolor",             mutt_parse_uncolor,    0},
+    {"unhook",              mutt_parse_unhook,     0},
+    {"unmono",              mutt_parse_unmono,     0},
+    {"unscore",             mutt_parse_unscore,    0},
+    {"alias",               parse_alias,           0},
+    {"alternates",          parse_alternates,      0},
+    {"attachments",         parse_attachments,     0 },
+    {"ignore",              parse_ignore,          0},
+    {"alternative_order",   parse_list,            UL &AlternativeOrderList},
+    {"auto_view",           parse_list,            UL &AutoViewList},
+    {"hdr_order",           parse_list,            UL &HeaderOrderList},
+    {"mime_lookup",         parse_list,            UL &MimeLookupList},
+    {"lists",               parse_lists,           0},
+    {"my_hdr",              parse_my_hdr,          0},
+    {"reset",               parse_set,             M_SET_RESET},
     {"set",                 parse_set,             0},
     {"set",                 parse_set,             0},
+    {"toggle",              parse_set,             M_SET_INV},
+    {"unset",               parse_set,             M_SET_UNSET},
     {"source",              parse_source,          0},
     {"source",              parse_source,          0},
+    {"nospam",              parse_spam_list,       M_NOSPAM},
     {"spam",                parse_spam_list,       M_SPAM},
     {"subscribe",           parse_subscribe,       0},
     {"spam",                parse_spam_list,       M_SPAM},
     {"subscribe",           parse_subscribe,       0},
-    {"toggle",              parse_set,             M_SET_INV},
     {"unalias",             parse_unalias,         0},
     {"unalias",             parse_unalias,         0},
+    {"unalternates",        parse_unalternates,    0},
+    {"unattachments",       parse_unattachments,   0},
+    {"unignore",            parse_unignore,        0},
+    {"unlists",             parse_unlists,         0},
     {"unalternative_order", parse_unlist,          UL &AlternativeOrderList},
     {"unauto_view",         parse_unlist,          UL &AutoViewList},
     {"unhdr_order",         parse_unlist,          UL &HeaderOrderList},
     {"unalternative_order", parse_unlist,          UL &AlternativeOrderList},
     {"unauto_view",         parse_unlist,          UL &AutoViewList},
     {"unhdr_order",         parse_unlist,          UL &HeaderOrderList},
-    {"unhook",              mutt_parse_unhook,     0},
-    {"unignore",            parse_unignore,        0},
-    {"unlists",             parse_unlists,         0},
-    {"unmailboxes",         buffy_parse_mailboxes, M_UNMAILBOXES},
     {"unmime_lookup",       parse_unlist,          UL &MimeLookupList},
     {"unmime_lookup",       parse_unlist,          UL &MimeLookupList},
-    {"unmono",              mutt_parse_unmono,     0},
     {"unmy_hdr",            parse_unmy_hdr,        0},
     {"unmy_hdr",            parse_unmy_hdr,        0},
-    {"unscore",             mutt_parse_unscore,    0},
-    {"unset",               parse_set,             M_SET_UNSET},
     {"unsubscribe",         parse_unsubscribe,     0},
     {NULL, NULL, 0}
 };
     {"unsubscribe",         parse_unsubscribe,     0},
     {NULL, NULL, 0}
 };
index 5c9b9a6..17ee21f 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -740,12 +740,11 @@ int mutt_parse_bind (BUFFER * buf, BUFFER * s, unsigned long data __attribute__
 {
   struct binding_t *bindings = NULL;
   char *key;
 {
   struct binding_t *bindings = NULL;
   char *key;
-  int menu[sizeof (Menus) / sizeof (struct mapping_t) - 1], r =
+  int menu[countof(Menus) - 1], r =
     0, nummenus, i;
 
     0, nummenus, i;
 
-  if ((key = parse_keymap (menu, s, sizeof (menu) / sizeof (menu[0]),
-                           &nummenus, err)) == NULL)
-    return (-1);
+  if (!(key = parse_keymap(menu, s, countof(menu), &nummenus, err)))
+    return -1;
 
   /* function to execute */
   mutt_extract_token (buf, s, 0);
 
   /* function to execute */
   mutt_extract_token (buf, s, 0);
index e58a75e..114c043 100644 (file)
  */
 
 %include {
  */
 
 %include {
+#   include <lib-lib/lib-lib.h>
 #   include "mutt.h"
 #   include "parse.h"
 #   include "mutt.h"
 #   include "parse.h"
+#   include "buffy.h"
 
     static buffer_t *buffer_merge(buffer_t *A, buffer_t **B)
     {
 
     static buffer_t *buffer_merge(buffer_t *A, buffer_t **B)
     {
@@ -128,6 +130,7 @@ to_eol ::= sp to_eol_aux .
 /****************************************************************************/
 /* Our macro tokens                                                         */
 /****************************************************************************/
 /****************************************************************************/
 /* Our macro tokens                                                         */
 /****************************************************************************/
+/*                                                                       {{{*/
 
 %type svar { segment }
 svar(Z) ::= DOLLAR ATOM(B) .               { Z = B; }
 
 %type svar { segment }
 svar(Z) ::= DOLLAR ATOM(B) .               { Z = B; }
@@ -180,13 +183,18 @@ uqtok(Z) ::= SQUOTE sqtok(A) SQUOTE .      { Z = A; }
 uqtok(Z) ::= DQUOTE dqtok(A) DQUOTE .      { Z = A; }
 uqtok(Z) ::= BQUOTE bqtok(A) BQUOTE .      { /* XXX */ Z = A; }
 
 uqtok(Z) ::= DQUOTE dqtok(A) DQUOTE .      { Z = A; }
 uqtok(Z) ::= BQUOTE bqtok(A) BQUOTE .      { /* XXX */ Z = A; }
 
-/* token accumulator */
+/* token accumulator: NEVER USE DIRECTLY */
+%type tokaux { buffer_t* }
+%destructor tokaux { abort(); }
+tokaux(Z) ::= uqtok(A) .                   { Z = A; }
+tokaux(Z) ::= tokaux(A) escnl .            { Z = A; }
+tokaux(Z) ::= tokaux(A) uqtok(B) .         { Z = buffer_merge(A, &B); }
+
 %type token { buffer_t* }
 %destructor token { buffer_delete(&$$); }
 %type token { buffer_t* }
 %destructor token { buffer_delete(&$$); }
-token(Z) ::= uqtok(A) .                    { Z = A; }
-token(Z) ::= token(A) escnl .              { Z = A; }
-token(Z) ::= token(A) uqtok(B) .           { Z = buffer_merge(A, &B); }
+token(Z) ::= sp tokaux(A) .                 { Z = A; }
 
 
+/*                                                                       }}}*/
 /****************************************************************************/
 /* list of tokens                                                           */
 /****************************************************************************/
 /****************************************************************************/
 /* list of tokens                                                           */
 /****************************************************************************/
@@ -194,10 +202,15 @@ token(Z) ::= token(A) uqtok(B) .           { Z = buffer_merge(A, &B); }
 %type simple_list { string_list_t * }
 %destructor simple_list { string_list_wipe(&$$); }
 simple_list ::= .
 %type simple_list { string_list_t * }
 %destructor simple_list { string_list_wipe(&$$); }
 simple_list ::= .
-simple_list(L) ::= simple_list(A) sp token(B) . {
-    L = string_item_new();
-    L->data = buffer_unwrap(&B);
-    L->next = A;
+simple_list(L) ::= simple_list(A) token(B) . {
+    if (B->len) {
+        L = string_item_new();
+        L->data = buffer_unwrap(&B);
+        L->next = A;
+    } else {
+        L = A;
+        buffer_delete(&B);
+    }
 }
 
 
 }
 
 
@@ -209,6 +222,118 @@ rc ::= rclines .
 rclines ::= .
 rclines ::= rclines rcline .
 
 rclines ::= .
 rclines ::= rclines rcline .
 
+rcline ::= to_eol .
+rcline ::= BIND token token token to_eol .
+rcline ::= EXEC simple_list to_eol .
+rcline ::= MACRO token token token to_eol .
+rcline ::= MACRO token token token token to_eol .
+rcline ::= PUSH token to_eol .
+rcline ::= SCORE token token to_eol .
+rcline ::= UNSCORE simple_list to_eol .
+
+/* {{{ alias */
+
+%type atok { buffer_t* }
+%destructor atok { buffer_delete(&$$); }
+atok(Z) ::= ATOM|SHARP|DQUOTE|EQUAL|LBRACE|SQUOTE|RBRACE(A) . {
+    buffer_add(Z = buffer_new(), A.s, A.len);
+}
+atok(Z) ::= SPACE(A) . {
+    buffer_add(Z = buffer_new(), A.s, A.len);
+}
+atok(Z) ::= atok(A) escnl .              { Z = A; }
+atok(Z) ::= atok(A) BSLASH non_nl(B) .   { Z = buffer_escape(A, B.s, B.len); }
+atok(Z) ::= atok(A) svar(B) .            { substvar(Z = A, B); }
+atok(Z) ::= atok(A) BQUOTE bqtok(B) BQUOTE . { /* XXX */ buffer_merge(Z = A, &B); }
+
+rcline ::= ALIAS token SPACE atok to_eol .
+
+/* }}} */
+/* {{{ colors */
+
+rcline ::= COLOR token token token to_eol .
+rcline ::= COLOR token token token token to_eol .
+rcline ::= UNCOLOR token simple_list to_eol .
+rcline ::= MONO token token to_eol .
+rcline ::= MONO token token token to_eol .
+rcline ::= UNMONO token simple_list to_eol .
+
+/* }}} */
+/* {{{ hooks */
+
+rcline ::= ACCOUNT_HOOK token token to_eol .
+rcline ::= APPEND_HOOK token token to_eol .
+rcline ::= CHARSET_HOOK token token to_eol .
+rcline ::= CLOSE_HOOK token token to_eol .
+rcline ::= CRYPT_HOOK token token to_eol .
+rcline ::= FCC_HOOK token token to_eol .
+rcline ::= FCC_SAVE_HOOK token token to_eol .
+rcline ::= FOLDER_HOOK token token to_eol .
+rcline ::= ICONV_HOOK token token to_eol .
+rcline ::= MBOX_HOOK token token to_eol .
+rcline ::= MESSAGE_HOOK token token to_eol .
+rcline ::= OPEN_HOOK token token to_eol .
+rcline ::= PGP_HOOK token token to_eol .
+rcline ::= REPLY_HOOK token token to_eol .
+rcline ::= SAVE_HOOK token token to_eol .
+rcline ::= SEND2_HOOK token token to_eol .
+rcline ::= SEND_HOOK token token to_eol .
+
+rcline ::= UNHOOK token to_eol .
+
+/* }}} */
+/* {{{ buffy related  */
+
+mailboxes ::= .
+mailboxes ::= mailboxes token(A) . {
+    if (A->len) {
+        char buf[_POSIX_PATH_MAX];
+        BUFFY *tmp;
+        int i;
+
+        m_strcpy(buf, sizeof(buf), A->data);
+        mutt_expand_path(buf, sizeof(buf));
+        i = buffy_lookup(buf);
+        if (i < 0) {
+            tmp = p_new(BUFFY, 1);
+            tmp->path = m_strdup(buf);
+            buffy_array_append(&Incoming, tmp);
+        } else {
+            tmp = Incoming.arr[i];
+        }
+
+        tmp->new = 0;
+        tmp->notified = 1;
+        tmp->newly_created = 0;
+    }
+    buffer_delete(&A);
+}
+rcline ::= MAILBOXES mailboxes to_eol .
+
+unmailboxes ::= .
+unmailboxes ::= unmailboxes token(A) . {
+    if (A->len) {
+        if (A->data[0] == '*' && A->len == 1) {
+            buffy_array_wipe(&Incoming);
+        } else {
+            char buf[_POSIX_PATH_MAX];
+            BUFFY *tmp;
+            int i;
+
+            m_strcpy(buf, sizeof(buf), A->data);
+            mutt_expand_path(buf, sizeof(buf));
+            i = buffy_lookup(buf);
+            tmp = buffy_array_take(&Incoming, i);
+            buffy_delete(&tmp);
+        }
+    }
+    buffer_delete(&A);
+}
+rcline ::= UNMAILBOXES unmailboxes to_eol .
+
+/* }}} */
+/* {{{ lists (alternative_order, auto_view, hdr_order, mime_lookup */
+
 rcline ::= ALTERNATIVE_ORDER simple_list(L) to_eol . {
     string_list_append(&AlternativeOrderList, string_list_rev(L));
 }
 rcline ::= ALTERNATIVE_ORDER simple_list(L) to_eol . {
     string_list_append(&AlternativeOrderList, string_list_rev(L));
 }
@@ -222,5 +347,6 @@ rcline ::= MIME_LOOKUP       simple_list(L) to_eol . {
     string_list_append(&MimeLookupList, string_list_rev(L));
 }
 
     string_list_append(&MimeLookupList, string_list_rev(L));
 }
 
+/* }}} */
 
 /* vim: set indentexpr= cin: */
 
 /* vim: set indentexpr= cin: */
index 2ad6aa2..94f5ed9 100755 (executable)
@@ -38,7 +38,7 @@ do_tokens() {
 }
 
 do_c() {
 }
 
 do_c() {
-    cat <<EOF | gperf --ignore-case -m16 -l -t -C -F",0" -Nrc_which_token_aux
+    cat <<EOF | gperf -m16 -l -t -C -F",0" -Nrc_which_token_aux
 %{
 `do_hdr`
 
 %{
 `do_hdr`