* cmd.c (menu_edit_cmd): Make static, provide separate functions

without arguments to access it.
* menu.h: Make callfn function without arguments - we are not
using any arguments now.
This commit is contained in:
Pavel Roskin 2002-11-14 06:30:16 +00:00
parent 389ed511de
commit d4ddbe5148
7 changed files with 62 additions and 44 deletions

View File

@ -1,3 +1,10 @@
2002-11-14 Pavel Roskin <proski@gnu.org>
* cmd.c (menu_edit_cmd): Make static, provide separate functions
without arguments to access it.
* menu.h: Make callfn function without arguments - we are not
using any arguments now.
2002-11-13 Pavel Roskin <proski@gnu.org>
* man2hlp.c (persistent_fread): Return error for len <= 0.

View File

@ -611,35 +611,10 @@ void ext_cmd (void)
flush_extension_file ();
}
#ifdef USE_INTERNAL_EDIT
void edit_syntax_cmd (void)
{
char *buffer;
char *extdir;
int dir = 0;
if (geteuid () == 0){
dir = query_dialog (_("Syntax file edit"),
_(" Which syntax file you want to edit? "), 0, 2,
_("&User"), _("&System Wide"));
}
extdir = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax");
if (dir == 0){
buffer = concat_dir_and_file (home_dir, SYNTAX_FILE);
check_for_default (extdir, buffer);
do_edit (buffer);
g_free (buffer);
} else if (dir == 1)
do_edit (extdir);
g_free (extdir);
}
#endif
/* where = 0 - do edit a file menu for mc */
/* where = 1 - do edit a file menu for cool edit */
void menu_edit_cmd (int where)
/* where = 0 - do edit file menu for mc */
/* where = 1 - do edit file menu for mcedit */
static void
menu_edit_cmd (int where)
{
char *buffer;
char *menufile;
@ -696,6 +671,49 @@ void quick_chdir_cmd (void)
g_free (target);
}
/* edit file menu for mc */
void
edit_mc_menu_cmd (void)
{
menu_edit_cmd (0);
}
#ifdef USE_INTERNAL_EDIT
/* edit file menu for mcedit */
void
edit_user_menu_cmd (void)
{
menu_edit_cmd (1);
}
/* edit syntax file for mcedit */
void
edit_syntax_cmd (void)
{
char *buffer;
char *extdir;
int dir = 0;
if (geteuid () == 0) {
dir =
query_dialog (_("Syntax file edit"),
_(" Which syntax file you want to edit? "), 0, 2,
_("&User"), _("&System Wide"));
}
extdir = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax");
if (dir == 0) {
buffer = concat_dir_and_file (home_dir, SYNTAX_FILE);
check_for_default (extdir, buffer);
do_edit (buffer);
g_free (buffer);
} else if (dir == 1)
do_edit (extdir);
g_free (extdir);
}
#endif
#ifdef USE_VFS
void free_vfs_now (void)
{

View File

@ -8,9 +8,9 @@ void smblink_cmd (void);
void undelete_cmd (void);
void help_cmd (void);
void dirsizes_cmd (void);
int view_file_at_line (char *filename, int plain_view, int internal,
int start_line);
int view_file (char *filename, int normal, int internal);
int view_file_at_line (char *filename, int plain_view, int internal,
int start_line);
int view_file (char *filename, int normal, int internal);
void view_cmd (void);
void view_file_cmd (void);
void view_simple_cmd (void);
@ -32,7 +32,8 @@ void filter_cmd (void);
void reread_cmd (void);
void tree_view_cmd (void);
void ext_cmd (void);
void menu_edit_cmd (int select);
void edit_mc_menu_cmd (void);
void edit_user_menu_cmd (void);
void edit_syntax_cmd (void);
void quick_chdir_cmd (void);
void compare_dirs_cmd (void);
@ -52,10 +53,7 @@ char *get_random_hint (void);
void source_routing (void);
void user_file_menu_cmd (void);
char *guess_message_value (void);
/* Display mode code */
void info_cmd (void);
void tree_cmd (void);
void listing_cmd (void);
void quick_cmd_no_menu (void);
void info_cmd_no_menu (void);

View File

@ -1064,7 +1064,7 @@ static menu_entry CmdMenu[] = {
{' ', "", ' ', 0},
#endif
{' ', N_("&Extension file edit"), 'E', ext_cmd},
{' ', N_("&Menu file edit"), 'M', menu_edit_cmd},
{' ', N_("&Menu file edit"), 'M', edit_mc_menu_cmd},
#ifdef USE_INTERNAL_EDIT
{' ', N_("Menu edi&Tor edit"), 'T', edit_user_menu_cmd},
{' ', N_("&Syntax file edit"), 'S', edit_syntax_cmd}

View File

@ -141,8 +141,6 @@ void load_hint (void);
void print_vfs_message(char *msg, ...)
__attribute__ ((format (printf, 1, 2)));
void edit_user_menu_cmd (void);
extern char *prompt;
extern char *mc_home;
char *get_mc_lib_dir (void);

View File

@ -239,7 +239,7 @@ static void menubar_execute (WMenu *menubar, int entry)
change_panel () work which is used in quick_view_cmd () -- Norbert
*/
menubar_finish (menubar);
(*call_back)(0);
(*call_back) ();
do_refresh ();
}

View File

@ -4,10 +4,7 @@
#include "dlg.h"
#include "widget.h"
typedef void (*callfn) ();
/* FIXME: We have to leave this type ambiguous, because `callfn' is
used both for functions that take an argument and ones that don't.
That ought to be cleared up. */
typedef void (*callfn) (void);
typedef struct {
char first_letter;