X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-mime%2Fmime-token.sh;h=229394c24544129a1472adafa891ac1b6a148b23;hp=17ed4c1479eeb155ef124d65cb9ae9f886190164;hb=926c11d6cc2cf92ec20792edaef2608d3f3b198b;hpb=f9c8b43480b416548e29d2fccc2a7c5086a6c3a1 diff --git a/lib-mime/mime-token.sh b/lib-mime/mime-token.sh index 17ed4c1..229394c 100644 --- a/lib-mime/mime-token.sh +++ b/lib-mime/mime-token.sh @@ -39,7 +39,7 @@ do_h() { enum mime_token { MUTT_MIME_TOKEN_UNKNOWN, -`tr 'a-z-' 'A-Z_' | sed -e 's/.*/ MIME_&,/'` +`tr 'a-z-/' 'A-Z__' | sed -e 's/.*/ MIME_&,/'` }; __attribute__((pure)) @@ -53,25 +53,29 @@ do_c() { %{ `do_hdr` -#include +#include #include "mime-token.h" +static const struct tok * +mime_which_token_aux(const char *str, unsigned int len); + %} struct tok { const char *name; int val; }; %% `awk '{print $0 ", " NR }'` %% -enum mime_token mime_which_token(const char *s, ssize_t len) { - const struct tok *res; - +enum mime_token mime_which_token(const char *s, ssize_t len) +{ if (len < 0) len = m_strlen(s); - if (!len) - return MUTT_MIME_TOKEN_UNKNOWN; - res = mime_which_token_aux(s, len); - return res ? res->val : MUTT_MIME_TOKEN_UNKNOWN; + if (len) { + const struct tok *res = mime_which_token_aux(s, len); + return res ? res->val : MUTT_MIME_TOKEN_UNKNOWN; + } else { + return MUTT_MIME_TOKEN_UNKNOWN; + } } EOF }