* user.c (execute_menu_command): Implement %view macro.

This commit is contained in:
Pavel Roskin 2003-09-04 17:02:21 +00:00
parent c68d1ab16a
commit 6349237830
2 changed files with 21 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2003-09-04 Andrew V. Samoilov <sav@bcs.zp.ua>
* user.c (execute_menu_command): Implement %view macro.
2003-09-03 Pavel Roskin <proski@gnu.org> 2003-09-03 Pavel Roskin <proski@gnu.org>
* wtools.c (create_listbox_window): Don't repaint the dialog * wtools.c (create_listbox_window): Don't repaint the dialog

View File

@ -544,7 +544,7 @@ static char *test_line (WEdit *edit_widget, char *p, int *result)
/* FIXME: recode this routine on version 3.0, it could be cleaner */ /* FIXME: recode this routine on version 3.0, it could be cleaner */
static void static void
execute_menu_command (WEdit *edit_widget, char *commands) execute_menu_command (WEdit *edit_widget, const char *commands)
{ {
FILE *cmd_file; FILE *cmd_file;
int cmd_file_fd; int cmd_file_fd;
@ -554,6 +554,7 @@ execute_menu_command (WEdit *edit_widget, char *commands)
char prompt [80]; char prompt [80];
int col; int col;
char *file_name; char *file_name;
int run_view = 0;
/* Skip menu entry title line */ /* Skip menu entry title line */
commands = strchr (commands, '\n'); commands = strchr (commands, '\n');
@ -621,15 +622,26 @@ execute_menu_command (WEdit *edit_widget, char *commands)
} }
} else { } else {
if (*commands == '%') { if (*commands == '%') {
int i = check_format_view (commands + 1);
if (i) {
commands += i;
run_view = 1;
} else {
do_quote = 1; /* Default: Quote expanded macro */ do_quote = 1; /* Default: Quote expanded macro */
expand_prefix_found = 1; expand_prefix_found = 1;
}
} else } else
fputc (*commands, cmd_file); fputc (*commands, cmd_file);
} }
} }
fclose (cmd_file); fclose (cmd_file);
chmod (file_name, S_IRWXU); chmod (file_name, S_IRWXU);
if (run_view) {
run_view = 0;
view (file_name, 0, &run_view, 0);
} else {
shell_execute (file_name, 0); shell_execute (file_name, 0);
}
unlink (file_name); unlink (file_name);
g_free (file_name); g_free (file_name);
} }