Commit aab945ef aab945ef61deb74a0b43879511b965ded7f99cb9 by Sergey Poznyakoff

Use new struct mh_option

1 parent dc57ec18
......@@ -35,8 +35,8 @@ static struct argp_option options[] = {
/* Traditional MH options */
struct mh_option mh_option[] = {
{"form", 4, 'F', MH_OPT_ARG, "formatfile"},
{"format", 5, 't', MH_OPT_ARG, "string"},
{"form", 4, NULL, MH_OPT_ARG, "formatfile"},
{"format", 5, NULL, MH_OPT_ARG, "string"},
{ 0 }
};
......
......@@ -71,16 +71,16 @@ static struct argp_option options[] = {
/* Traditional MH options */
struct mh_option mh_option[] = {
{"print", 2, 'p', 0, NULL },
{"list", 1, 'l', 0, NULL },
{"push", 2, ARG_PUSH, 0, NULL },
{"pop", 2, ARG_POP, 0, NULL },
{"all", 1, 'a', 0, NULL },
{"create", 1, 'c', MH_OPT_BOOL, NULL},
{"fast", 1, 'F', MH_OPT_BOOL, NULL},
{"header", 1, 'h', MH_OPT_BOOL, NULL},
{"recurse", 1, 'r', MH_OPT_BOOL, NULL},
{"total", 1, 't', MH_OPT_BOOL, NULL},
{"print", 2, NULL, 0, NULL },
{"list", 1, NULL, 0, NULL },
{"push", 2, NULL, 0, NULL },
{"pop", 2, NULL, 0, NULL },
{"all", 1, NULL, 0, NULL },
{"create", 1, NULL, MH_OPT_BOOL, NULL},
{"fast", 1, NULL, MH_OPT_BOOL, NULL},
{"header", 1, NULL, MH_OPT_BOOL, NULL},
{"recurse", 1, NULL, MH_OPT_BOOL, NULL},
{"total", 1, NULL, MH_OPT_BOOL, NULL},
{NULL},
};
......
......@@ -46,15 +46,15 @@ static struct argp_option options[] = {
/* Traditional MH options */
struct mh_option mh_option[] = {
{"audit", 5, 'a', MH_OPT_ARG, "audit-file" },
{"noaudit", 3, 'n', 0, },
{"changecur", 1, 'c',MH_OPT_BOOL},
{"file", 2, 'i', MH_OPT_ARG, "input-file"},
{"form", 4, 'F', MH_OPT_ARG, "format-file"},
{"format", 5, 't', MH_OPT_ARG, "string"},
{"truncate", 2, 'T', MH_OPT_BOOL, },
{"width", 1, 'w', MH_OPT_ARG, "number"},
{"quiet", 1, 'q', 0, },
{"audit", 5, NULL, MH_OPT_ARG, "audit-file" },
{"noaudit", 3, NULL, 0, },
{"changecur", 1, NULL, MH_OPT_BOOL},
{"file", 2, NULL, MH_OPT_ARG, "input-file"},
{"form", 4, NULL, MH_OPT_ARG, "format-file"},
{"format", 5, NULL, MH_OPT_ARG, "string"},
{"truncate", 2, NULL, MH_OPT_BOOL, },
{"width", 1, NULL, MH_OPT_ARG, "number"},
{"quiet", 1, NULL, 0, },
{ 0 }
};
......
......@@ -46,11 +46,11 @@ static struct argp_option options[] = {
/* Traditional MH options */
struct mh_option mh_option[] = {
{"file", 2, 'F', 0, "input-file"},
{"draft", 1, 'd', 0, NULL },
{"link", 1, 'l', MH_OPT_BOOL, NULL },
{"preserve", 1, 'p', MH_OPT_BOOL, NULL },
{"src", 1, 's', 0, "+folder" },
{"file", 2, NULL, 0, "input-file"},
{"draft", 1, NULL, 0, NULL },
{"link", 1, NULL, MH_OPT_BOOL, NULL },
{"preserve", 1, NULL, MH_OPT_BOOL, NULL },
{"src", 1, NULL, 0, "+folder" },
{ 0 }
};
......
......@@ -68,23 +68,23 @@ static struct argp_option options[] = {
/* Traditional MH options */
struct mh_option mh_option[] = {
{"annotate", 1, 'a', MH_OPT_BOOL },
{"build", 1, 'b', },
{"cc", 1, 'c', MH_OPT_ARG, "all/to/cc/me"},
{"nocc", 3, 'n', MH_OPT_ARG, "all/to/cc/me"},
{"form", 4, 'F', MH_OPT_ARG, "formatfile"},
{"width", 1, 'w', MH_OPT_ARG, "number"},
{"draftfolder", 6, 'd', MH_OPT_ARG, "folder"},
{"nodraftfolder", 3, ARG_NODRAFTFOLDER, },
{"draftmessage", 6, 'm' },
{"editor", 1, 'e', MH_OPT_ARG, "program"},
{"noedit", 3, ARG_NOEDIT, },
{"fcc", 1, ARG_FCC, MH_OPT_ARG, "folder"},
{"filter", 2, ARG_FILTER, MH_OPT_ARG, "program"},
{"inplace", 1, ARG_INPLACE, MH_OPT_BOOL },
{"query", 1, ARG_QUERY, MH_OPT_BOOL },
{"whatnowproc", 2, ARG_WHATNOWPROC, MH_OPT_ARG, "program"},
{"nowhatnowproc", 3, ARG_NOWHATNOWPROC },
{"annotate", 1, NULL, MH_OPT_BOOL },
{"build", 1, NULL, },
{"cc", 1, NULL, MH_OPT_ARG, "all/to/cc/me"},
{"nocc", 3, NULL, MH_OPT_ARG, "all/to/cc/me"},
{"form", 4, NULL, MH_OPT_ARG, "formatfile"},
{"width", 1, NULL, MH_OPT_ARG, "number"},
{"draftfolder", 6, NULL, MH_OPT_ARG, "folder"},
{"nodraftfolder", 3, NULL },
{"draftmessage", 6, NULL },
{"editor", 1, NULL, MH_OPT_ARG, "program"},
{"noedit", 3, NULL, },
{"fcc", 1, NULL, MH_OPT_ARG, "folder"},
{"filter", 2, NULL, MH_OPT_ARG, "program"},
{"inplace", 1, NULL, MH_OPT_BOOL },
{"query", 1, NULL, MH_OPT_BOOL },
{"whatnowproc", 2, NULL, MH_OPT_ARG, "program"},
{"nowhatnowproc", 3, NULL },
{ 0 }
};
......@@ -95,9 +95,8 @@ static char *format_str =
"%<(nonnull)%(void(width))%(putaddr cc: )\\n%>"
"%<{fcc}Fcc: %{fcc}\\n%>"
"%<{subject}Subject: Re: %(unre{subject})\\n%>"
"%<{date}In-reply-to: Your message of \""
"%<(nodate{date})%{date}%|%(pretty{date})%>.\"%<{message-id}\n"
" %{message-id}%>\\n%>"
"%(lit)%(concat(in_reply_to))%<(nonnull)%(void(width))%(printstr In-reply-to: )\\n%>"
"%(lit)%(concat(references))%<(nonnull)%(void(width))%(printstr References: )\\n%>"
"--------\n";
static mh_format_t format;
......@@ -119,12 +118,14 @@ decode_cc_flag (const char *opt, const char *arg)
mh_error (_("%s %s is unknown"), opt, arg);
exit (1);
}
return 0; /* never reached */
return rc;
}
static int
opt_handler (int key, char *arg, void *unused)
{
char *s;
switch (key)
{
case 'b':
......@@ -137,7 +138,7 @@ opt_handler (int key, char *arg, void *unused)
break;
case 'n':
rcpt_mask ^= decode_cc_flag ("-nocc", arg);
rcpt_mask &= ~decode_cc_flag ("-nocc", arg);
break;
case 'd':
......@@ -154,7 +155,9 @@ opt_handler (int key, char *arg, void *unused)
break;
case 'F':
mh_read_formfile (arg, &format_str);
s = mh_expand_name (MHLIBDIR, arg, 0);
mh_read_formfile (s, &format_str);
free (s);
break;
case 'm':
......
......@@ -44,7 +44,7 @@ static struct argp_option options[] = {
/* Traditional MH options */
struct mh_option mh_option[] = {
{"interactive", 1, 'i', MH_OPT_BOOL, NULL},
{"interactive", 1, NULL, MH_OPT_BOOL, NULL},
{ 0 }
};
......
......@@ -52,13 +52,13 @@ static struct argp_option options[] = {
/* Traditional MH options */
struct mh_option mh_option[] = {
{"clear", 1, 'c', MH_OPT_BOOL},
{"form", 4, 'F', MH_OPT_ARG, "formatfile"},
{"format", 5, 't', MH_OPT_ARG, "string"},
{"header", 3, 'H', MH_OPT_BOOL},
{"width", 1, 'w', MH_OPT_ARG, "number"},
{"reverse", 1, 'r', MH_OPT_BOOL},
{"file", 4, 'i', MH_OPT_ARG, "file"},
{"clear", 1, NULL, MH_OPT_BOOL},
{"form", 4, NULL, MH_OPT_ARG, "formatfile"},
{"format", 5, NULL, MH_OPT_ARG, "string"},
{"header", 3, NULL, MH_OPT_BOOL},
{"width", 1, NULL, MH_OPT_ARG, "number"},
{"reverse", 1, NULL, MH_OPT_BOOL},
{"file", 4, NULL, MH_OPT_ARG, "file"},
{ 0 }
};
......
......@@ -42,12 +42,12 @@ static struct argp_option options[] = {
/* Traditional MH options */
struct mh_option mh_option[] = {
{"draftfolder", 6, 'd', MH_OPT_ARG, "folder"},
{"nodraftfolder", 3, ARG_NODRAFTFOLDER, },
{"draftmessage", 6, 'm' },
{"editor", 1, 'e', MH_OPT_ARG, "program"},
{"noedit", 3, ARG_NOEDIT, },
{"prompt", 1, 'p' },
{"draftfolder", 6, NULL, MH_OPT_ARG, "folder"},
{"nodraftfolder", 3, NULL, },
{"draftmessage", 6, NULL },
{"editor", 1, NULL, MH_OPT_ARG, "program"},
{"noedit", 3, NULL, },
{"prompt", 1, NULL },
{ 0 }
};
......