Commit 9fdb4e5a 9fdb4e5af89a211bc6d05f8c64b4051b174c7855 by Sergey Poznyakoff

Renamed mail/var.c to mail/escape.c to fix a long-standing historical

inconsistency.

(var_shell,var_command,var_help,var_sign,var_bcc)
(var_cc,var_deadletter,var_editor,var_print,var_headers)
(var_insert,var_quote,var_type_input,var_read,var_subj)
(var_to,var_visual,var_write,var_exit,var_pipe): Renamed:
s/var_/escape_/. All callers updated
1 parent effde3f5
......@@ -47,6 +47,7 @@ mail_SOURCES = \
echo.c\
edit.c\
eq.c\
escape.c\
exit.c\
file.c\
folders.c\
......@@ -87,7 +88,6 @@ mail_SOURCES = \
undelete.c\
unset.c\
util.c\
var.c\
version.c\
visual.c\
write.c\
......
......@@ -152,13 +152,13 @@ parse_headers (FILE *fp, compose_env_t *env)
}
static void
var_continue (void)
escape_continue (void)
{
fprintf (stdout, _("(continue)\n"));
}
static int
var_check_args (int argc, char **argv)
escape_check_args (int argc, char **argv)
{
if (argc == 1)
{
......@@ -172,7 +172,7 @@ var_check_args (int argc, char **argv)
/* ~![shell-command] */
int
var_shell (int argc, char **argv, compose_env_t *env)
escape_shell (int argc, char **argv, compose_env_t *env)
{
int status;
ofile = env->ofile;
......@@ -185,12 +185,12 @@ var_shell (int argc, char **argv, compose_env_t *env)
/* ~:[mail-command] */
/* ~-[mail-command] */
int
var_command (int argc, char **argv, compose_env_t *env)
escape_command (int argc, char **argv, compose_env_t *env)
{
struct mail_command_entry *entry;
int status;
if (var_check_args (argc, argv))
if (escape_check_args (argc, argv))
return 1;
if (argv[1][0] == '#')
return 0;
......@@ -214,26 +214,22 @@ var_command (int argc, char **argv, compose_env_t *env)
/* ~? */
int
var_help (int argc, char **argv, compose_env_t *env ARG_UNUSED)
escape_help (int argc, char **argv, compose_env_t *env ARG_UNUSED)
{
int status;
if (argc < 2)
return mail_escape_help (NULL);
status = mail_escape_help (NULL);
else
{
int status = 0;
while (--argc)
status |= mail_escape_help (*++argv);
escape_continue ();
return status;
}
return 1;
}
/* ~A */
/* ~a */
int
var_sign (int argc ARG_UNUSED, char **argv, compose_env_t *env ARG_UNUSED)
escape_sign (int argc ARG_UNUSED, char **argv, compose_env_t *env ARG_UNUSED)
{
char *p;
......@@ -263,14 +259,14 @@ var_sign (int argc ARG_UNUSED, char **argv, compose_env_t *env ARG_UNUSED)
}
else
fprintf (ofile, "%s", p);
var_continue ();
escape_continue ();
}
return 0;
}
/* ~b[bcc-list] */
int
var_bcc (int argc, char **argv, compose_env_t *env)
escape_bcc (int argc, char **argv, compose_env_t *env)
{
while (--argc)
compose_header_set (env, MU_HEADER_BCC, *++argv, COMPOSE_SINGLE_LINE);
......@@ -279,7 +275,7 @@ var_bcc (int argc, char **argv, compose_env_t *env)
/* ~c[cc-list] */
int
var_cc (int argc, char **argv, compose_env_t *env)
escape_cc (int argc, char **argv, compose_env_t *env)
{
while (--argc)
compose_header_set (env, MU_HEADER_CC, *++argv, COMPOSE_SINGLE_LINE);
......@@ -288,7 +284,7 @@ var_cc (int argc, char **argv, compose_env_t *env)
/* ~d */
int
var_deadletter (int argc ARG_UNUSED, char **argv ARG_UNUSED,
escape_deadletter (int argc ARG_UNUSED, char **argv ARG_UNUSED,
compose_env_t *env ARG_UNUSED)
{
FILE *dead = fopen (getenv ("DEAD"), "r");
......@@ -312,7 +308,7 @@ run_editor (char *ed, char *arg)
}
static int
var_run_editor (char *ed, int argc, char **argv, compose_env_t *env)
escape_run_editor (char *ed, int argc, char **argv, compose_env_t *env)
{
if (!util_getenv (NULL, "editheaders", Mail_env_boolean, 0))
{
......@@ -360,28 +356,28 @@ var_run_editor (char *ed, int argc, char **argv, compose_env_t *env)
env->file = fopen (env->filename, "a+");
ofile = env->file;
var_continue ();
escape_continue ();
return 0;
}
/* ~e */
int
var_editor (int argc, char **argv, compose_env_t *env)
escape_editor (int argc, char **argv, compose_env_t *env)
{
return var_run_editor (getenv ("EDITOR"), argc, argv, env);
return escape_run_editor (getenv ("EDITOR"), argc, argv, env);
}
/* ~v */
int
var_visual (int argc, char **argv, compose_env_t *env)
escape_visual (int argc, char **argv, compose_env_t *env)
{
return var_run_editor (getenv ("VISUAL"), argc, argv, env);
return escape_run_editor (getenv ("VISUAL"), argc, argv, env);
}
/* ~f[mesg-list] */
/* ~F[mesg-list] */
int
var_print (int argc, char **argv, compose_env_t *env ARG_UNUSED)
escape_print (int argc, char **argv, compose_env_t *env ARG_UNUSED)
{
return mail_print (argc, argv);
}
......@@ -398,23 +394,23 @@ reread_header (compose_env_t *env, char *hdr, char *prompt)
/* ~h */
int
var_headers (int argc, char **argv, compose_env_t *env)
escape_headers (int argc, char **argv, compose_env_t *env)
{
reread_header (env, MU_HEADER_TO, "To: ");
reread_header (env, MU_HEADER_CC, "Cc: ");
reread_header (env, MU_HEADER_BCC, "Bcc: ");
reread_header (env, MU_HEADER_SUBJECT, "Subject: ");
var_continue ();
escape_continue ();
return 0;
}
/* ~i[var-name] */
int
var_insert (int argc, char **argv, compose_env_t *send_env ARG_UNUSED)
escape_insert (int argc, char **argv, compose_env_t *send_env ARG_UNUSED)
{
struct mail_env_entry *env;
if (var_check_args (argc, argv))
if (escape_check_args (argc, argv))
return 1;
env = util_find_env (argv[1], 0);
if (env)
......@@ -506,17 +502,17 @@ quote0 (msgset_t *mspec, message_t mesg, void *data)
}
int
var_quote (int argc, char **argv, compose_env_t *env)
escape_quote (int argc, char **argv, compose_env_t *env)
{
int lower = islower (argv[0][0]);
util_foreach_msg (argc, argv, MSG_NODELETED|MSG_SILENT, quote0, &lower);
var_continue ();
escape_continue ();
return 0;
}
/* ~p */
int
var_type_input (int argc, char **argv, compose_env_t *env)
escape_type_input (int argc, char **argv, compose_env_t *env)
{
char buffer[512];
......@@ -528,21 +524,21 @@ var_type_input (int argc, char **argv, compose_env_t *env)
while (fgets (buffer, sizeof (buffer), env->file))
fputs (buffer, env->ofile);
var_continue ();
escape_continue ();
return 0;
}
/* ~r[filename] */
int
var_read (int argc, char **argv, compose_env_t *env ARG_UNUSED)
escape_read (int argc, char **argv, compose_env_t *env ARG_UNUSED)
{
char *filename;
FILE *inf;
size_t size, lines;
char buf[512];
if (var_check_args (argc, argv))
if (escape_check_args (argc, argv))
return 1;
filename = util_fullpath (argv[1]);
inf = fopen (filename, "r");
......@@ -569,9 +565,9 @@ var_read (int argc, char **argv, compose_env_t *env ARG_UNUSED)
/* ~s[string] */
int
var_subj (int argc, char **argv, compose_env_t *env)
escape_subj (int argc, char **argv, compose_env_t *env)
{
if (var_check_args (argc, argv))
if (escape_check_args (argc, argv))
return 1;
compose_header_set (env, MU_HEADER_SUBJECT, argv[1], COMPOSE_REPLACE);
return 0;
......@@ -579,7 +575,7 @@ var_subj (int argc, char **argv, compose_env_t *env)
/* ~t[name-list] */
int
var_to (int argc, char **argv, compose_env_t *env)
escape_to (int argc, char **argv, compose_env_t *env)
{
while (--argc)
compose_header_set (env, MU_HEADER_TO, *++argv, COMPOSE_SINGLE_LINE);
......@@ -588,14 +584,14 @@ var_to (int argc, char **argv, compose_env_t *env)
/* ~w[filename] */
int
var_write (int argc, char **argv, compose_env_t *env)
escape_write (int argc, char **argv, compose_env_t *env)
{
char *filename;
FILE *fp;
size_t size, lines;
char buf[512];
if (var_check_args (argc, argv))
if (escape_check_args (argc, argv))
return 1;
filename = util_fullpath (argv[1]);
......@@ -625,7 +621,7 @@ var_write (int argc, char **argv, compose_env_t *env)
/* ~|[shell-command] */
int
var_pipe (int argc, char **argv, compose_env_t *env)
escape_pipe (int argc, char **argv, compose_env_t *env)
{
int p[2];
pid_t pid;
......
......@@ -257,26 +257,26 @@ extern char *mail_expand_name __P((const char *name));
extern void send_append_header __P((char *text));
extern void send_append_header2 __P((char *name, char *value, int mode));
extern int var_shell __P ((int argc, char **argv, compose_env_t *env));
extern int var_command __P ((int argc, char **argv, compose_env_t *env));
extern int var_help __P ((int argc, char **argv, compose_env_t *env));
extern int var_sign __P ((int argc, char **argv, compose_env_t *env));
extern int var_bcc __P ((int argc, char **argv, compose_env_t *env));
extern int var_cc __P ((int argc, char **argv, compose_env_t *env));
extern int var_deadletter __P ((int argc, char **argv, compose_env_t *env));
extern int var_editor __P ((int argc, char **argv, compose_env_t *env));
extern int var_print __P ((int argc, char **argv, compose_env_t *env));
extern int var_headers __P ((int argc, char **argv, compose_env_t *env));
extern int var_insert __P ((int argc, char **argv, compose_env_t *env));
extern int var_quote __P ((int argc, char **argv, compose_env_t *env));
extern int var_type_input __P ((int argc, char **argv, compose_env_t *env));
extern int var_read __P ((int argc, char **argv, compose_env_t *env));
extern int var_subj __P ((int argc, char **argv, compose_env_t *env));
extern int var_to __P ((int argc, char **argv, compose_env_t *env));
extern int var_visual __P ((int argc, char **argv, compose_env_t *env));
extern int var_write __P ((int argc, char **argv, compose_env_t *env));
extern int var_exit __P ((int argc, char **argv, compose_env_t *env));
extern int var_pipe __P ((int argc, char **argv, compose_env_t *env));
extern int escape_shell __P ((int argc, char **argv, compose_env_t *env));
extern int escape_command __P ((int argc, char **argv, compose_env_t *env));
extern int escape_help __P ((int argc, char **argv, compose_env_t *env));
extern int escape_sign __P ((int argc, char **argv, compose_env_t *env));
extern int escape_bcc __P ((int argc, char **argv, compose_env_t *env));
extern int escape_cc __P ((int argc, char **argv, compose_env_t *env));
extern int escape_deadletter __P ((int argc, char **argv, compose_env_t *env));
extern int escape_editor __P ((int argc, char **argv, compose_env_t *env));
extern int escape_print __P ((int argc, char **argv, compose_env_t *env));
extern int escape_headers __P ((int argc, char **argv, compose_env_t *env));
extern int escape_insert __P ((int argc, char **argv, compose_env_t *env));
extern int escape_quote __P ((int argc, char **argv, compose_env_t *env));
extern int escape_type_input __P ((int argc, char **argv, compose_env_t *env));
extern int escape_read __P ((int argc, char **argv, compose_env_t *env));
extern int escape_subj __P ((int argc, char **argv, compose_env_t *env));
extern int escape_to __P ((int argc, char **argv, compose_env_t *env));
extern int escape_visual __P ((int argc, char **argv, compose_env_t *env));
extern int escape_write __P ((int argc, char **argv, compose_env_t *env));
extern int escape_exit __P ((int argc, char **argv, compose_env_t *env));
extern int escape_pipe __P ((int argc, char **argv, compose_env_t *env));
/* Cursor */
extern void set_cursor __P ((unsigned value));
......
......@@ -216,29 +216,29 @@ mail_command_name (int i)
}
static const struct mail_escape_entry mail_escape_table[] = {
{"!", "!", "![shell-command]", var_shell },
{":", ":", ":[mail-command]", var_command },
{"-", "-", "-[mail-command]", var_command },
{"?", "?", "?", var_help },
{"A", "A", "A", var_sign },
{"a", "a", "a", var_sign },
{"b", "b", "b[bcc-list]", var_bcc },
{"c", "c", "c[cc-list]", var_cc },
{"d", "d", "d", var_deadletter },
{"e", "e", "e", var_editor },
{"f", "f", "f[mesg-list]", var_print },
{"F", "F", "F[mesg-list]", var_print },
{"h", "h", "h", var_headers },
{"i", "i", "i[var-name]", var_insert },
{"m", "m", "m[mesg-list]", var_quote },
{"M", "M", "M[mesg-list]", var_quote },
{"p", "p", "p", var_type_input },
{"r", "<", "r[filename]", var_read },
{"s", "s", "s[string]", var_subj },
{"t", "t", "t[name-list]", var_to },
{"v", "v", "v", var_visual },
{"w", "w", "w[filename]", var_write },
{"|", "|", "|[shell-command]", var_pipe },
{"!", "!", "![shell-command]", escape_shell },
{":", ":", ":[mail-command]", escape_command },
{"-", "-", "-[mail-command]", escape_command },
{"?", "?", "?", escape_help },
{"A", "A", "A", escape_sign },
{"a", "a", "a", escape_sign },
{"b", "b", "b[bcc-list]", escape_bcc },
{"c", "c", "c[cc-list]", escape_cc },
{"d", "d", "d", escape_deadletter },
{"e", "e", "e", escape_editor },
{"f", "f", "f[mesg-list]", escape_print },
{"F", "F", "F[mesg-list]", escape_print },
{"h", "h", "h", escape_headers },
{"i", "i", "i[var-name]", escape_insert },
{"m", "m", "m[mesg-list]", escape_quote },
{"M", "M", "M[mesg-list]", escape_quote },
{"p", "p", "p", escape_type_input },
{"r", "<", "r[filename]", escape_read },
{"s", "s", "s[string]", escape_subj },
{"t", "t", "t[name-list]", escape_to },
{"v", "v", "v", escape_visual },
{"w", "w", "w[filename]", escape_write },
{"|", "|", "|[shell-command]", escape_pipe },
};
const struct mail_escape_entry *
......