1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
--- PATCHES.orig 2019-06-15 21:17:01 UTC
+++ PATCHES
@@ -0,0 +1 @@
+patch-1.5.4.cd.ifdef.1
--- init.c.orig 2019-05-25 16:22:39 UTC
+++ init.c
@@ -651,6 +651,52 @@ static mbchar_table *parse_mbchar_table (const char *s
return t;
}
+static int parse_ifdef (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
+{
+ int i, j, res = 0;
+ BUFFER token;
+
+ memset (&token, 0, sizeof (token));
+ mutt_extract_token (tmp, s, 0);
+
+ /* is the item defined as a variable or a function? */
+ if (!(res = (mutt_option_index (tmp->data) != -1)))
+ for (i = 0; !res && i < MENU_MAX; i++)
+ {
+ struct binding_t *b = km_get_table (Menus[i].value);
+
+ if (!b)
+ continue;
+
+ for (j = 0; b[j].name; j++)
+ if (!ascii_strncasecmp (tmp->data, b[j].name, mutt_strlen (tmp->data))
+ && (mutt_strlen (b[j].name) == mutt_strlen (tmp->data)))
+ {
+ res = 1;
+ break;
+ }
+ }
+
+ if (!MoreArgs (s))
+ {
+ snprintf (err->data, err->dsize, _("ifdef: too few arguments"));
+ return (-1);
+ }
+ mutt_extract_token (tmp, s, MUTT_TOKEN_SPACE);
+
+ if (res)
+ {
+ if (mutt_parse_rc_line (tmp->data, &token, err) == -1)
+ {
+ mutt_error ("Erreur: %s", err->data);
+ FREE (&token.data);
+ return (-1);
+ }
+ FREE (&token.data);
+ }
+ return 0;
+}
+
static int parse_unignore (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
do
--- init.h.orig 2019-06-15 15:57:01 UTC
+++ init.h
@@ -4330,6 +4330,7 @@ static int parse_lists (BUFFER *, BUFFER *, unsigned l
static int parse_unlists (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_alias (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_unalias (BUFFER *, BUFFER *, unsigned long, BUFFER *);
+static int parse_ifdef (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_echo (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_ignore (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_unignore (BUFFER *, BUFFER *, unsigned long, BUFFER *);
@@ -4394,6 +4395,7 @@ const struct command_t Commands[] = {
{ "hdr_order", parse_list, UL &HeaderOrderList },
#ifdef HAVE_ICONV
{ "iconv-hook", mutt_parse_hook, MUTT_ICONVHOOK },
+ { "ifdef", parse_ifdef, 0 },
#endif
{ "ignore", parse_ignore, 0 },
{ "index-format-hook",mutt_parse_idxfmt_hook, MUTT_IDXFMTHOOK },
|