1998-02-27 07:54:42 +03:00
|
|
|
/* Main program for the Midnight Commander
|
|
|
|
Copyright (C) 1994, 1995, 1996, 1997 The Free Software Foundation
|
|
|
|
|
|
|
|
Written by: 1994, 1995, 1996, 1997 Miguel de Icaza
|
|
|
|
1994, 1995 Janne Kukonlehto
|
|
|
|
1997 Norbert Warmuth
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <locale.h>
|
|
|
|
|
|
|
|
#ifdef _OS_NT
|
|
|
|
# include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __os2__
|
|
|
|
# define INCL_DOS
|
|
|
|
# define INCL_DOSFILEMGR
|
|
|
|
# define INCL_DOSERRORS
|
|
|
|
# include <os2.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "tty.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
|
|
|
|
#if defined(HAVE_DIRENT_H) || defined(_POSIX_VERSION)
|
|
|
|
# include <dirent.h>
|
|
|
|
# define NLENGTH(dirent) (strlen ((dirent)->d_name))
|
|
|
|
#else
|
|
|
|
# define dirent direct
|
|
|
|
# define NLENGTH(dirent) ((dirent)->d_namlen)
|
|
|
|
|
|
|
|
# ifdef HAVE_SYS_NDIR_H
|
|
|
|
# include <sys/ndir.h>
|
|
|
|
# endif /* HAVE_SYS_NDIR_H */
|
|
|
|
|
|
|
|
# ifdef HAVE_SYS_DIR_H
|
|
|
|
# include <sys/dir.h>
|
|
|
|
# endif /* HAVE_SYS_DIR_H */
|
|
|
|
|
|
|
|
# ifdef HAVE_NDIR_H
|
|
|
|
# include <ndir.h>
|
|
|
|
# endif /* HAVE_NDIR_H */
|
|
|
|
#endif /* not (HAVE_DIRENT_H or _POSIX_VERSION) */
|
|
|
|
|
|
|
|
#if HAVE_SYS_WAIT_H
|
|
|
|
# include <sys/wait.h> /* For waitpid() */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <errno.h>
|
1999-01-10 11:55:35 +03:00
|
|
|
#ifndef HAS_NO_GRP_PWD_H
|
1998-02-27 07:54:42 +03:00
|
|
|
# include <pwd.h>
|
|
|
|
#endif
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <fcntl.h> /* For O_RDWR */
|
|
|
|
#include <signal.h>
|
|
|
|
|
1998-12-03 02:44:06 +03:00
|
|
|
#ifdef HAVE_CORBA
|
|
|
|
# include <libgnorba/gnorba.h>
|
|
|
|
#endif
|
|
|
|
|
1999-01-19 05:34:37 +03:00
|
|
|
#include <glib.h>
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Program include files */
|
1998-04-28 05:32:41 +04:00
|
|
|
#include "x.h"
|
1998-02-27 07:54:42 +03:00
|
|
|
#include "dir.h"
|
|
|
|
#include "color.h"
|
|
|
|
#include "global.h"
|
|
|
|
#include "dialog.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "file.h"
|
|
|
|
#include "panel.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "win.h"
|
|
|
|
#include "user.h"
|
|
|
|
#include "mouse.h"
|
|
|
|
#include "option.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "cons.saver.h"
|
|
|
|
#include "subshell.h"
|
|
|
|
#include "key.h" /* For init_key() and mi_getch() */
|
|
|
|
#include "setup.h" /* save_setup() */
|
|
|
|
#include "profile.h" /* free_profiles() */
|
|
|
|
#include "boxes.h"
|
|
|
|
#include "layout.h"
|
|
|
|
#include "cmd.h" /* Normal commands */
|
|
|
|
#include "hotlist.h"
|
|
|
|
#include "panelize.h"
|
|
|
|
#ifndef __os2__
|
|
|
|
# include "learn.h"
|
|
|
|
#endif
|
|
|
|
#include "listmode.h"
|
|
|
|
#include "background.h"
|
|
|
|
#include "ext.h" /* For flush_extension_file() */
|
|
|
|
|
|
|
|
/* Listbox for the command history feature */
|
|
|
|
#include "widget.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "wtools.h"
|
|
|
|
#include "complete.h" /* For the free_completion */
|
|
|
|
|
|
|
|
#include "chmod.h"
|
|
|
|
#include "chown.h"
|
|
|
|
|
1999-01-10 11:55:35 +03:00
|
|
|
#ifdef NEEDS_IO_H
|
1998-03-30 02:23:24 +04:00
|
|
|
# include <io.h>
|
1999-01-10 11:55:35 +03:00
|
|
|
#endif
|
|
|
|
#ifdef NEEDS_DRIVE_H
|
1998-02-27 07:54:42 +03:00
|
|
|
# include <drive.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "../vfs/vfs.h"
|
|
|
|
#include "../vfs/extfs.h"
|
|
|
|
|
|
|
|
#include "popt.h"
|
|
|
|
|
1999-03-30 10:09:56 +04:00
|
|
|
#ifdef HAVE_GNOME
|
|
|
|
#include "gcorba.h"
|
|
|
|
#include "gmain.h"
|
|
|
|
#include "gsession.h"
|
|
|
|
#endif
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* "$Id$" */
|
|
|
|
|
|
|
|
/* When the modes are active, left_panel, right_panel and tree_panel */
|
|
|
|
/* Point to a proper data structure. You should check with the functions */
|
|
|
|
/* get_current_type and get_other_type the types of the panels before using */
|
|
|
|
/* This pointer variables */
|
|
|
|
|
|
|
|
/* The structures for the panels */
|
|
|
|
WPanel *left_panel;
|
|
|
|
WPanel *right_panel;
|
|
|
|
|
|
|
|
/* The pointer to the tree */
|
|
|
|
WTree *the_tree;
|
|
|
|
|
|
|
|
/* The Menubar */
|
|
|
|
WMenu *the_menubar;
|
|
|
|
|
|
|
|
/* Pointers to the selected and unselected panel */
|
|
|
|
WPanel *current_panel = NULL;
|
|
|
|
|
|
|
|
/* Set when we want use advanced chmod command instead of chmod and/or chown */
|
|
|
|
int advanced_chfns = 0;
|
|
|
|
|
|
|
|
/* Set when main loop should be terminated */
|
|
|
|
volatile int quit = 0;
|
|
|
|
|
|
|
|
/* Set if you want the possible completions dialog for the first time */
|
|
|
|
int show_all_if_ambiguous = 0;
|
|
|
|
|
|
|
|
/* Set when cd symlink following is desirable (bash mode) */
|
|
|
|
int cd_symlinks = 1;
|
|
|
|
|
|
|
|
/* If set then dialogs just clean the screen when refreshing, else */
|
|
|
|
/* they do a complete refresh, refreshing all the parts of the program */
|
|
|
|
int fast_refresh = 0;
|
|
|
|
|
|
|
|
/* If true, marking a files moves the cursor down */
|
|
|
|
int mark_moves_down = 1;
|
|
|
|
|
|
|
|
/* If true, at startup the user-menu is invoked */
|
|
|
|
int auto_menu = 0;
|
|
|
|
|
|
|
|
/* If true, use + and \ keys normally and select/unselect do if M-+ / M-\ and M--
|
|
|
|
and keypad + / - */
|
|
|
|
int alternate_plus_minus = 0;
|
|
|
|
|
|
|
|
/* If true, then the +, - and \ keys have their special meaning only if the
|
|
|
|
* command line is emtpy, otherwise they behave like regular letters
|
|
|
|
*/
|
|
|
|
int only_leading_plus_minus = 1;
|
|
|
|
|
|
|
|
/* If true, after executing a command, wait for a keystroke */
|
|
|
|
enum { pause_never, pause_on_dumb_terminals, pause_always };
|
|
|
|
|
|
|
|
int pause_after_run = pause_on_dumb_terminals;
|
|
|
|
|
|
|
|
/* It true saves the setup when quitting */
|
1998-05-12 08:26:21 +04:00
|
|
|
int auto_save_setup = 1;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
/* If true, be eight bit clean */
|
|
|
|
int eight_bit_clean = 0;
|
|
|
|
|
|
|
|
/* If true, then display chars 0-255, else iso-8859-1,
|
|
|
|
requires eight_bit_clean */
|
|
|
|
int full_eight_bits = 0;
|
|
|
|
|
|
|
|
/* If true use the internal viewer */
|
|
|
|
int use_internal_view = 1;
|
|
|
|
|
|
|
|
/* Have we shown the fast-reload warning in the past? */
|
|
|
|
int fast_reload_w = 0;
|
|
|
|
|
|
|
|
/* Move page/item? When clicking on the top or bottom of a panel */
|
|
|
|
int mouse_move_pages = 1;
|
|
|
|
|
|
|
|
/* If true: l&r arrows are used to chdir if the input line is empty */
|
|
|
|
int navigate_with_arrows = 0;
|
|
|
|
|
|
|
|
/* If it is set, the commander will iconify itself when executing a program */
|
|
|
|
int iconify_on_exec = 1;
|
|
|
|
|
|
|
|
/* If true use +, -, | for line drawing */
|
|
|
|
int force_ugly_line_drawing = 0;
|
|
|
|
|
|
|
|
/* If true message "The shell is already running a command" never */
|
|
|
|
int force_subshell_execution = 0;
|
|
|
|
|
|
|
|
/* If true program softkeys (HP terminals only) on startup and after every
|
|
|
|
command ran in the subshell to the description found in the termcap/terminfo
|
|
|
|
database */
|
|
|
|
int reset_hp_softkeys = 0;
|
|
|
|
|
|
|
|
/* The prompt */
|
|
|
|
char *prompt = 0;
|
|
|
|
|
|
|
|
/* The widget where we draw the prompt */
|
|
|
|
WLabel *the_prompt;
|
|
|
|
|
|
|
|
/* The hint bar */
|
|
|
|
WLabel *the_hint;
|
|
|
|
|
|
|
|
/* The button bar */
|
|
|
|
WButtonBar *the_bar;
|
|
|
|
|
|
|
|
/* For slow terminals */
|
|
|
|
int slow_terminal = 0;
|
|
|
|
|
|
|
|
/* use mouse? */
|
|
|
|
int use_mouse_p = GPM_MOUSE;
|
|
|
|
|
|
|
|
/* If true, assume we are running on an xterm terminal */
|
|
|
|
static int force_xterm = 0;
|
|
|
|
|
|
|
|
/* Controls screen clearing before an exec */
|
|
|
|
int clear_before_exec = 1;
|
|
|
|
|
|
|
|
/* Asks for confirmation before deleting a file */
|
|
|
|
int confirm_delete = 1;
|
|
|
|
|
|
|
|
/* Asks for confirmation before overwriting a file */
|
|
|
|
int confirm_overwrite = 1;
|
|
|
|
|
|
|
|
/* Asks for confirmation before executing a program by pressing enter */
|
|
|
|
int confirm_execute = 0;
|
|
|
|
|
|
|
|
/* Asks for confirmation before leaving the program */
|
|
|
|
int confirm_exit = 1;
|
|
|
|
|
|
|
|
/* Asks for confirmation when using F3 to view a directory and there
|
|
|
|
are tagged files */
|
|
|
|
int confirm_view_dir = 0;
|
|
|
|
|
|
|
|
/* This flag indicates if the pull down menus by default drop down */
|
|
|
|
int drop_menus = 0;
|
|
|
|
|
|
|
|
/* The dialog handle for the main program */
|
|
|
|
Dlg_head *midnight_dlg;
|
|
|
|
|
|
|
|
/* Subshell: if set, then the prompt was not saved on CONSOLE_SAVE */
|
|
|
|
/* We need to paint it after CONSOLE_RESTORE, see: load_prompt */
|
|
|
|
int update_prompt = 0;
|
|
|
|
|
|
|
|
/* The name which was used to invoke mc */
|
|
|
|
char *program_name;
|
|
|
|
|
|
|
|
/* The home directory */
|
|
|
|
char *home_dir;
|
|
|
|
|
|
|
|
/* The value of the other directory, only used when loading the setup */
|
|
|
|
char *other_dir = 0;
|
|
|
|
char *this_dir = 0;
|
|
|
|
|
1998-12-02 08:18:20 +03:00
|
|
|
/* If this is true, then when browsing the tree the other window will
|
|
|
|
* automatically reload it's directory with the contents of the currently
|
|
|
|
* selected directory.
|
|
|
|
*/
|
|
|
|
int xtree_mode = 0;
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* If true, then print on stdout the last directory we were at */
|
|
|
|
static int print_last_wd = 0;
|
|
|
|
static char *last_wd_string;
|
|
|
|
static int print_last_revert = 0;
|
|
|
|
|
|
|
|
/* On OS/2 and on Windows NT, we need a batch file to do the -P magic */
|
|
|
|
#ifdef OS2_NT
|
|
|
|
static char *batch_file_name = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* widget colors for the midnight commander */
|
|
|
|
int midnight_colors [4];
|
|
|
|
|
|
|
|
/* Force colors, only used by Slang */
|
|
|
|
int force_colors = 0;
|
|
|
|
|
|
|
|
/* colors specified on the command line: they override any other setting */
|
|
|
|
char *command_line_colors;
|
|
|
|
|
|
|
|
/* File name to view if argument was supplied */
|
|
|
|
char *view_one_file = 0;
|
|
|
|
|
|
|
|
/* File name to view if argument was supplied */
|
|
|
|
char *edit_one_file = 0;
|
|
|
|
|
|
|
|
/* Used so that widgets know if they are being destroyed or
|
|
|
|
shut down */
|
|
|
|
int midnight_shutdown = 0;
|
|
|
|
|
|
|
|
/* to show nice prompts */
|
|
|
|
static int last_paused = 0;
|
|
|
|
|
|
|
|
/* Only used at program boot */
|
|
|
|
int boot_current_is_left = 1;
|
|
|
|
|
|
|
|
/* Used for keeping track of the original stdout */
|
|
|
|
int stdout_fd = 0;
|
|
|
|
|
1999-02-25 07:21:30 +03:00
|
|
|
/*
|
|
|
|
* Ugh. Pavel, you shell hack in sfs is BAD.
|
|
|
|
* We need to kill shell from vfs
|
|
|
|
*/
|
|
|
|
#ifndef USE_VFS
|
1998-02-27 07:54:42 +03:00
|
|
|
/* The user's shell */
|
|
|
|
char *shell;
|
1999-02-25 07:21:30 +03:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
/* mc_home: The home of MC */
|
|
|
|
char *mc_home;
|
|
|
|
|
|
|
|
/* if on, it displays the information that files have been moved to ~/.mc */
|
|
|
|
int show_change_notice = 0;
|
|
|
|
|
|
|
|
char cmd_buf [512];
|
|
|
|
|
1998-04-09 08:58:24 +04:00
|
|
|
/* Used during argument processing */
|
|
|
|
int finish_program = 0;
|
|
|
|
|
1999-02-16 00:19:03 +03:00
|
|
|
/* If set, then no windows are displayed in the GNOME edition */
|
|
|
|
int nowindows = 0;
|
|
|
|
|
1999-03-20 21:08:52 +03:00
|
|
|
/* If set it displays the directory that holds the gnome .links files */
|
|
|
|
int display_linksdir = 0;
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Forward declarations */
|
|
|
|
char *get_mc_lib_dir ();
|
|
|
|
int panel_event (Gpm_Event *event, WPanel *panel);
|
|
|
|
int menu_bar_event (Gpm_Event *event, void *);
|
|
|
|
static void menu_cmd (void);
|
|
|
|
|
|
|
|
#ifndef HAVE_GNOME
|
|
|
|
WPanel *
|
|
|
|
get_current_panel ()
|
|
|
|
{
|
|
|
|
return current_panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
WPanel *
|
|
|
|
get_other_panel ()
|
|
|
|
{
|
|
|
|
return (WPanel *) get_panel_widget (get_other_index ());
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
|
|
|
try_to_select (WPanel *panel, char *name)
|
|
|
|
{
|
|
|
|
Xtry_to_select (panel, name);
|
1998-12-11 05:13:35 +03:00
|
|
|
#ifndef HAVE_X
|
1998-02-27 07:54:42 +03:00
|
|
|
select_item (panel);
|
1998-12-11 05:13:35 +03:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
display_mini_info (panel);
|
|
|
|
}
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
static void
|
1998-02-27 07:54:42 +03:00
|
|
|
reload_panelized (WPanel *panel)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
dir_list *list = &panel->dir;
|
|
|
|
|
|
|
|
if (panel != cpanel)
|
|
|
|
mc_chdir (panel->cwd);
|
|
|
|
|
|
|
|
for (i = 0, j = 0; i < panel->count; i++){
|
|
|
|
if (list->list [i].f.marked) {
|
|
|
|
/* Unmark the file in advance. In case the following mc_lstat
|
|
|
|
* fails we are done, else we have to mark the file again
|
|
|
|
* (Note: do_file_mark depends on a valid "list->list [i].buf").
|
|
|
|
* IMO that's the best way to update the panel's summary status
|
|
|
|
* -- Norbert
|
|
|
|
*/
|
|
|
|
do_file_mark (panel, i, 0);
|
|
|
|
}
|
|
|
|
if (mc_lstat (list->list [i].fname, &list->list [i].buf)){
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (list->list [i].fname);
|
1998-02-27 07:54:42 +03:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (list->list [i].f.marked)
|
|
|
|
do_file_mark (panel, i, 1);
|
|
|
|
if (j != i)
|
|
|
|
list->list [j] = list->list [i];
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
if (j == 0)
|
|
|
|
panel->count = set_zero_dir (list);
|
|
|
|
else
|
|
|
|
panel->count = j;
|
|
|
|
|
|
|
|
if (panel != cpanel)
|
|
|
|
mc_chdir (cpanel->cwd);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-04-08 03:45:27 +04:00
|
|
|
update_one_panel_widget (WPanel *panel, int force_update, char *current_file)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
int free_pointer;
|
|
|
|
|
|
|
|
if (force_update & UP_RELOAD){
|
|
|
|
panel->is_panelized = 0;
|
|
|
|
|
|
|
|
ftpfs_flushdir ();
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
memset (&(panel->dir_stat), 0, sizeof (panel->dir_stat));
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If current_file == -1 (an invalid pointer) then preserve selection */
|
|
|
|
if (current_file == UP_KEEPSEL){
|
|
|
|
free_pointer = 1;
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
current_file = g_strdup (panel->dir.list [panel->selected].fname);
|
1998-02-27 07:54:42 +03:00
|
|
|
} else
|
|
|
|
free_pointer = 0;
|
|
|
|
|
|
|
|
if (panel->is_panelized)
|
|
|
|
reload_panelized (panel);
|
|
|
|
else
|
|
|
|
panel_reload (panel);
|
|
|
|
|
|
|
|
try_to_select (panel, current_file);
|
|
|
|
panel->dirty = 1;
|
|
|
|
|
|
|
|
if (free_pointer)
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (current_file);
|
1999-01-03 21:34:40 +03:00
|
|
|
|
|
|
|
#ifdef HAVE_X
|
|
|
|
paint_panel (panel);
|
|
|
|
panel->dirty = 0;
|
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
1999-03-03 00:33:48 +03:00
|
|
|
void
|
|
|
|
panel_clean_dir (WPanel *panel)
|
|
|
|
{
|
|
|
|
int count = panel->count;
|
|
|
|
|
|
|
|
panel->count = 0;
|
|
|
|
panel->top_file = 0;
|
|
|
|
panel->selected = 0;
|
|
|
|
panel->marked = 0;
|
|
|
|
panel->dirs_marked = 0;
|
|
|
|
panel->total = 0;
|
|
|
|
panel->searching = 0;
|
|
|
|
panel->is_panelized = 0;
|
|
|
|
|
|
|
|
clean_dir (&panel->dir, count);
|
|
|
|
}
|
|
|
|
|
1998-04-30 07:21:52 +04:00
|
|
|
#ifndef PORT_HAS_UPDATE_PANELS
|
1998-04-08 03:45:27 +04:00
|
|
|
void
|
|
|
|
update_one_panel (int which, int force_update, char *current_file)
|
|
|
|
{
|
|
|
|
WPanel *panel;
|
|
|
|
|
|
|
|
if (get_display_type (which) != view_listing)
|
|
|
|
return;
|
|
|
|
|
|
|
|
panel = (WPanel *) get_panel_widget (which);
|
|
|
|
update_one_panel_widget (panel, force_update, current_file);
|
|
|
|
}
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* This routine reloads the directory in both panels. It tries to
|
|
|
|
* select current_file in current_panel and other_file in other_panel.
|
|
|
|
* If current_file == -1 then it automatically sets current_file and
|
|
|
|
* other_file to the currently selected files in the panels.
|
|
|
|
*
|
|
|
|
* if force_update has the UP_ONLY_CURRENT bit toggled on, then it
|
|
|
|
* will not reload the other panel.
|
|
|
|
*/
|
|
|
|
void
|
1998-04-30 07:21:52 +04:00
|
|
|
update_panels (int force_update, char *current_file)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
int reload_other = !(force_update & UP_ONLY_CURRENT);
|
|
|
|
WPanel *panel;
|
|
|
|
|
|
|
|
update_one_panel (get_current_index (), force_update, current_file);
|
|
|
|
if (reload_other)
|
1998-04-30 07:21:52 +04:00
|
|
|
update_one_panel (get_other_index (), force_update, UP_KEEPSEL);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
if (get_current_type () == view_listing)
|
|
|
|
panel = (WPanel *) get_panel_widget (get_current_index ());
|
|
|
|
else
|
|
|
|
panel = (WPanel *) get_panel_widget (get_other_index ());
|
|
|
|
|
|
|
|
mc_chdir (panel->cwd);
|
|
|
|
}
|
1998-04-30 07:21:52 +04:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
#ifdef WANT_PARSE
|
|
|
|
static void select_by_index (WPanel *panel, int i);
|
|
|
|
|
|
|
|
/* Called by parse_control_file */
|
|
|
|
static int index_by_name (file_entry *list, int count)
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
name = strtok (NULL, " \t\n");
|
|
|
|
if (!name || !*name)
|
|
|
|
return -1;
|
|
|
|
for (i = 0; i < count; i++){
|
|
|
|
if (strcmp (name, list[i].fname) == 0)
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Called by parse_control_file */
|
|
|
|
static void select_by_index (WPanel *panel, int i)
|
|
|
|
{
|
|
|
|
if (i >= panel->count)
|
|
|
|
return;
|
|
|
|
|
|
|
|
unselect_item (panel);
|
|
|
|
panel->selected = i;
|
|
|
|
|
|
|
|
#ifndef HAVE_X
|
|
|
|
while (panel->selected - panel->top_file >= ITEMS (panel)){
|
|
|
|
/* Scroll window half screen */
|
|
|
|
panel->top_file += ITEMS (panel)/2;
|
|
|
|
paint_dir (panel);
|
|
|
|
select_item (panel);
|
|
|
|
}
|
|
|
|
while (panel->selected < panel->top_file){
|
|
|
|
/* Scroll window half screen */
|
|
|
|
panel->top_file -= ITEMS (panel)/2;
|
|
|
|
if (panel->top_file < 0) panel->top_file = 0;
|
|
|
|
paint_dir (panel);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
select_item (panel);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Called by my_system
|
|
|
|
No error reporting, just exits on the first sign of trouble */
|
|
|
|
static void parse_control_file (void)
|
|
|
|
{
|
|
|
|
char *data, *current;
|
|
|
|
WPanel *panel;
|
|
|
|
file_entry *list;
|
|
|
|
int i;
|
|
|
|
FILE *file;
|
|
|
|
struct stat s;
|
|
|
|
|
|
|
|
if ((file = fopen (control_file, "r")) == NULL){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* Use of fstat prevents race conditions */
|
|
|
|
if (fstat (fileno (file), &s) != 0){
|
|
|
|
fclose (file);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#ifndef OS2_NT
|
|
|
|
/* Security: Check that the user owns the control file to prevent
|
|
|
|
other users from playing tricks on him/her. */
|
|
|
|
if (s.st_uid != getuid ()){
|
|
|
|
fclose (file);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
data = (char *) g_malloc (s.st_size+1);
|
1998-02-27 07:54:42 +03:00
|
|
|
if (!data){
|
|
|
|
fclose (file);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (s.st_size != fread (data, 1, s.st_size, file)){
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (data);
|
1998-02-27 07:54:42 +03:00
|
|
|
fclose (file);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
data [s.st_size] = 0;
|
|
|
|
fclose (file);
|
|
|
|
|
|
|
|
/* The Control file has now been loaded to memory -> start parsing. */
|
|
|
|
current = strtok (data, " \t\n");
|
|
|
|
while (current && *current){
|
|
|
|
if (isupper (*current)){
|
|
|
|
if (get_other_type () != view_listing)
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
panel = other_panel;
|
|
|
|
} else
|
|
|
|
panel = cpanel;
|
|
|
|
|
|
|
|
list = panel->dir.list;
|
|
|
|
*current = tolower (*current);
|
|
|
|
|
|
|
|
if (strcmp (current, "clear_tags") == 0){
|
|
|
|
unmark_files (panel);
|
|
|
|
} else if (strcmp (current, "tag") == 0){
|
|
|
|
i = index_by_name (list, panel->count);
|
|
|
|
if (i >= 0) {
|
|
|
|
do_file_mark (panel, i, 1);
|
|
|
|
}
|
|
|
|
} else if (strcmp (current, "untag") == 0){
|
|
|
|
i = index_by_name (list, panel->count);
|
|
|
|
if (i >= 0){
|
|
|
|
do_file_mark (panel, i, 0);
|
|
|
|
}
|
|
|
|
} else if (strcmp (current, "select") == 0){
|
|
|
|
i = index_by_name (list, panel->count);
|
|
|
|
if (i >= 0){
|
|
|
|
select_by_index (panel, i);
|
|
|
|
}
|
|
|
|
} else if (strcmp (current, "change_panel") == 0){
|
|
|
|
change_panel ();
|
|
|
|
} else if (strcmp (current, "cd") == 0){
|
|
|
|
int change = 0;
|
|
|
|
current = strtok (NULL, " \t\n");
|
|
|
|
if (!current) break;
|
|
|
|
if (cpanel != panel){
|
|
|
|
change_panel ();
|
|
|
|
change = 1;
|
|
|
|
}
|
|
|
|
do_cd (current, cd_parse_command);
|
|
|
|
if (change)
|
|
|
|
change_panel ();
|
|
|
|
} else {
|
|
|
|
/* Unknown command -> let's give up */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
current = strtok (NULL, " \t\n");
|
|
|
|
}
|
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (data);
|
1998-02-27 07:54:42 +03:00
|
|
|
paint_panel (cpanel);
|
|
|
|
paint_panel (opanel);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define parse_control_file()
|
|
|
|
#endif /* WANT_PARSE */
|
|
|
|
|
|
|
|
/* Sets up the terminal before executing a program */
|
|
|
|
static void
|
|
|
|
pre_exec (void)
|
|
|
|
{
|
|
|
|
use_dash (0);
|
|
|
|
edition_pre_exec ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Save current stat of directories to avoid reloading the panels */
|
|
|
|
/* when no modifications have taken place */
|
|
|
|
void
|
|
|
|
save_cwds_stat (void)
|
|
|
|
{
|
|
|
|
if (fast_reload){
|
|
|
|
mc_stat (cpanel->cwd, &(cpanel->dir_stat));
|
|
|
|
if (get_other_type () == view_listing)
|
|
|
|
mc_stat (opanel->cwd, &(opanel->dir_stat));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
void
|
|
|
|
do_possible_cd (char *new_dir)
|
|
|
|
{
|
|
|
|
if (!do_cd (new_dir, cd_exact))
|
1998-03-25 08:16:00 +03:00
|
|
|
message (1, _(" Warning "),
|
|
|
|
_(" The Commander can't change to the directory that \n"
|
|
|
|
" the subshell claims you are in. Perhaps you have \n"
|
|
|
|
" deleted your working directory, or given yourself \n"
|
|
|
|
" extra access permissions with the \"su\" command? "));
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
do_update_prompt ()
|
|
|
|
{
|
|
|
|
if (update_prompt){
|
|
|
|
printf ("%s", subshell_prompt);
|
|
|
|
fflush (stdout);
|
|
|
|
update_prompt = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
|
|
|
restore_console (void)
|
|
|
|
{
|
|
|
|
handle_console (CONSOLE_RESTORE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
exec_shell ()
|
|
|
|
{
|
1998-04-24 05:08:06 +04:00
|
|
|
do_execute (shell, 0, 0);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-04-24 05:08:06 +04:00
|
|
|
do_execute (const char *shell, const char *command, int flags)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
char *new_dir = NULL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_VFS
|
|
|
|
char *old_vfs_dir = 0;
|
|
|
|
|
|
|
|
if (!vfs_current_is_local ())
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
old_vfs_dir = g_strdup (vfs_get_current_dir ());
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
save_cwds_stat ();
|
|
|
|
pre_exec ();
|
|
|
|
if (console_flag)
|
|
|
|
restore_console ();
|
|
|
|
|
|
|
|
#ifndef __os2__
|
|
|
|
unlink (control_file);
|
|
|
|
#endif
|
1998-04-24 05:08:06 +04:00
|
|
|
if (!use_subshell && !(flags & EXECUTE_INTERNAL)){
|
1998-02-27 07:54:42 +03:00
|
|
|
printf ("%s%s%s\n", last_paused ? "\r\n":"", prompt, command);
|
|
|
|
last_paused = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
1998-04-24 05:08:06 +04:00
|
|
|
if (use_subshell && !(flags & EXECUTE_INTERNAL)){
|
1998-02-27 07:54:42 +03:00
|
|
|
do_update_prompt ();
|
|
|
|
|
|
|
|
/* We don't care if it died, higher level takes care of this */
|
|
|
|
#ifdef USE_VFS
|
|
|
|
invoke_subshell (command, VISIBLY, old_vfs_dir ? 0 : &new_dir);
|
|
|
|
#else
|
|
|
|
invoke_subshell (command, VISIBLY, &new_dir);
|
|
|
|
#endif
|
|
|
|
} else
|
|
|
|
#endif
|
1998-04-24 05:08:06 +04:00
|
|
|
my_system (flags, shell, command);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-03-13 06:44:54 +03:00
|
|
|
#ifndef HAVE_GNOME
|
1998-04-24 05:08:06 +04:00
|
|
|
if (!(flags & EXECUTE_INTERNAL)){
|
1998-02-27 07:54:42 +03:00
|
|
|
if ((pause_after_run == pause_always ||
|
|
|
|
(pause_after_run == pause_on_dumb_terminals &&
|
|
|
|
!xterm_flag && !console_flag)) && !quit){
|
1998-03-25 08:16:00 +03:00
|
|
|
printf (_("Press any key to continue..."));
|
1998-02-27 07:54:42 +03:00
|
|
|
last_paused = 1;
|
|
|
|
fflush (stdout);
|
|
|
|
mc_raw_mode ();
|
|
|
|
xgetch ();
|
|
|
|
}
|
|
|
|
if (console_flag){
|
1998-03-23 08:27:15 +03:00
|
|
|
if (output_lines && keybar_visible) {
|
1998-02-27 07:54:42 +03:00
|
|
|
putchar('\n');
|
1998-03-23 08:27:15 +03:00
|
|
|
fflush(stdout);
|
|
|
|
}
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
}
|
1998-03-13 06:44:54 +03:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-03-23 08:27:15 +03:00
|
|
|
if (console_flag)
|
|
|
|
handle_console (CONSOLE_SAVE);
|
1998-02-27 07:54:42 +03:00
|
|
|
edition_post_exec ();
|
|
|
|
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
if (new_dir)
|
|
|
|
do_possible_cd (new_dir);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#ifdef USE_VFS
|
|
|
|
if (old_vfs_dir){
|
|
|
|
mc_chdir (old_vfs_dir);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (old_vfs_dir);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-04-30 07:21:52 +04:00
|
|
|
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
parse_control_file ();
|
|
|
|
#ifndef __os2__
|
|
|
|
unlink (control_file);
|
|
|
|
#endif
|
|
|
|
do_refresh ();
|
|
|
|
use_dash (TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Executes a command */
|
|
|
|
void
|
1998-04-24 05:08:06 +04:00
|
|
|
shell_execute (char *command, int flags)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
if (use_subshell)
|
|
|
|
if (subshell_state == INACTIVE || force_subshell_execution)
|
1998-04-24 05:08:06 +04:00
|
|
|
do_execute (shell, command, flags | EXECUTE_AS_SHELL);
|
1998-02-27 07:54:42 +03:00
|
|
|
else
|
1998-03-25 08:16:00 +03:00
|
|
|
message (1, MSG_ERROR, _(" The shell is already running a command "));
|
1998-02-27 07:54:42 +03:00
|
|
|
else
|
|
|
|
#endif
|
1998-04-24 05:08:06 +04:00
|
|
|
do_execute (shell, command, flags | EXECUTE_AS_SHELL);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
execute (char *command)
|
|
|
|
{
|
|
|
|
shell_execute (command, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
change_panel (void)
|
|
|
|
{
|
|
|
|
free_completions (input_w (cmdline));
|
|
|
|
dlg_one_down (midnight_dlg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
quit_cmd_internal (int quiet)
|
|
|
|
{
|
|
|
|
int q = quit;
|
|
|
|
|
|
|
|
if (quiet || !confirm_exit){
|
|
|
|
q = 1;
|
|
|
|
} else {
|
1998-03-25 08:16:00 +03:00
|
|
|
if (query_dialog (_(" The Midnight Commander "),
|
|
|
|
_(" Do you really want to quit the Midnight Commander? "),
|
|
|
|
0, 2, _("&Yes"), _("&No")) == 0)
|
1998-02-27 07:54:42 +03:00
|
|
|
q = 1;
|
|
|
|
}
|
|
|
|
if (q){
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
if (!use_subshell)
|
|
|
|
midnight_dlg->running = 0;
|
|
|
|
else
|
|
|
|
if ((q = exit_subshell ()))
|
|
|
|
#endif
|
|
|
|
midnight_dlg->running = 0;
|
|
|
|
}
|
|
|
|
if (q)
|
|
|
|
quit |= 1;
|
|
|
|
return quit;
|
|
|
|
}
|
|
|
|
|
|
|
|
int quit_cmd (void)
|
|
|
|
{
|
|
|
|
quit_cmd_internal (0);
|
|
|
|
return quit;
|
|
|
|
}
|
|
|
|
|
|
|
|
int quiet_quit_cmd (void)
|
|
|
|
{
|
|
|
|
print_last_revert = 1;
|
|
|
|
quit_cmd_internal (1);
|
|
|
|
return quit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Touch window and refresh window functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This routine untouches the first line on both panels in order */
|
|
|
|
/* to avoid the refreshing the menu bar */
|
|
|
|
|
|
|
|
#ifdef HAVE_X
|
|
|
|
void
|
|
|
|
untouch_bar (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
repaint_screen (void)
|
|
|
|
{
|
|
|
|
do_refresh ();
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* HAVE_X */
|
|
|
|
void
|
|
|
|
untouch_bar (void)
|
|
|
|
{
|
|
|
|
do_refresh ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
repaint_screen (void)
|
|
|
|
{
|
|
|
|
do_refresh ();
|
|
|
|
mc_refresh ();
|
|
|
|
}
|
|
|
|
#endif /* HAVE_X */
|
|
|
|
|
|
|
|
/* Wrapper for do_subshell_chdir, check for availability of subshell */
|
|
|
|
void
|
|
|
|
subshell_chdir (char *directory)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
if (use_subshell){
|
|
|
|
if (vfs_current_is_local ())
|
|
|
|
do_subshell_chdir (directory, 0, 1);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
1998-03-31 01:04:59 +04:00
|
|
|
void
|
|
|
|
directory_history_add (WPanel * panel, char *s)
|
|
|
|
{
|
|
|
|
if (!panel->dir_history) {
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
panel->dir_history = g_new0 (Hist, 1);
|
|
|
|
panel->dir_history->text = g_strdup (s);
|
1999-02-04 02:19:40 +03:00
|
|
|
strip_password (panel->dir_history->text, 1);
|
1998-03-31 01:04:59 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!strcmp (panel->dir_history->text, s))
|
|
|
|
return;
|
|
|
|
if (panel->dir_history->next) {
|
|
|
|
if (panel->dir_history->next->text) {
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (panel->dir_history->next->text);
|
1998-03-31 01:04:59 +04:00
|
|
|
panel->dir_history->next->text = 0;
|
|
|
|
}
|
|
|
|
} else {
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
panel->dir_history->next = g_new0 (Hist, 1);
|
1998-03-31 01:04:59 +04:00
|
|
|
panel->dir_history->next->prev = panel->dir_history;
|
|
|
|
}
|
|
|
|
panel->dir_history = panel->dir_history->next;
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
panel->dir_history->text = g_strdup (s);
|
1999-02-04 02:19:40 +03:00
|
|
|
strip_password (panel->dir_history->text, 1);
|
|
|
|
|
1998-04-09 09:05:14 +04:00
|
|
|
panel_update_marks (panel);
|
1998-03-31 01:04:59 +04:00
|
|
|
}
|
|
|
|
|
1998-09-12 03:27:49 +04:00
|
|
|
/*
|
|
|
|
* If we moved to the parent directory move the selection pointer to
|
|
|
|
* the old directory name; If we leave VFS dir, remove FS specificator.
|
|
|
|
* Warn: This code spoils lwd string.
|
1998-09-29 20:01:16 +04:00
|
|
|
*
|
|
|
|
* You do _NOT_ want to add any vfs aware code here. <pavel@ucw.cz>
|
1998-09-12 03:27:49 +04:00
|
|
|
*/
|
1998-12-03 00:27:27 +03:00
|
|
|
static char*
|
1998-09-12 03:27:49 +04:00
|
|
|
get_parent_dir_name (char *cwd, char *lwd)
|
|
|
|
{
|
1998-09-22 18:45:38 +04:00
|
|
|
char *p;
|
1998-09-12 03:27:49 +04:00
|
|
|
if (strlen (lwd) > strlen (cwd))
|
|
|
|
if((p=strrchr(lwd, PATH_SEP)) && !strncmp(cwd, lwd, p-lwd)){
|
1998-09-29 20:01:16 +04:00
|
|
|
return (p+1);
|
1998-09-12 03:27:49 +04:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Changes the current panel directory */
|
1998-12-03 00:27:27 +03:00
|
|
|
static int
|
1998-04-11 06:53:35 +04:00
|
|
|
_do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
char *directory, *olddir;
|
|
|
|
char temp [MC_MAXPATHLEN];
|
1998-06-01 18:34:43 +04:00
|
|
|
char *translated_url;
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef USE_VFS
|
|
|
|
vfs *oldvfs;
|
|
|
|
vfsid oldvfsid;
|
|
|
|
struct vfs_stamping *parent;
|
|
|
|
#endif
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
olddir = g_strdup (panel->cwd);
|
1998-10-13 02:07:53 +04:00
|
|
|
translated_url = new_dir = vfs_translate_url (new_dir);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
/* Convert *new_path to a suitable pathname, handle ~user */
|
|
|
|
|
|
|
|
if (cd_type == cd_parse_command){
|
|
|
|
while (*new_dir == ' ')
|
|
|
|
new_dir++;
|
|
|
|
|
|
|
|
if (!strcmp (new_dir, "-")){
|
|
|
|
strcpy (temp, panel->lwd);
|
|
|
|
new_dir = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
directory = *new_dir ? new_dir : home_dir;
|
1998-06-01 18:34:43 +04:00
|
|
|
|
1999-04-13 06:05:15 +04:00
|
|
|
#ifdef HAVE_GNOME
|
|
|
|
if (is_a_desktop_panel (panel)) {
|
|
|
|
new_panel_at (directory);
|
|
|
|
g_free (olddir);
|
|
|
|
g_free (translated_url);
|
|
|
|
return 0; /* Don't add to history */
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
if (mc_chdir (directory) == -1){
|
|
|
|
strcpy (panel->cwd, olddir);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (olddir);
|
|
|
|
g_free (translated_url);
|
1998-02-27 07:54:42 +03:00
|
|
|
return 0;
|
|
|
|
}
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (translated_url);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
/* Success: save previous directory, shutdown status of previous dir */
|
|
|
|
strcpy (panel->lwd, olddir);
|
|
|
|
free_completions (input_w (cmdline));
|
|
|
|
|
|
|
|
mc_get_current_wd (panel->cwd, sizeof (panel->cwd) - 2);
|
|
|
|
|
|
|
|
#ifdef USE_VFS
|
|
|
|
oldvfs = vfs_type (olddir);
|
|
|
|
oldvfsid = vfs_ncs_getid (oldvfs, olddir, &parent);
|
|
|
|
vfs_add_noncurrent_stamps (oldvfs, oldvfsid, parent);
|
|
|
|
vfs_rm_parents (parent);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
subshell_chdir (panel->cwd);
|
|
|
|
|
|
|
|
/* Reload current panel */
|
1999-03-03 00:33:48 +03:00
|
|
|
panel_clean_dir (panel);
|
1998-02-27 07:54:42 +03:00
|
|
|
panel->count = do_load_dir (&panel->dir, panel->sort_type,
|
|
|
|
panel->reverse, panel->case_sensitive, panel->filter);
|
1998-12-11 05:13:35 +03:00
|
|
|
try_to_select (panel, get_parent_dir_name (panel->cwd, olddir));
|
1998-02-27 07:54:42 +03:00
|
|
|
load_hint ();
|
|
|
|
panel_update_contents (panel);
|
1998-09-12 03:27:49 +04:00
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (olddir);
|
1998-09-12 03:27:49 +04:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1998-04-11 06:53:35 +04:00
|
|
|
do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
1998-03-31 01:04:59 +04:00
|
|
|
int r;
|
1998-04-11 06:53:35 +04:00
|
|
|
|
|
|
|
r = _do_panel_cd (panel, new_dir, cd_type);
|
1998-03-31 01:04:59 +04:00
|
|
|
if (r)
|
|
|
|
directory_history_add (cpanel, cpanel->cwd);
|
|
|
|
return r;
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
1998-04-11 06:53:35 +04:00
|
|
|
int
|
|
|
|
do_cd (char *new_dir, enum cd_enum exact)
|
|
|
|
{
|
|
|
|
return (do_panel_cd (cpanel, new_dir, exact));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
directory_history_next (WPanel * panel)
|
|
|
|
{
|
|
|
|
if (!panel->dir_history->next)
|
|
|
|
return;
|
|
|
|
if (_do_panel_cd (panel, panel->dir_history->next->text, cd_exact))
|
|
|
|
panel->dir_history = panel->dir_history->next;
|
|
|
|
panel_update_marks (panel);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
directory_history_prev (WPanel * panel)
|
|
|
|
{
|
|
|
|
if (!panel->dir_history->prev)
|
|
|
|
return;
|
|
|
|
if (_do_panel_cd (panel, panel->dir_history->prev->text, cd_exact))
|
|
|
|
panel->dir_history = panel->dir_history->prev;
|
|
|
|
panel_update_marks (panel);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
directory_history_list (WPanel * panel)
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
/* must be at least two to show a history */
|
|
|
|
if (panel->dir_history) {
|
|
|
|
if (panel->dir_history->prev || panel->dir_history->next) {
|
|
|
|
s = show_hist (panel->dir_history, panel->widget.x, panel->widget.y);
|
|
|
|
if (s) {
|
|
|
|
int r;
|
|
|
|
r = _do_panel_cd (panel, s, cd_exact);
|
|
|
|
if (r)
|
|
|
|
directory_history_add (panel, panel->cwd);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (s);
|
1998-04-11 06:53:35 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
int
|
|
|
|
load_prompt (int fd, void *unused)
|
|
|
|
{
|
|
|
|
if (!read_subshell_prompt (QUIETLY))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (command_prompt){
|
|
|
|
int prompt_len;
|
|
|
|
|
|
|
|
prompt = strip_ctrl_codes (subshell_prompt);
|
|
|
|
prompt_len = strlen (prompt);
|
|
|
|
|
|
|
|
/* Check for prompts too big */
|
|
|
|
if (prompt_len > COLS - 8) {
|
|
|
|
prompt [COLS - 8 ] = 0;
|
|
|
|
prompt_len = COLS - 8;
|
|
|
|
}
|
|
|
|
label_set_text (the_prompt, prompt);
|
|
|
|
winput_set_origin ((WInput *)cmdline, prompt_len, COLS-prompt_len);
|
|
|
|
|
|
|
|
/* since the prompt has changed, and we are called from one of the
|
|
|
|
* get_event channels, the prompt updating does not take place
|
|
|
|
* automatically: force a cursor update and a screen refresh
|
|
|
|
*/
|
|
|
|
if (current_dlg == midnight_dlg){
|
|
|
|
update_cursor (midnight_dlg);
|
|
|
|
mc_refresh ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
update_prompt = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The user pressed the enter key */
|
|
|
|
int
|
|
|
|
menu_bar_event (Gpm_Event *event, void *x)
|
|
|
|
{
|
|
|
|
if (event->type != GPM_DOWN)
|
|
|
|
return MOU_NORMAL;
|
|
|
|
|
|
|
|
return MOU_ENDLOOP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Used to emulate Lynx's entering leaving a directory with the arrow keys */
|
|
|
|
int
|
|
|
|
maybe_cd (int char_code, int move_up_dir)
|
|
|
|
{
|
|
|
|
if (navigate_with_arrows){
|
|
|
|
if (!input_w (cmdline)->buffer [0]){
|
|
|
|
if (!move_up_dir){
|
|
|
|
do_cd ("..", cd_exact);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (S_ISDIR (selection (cpanel)->buf.st_mode)
|
|
|
|
|| link_isdir (selection (cpanel))){
|
|
|
|
do_cd (selection (cpanel)->fname, cd_exact);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
static void
|
1998-02-27 07:54:42 +03:00
|
|
|
set_sort_to (WPanel *p, sortfn *sort_order)
|
|
|
|
{
|
|
|
|
p->sort_type = sort_order;
|
|
|
|
|
|
|
|
/* The directory is already sorted, we have to load the unsorted stuff */
|
|
|
|
if (sort_order == (sortfn *) unsorted){
|
|
|
|
char *current_file;
|
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
current_file = g_strdup (cpanel->dir.list [cpanel->selected].fname);
|
1998-02-27 07:54:42 +03:00
|
|
|
panel_reload (cpanel);
|
|
|
|
try_to_select (cpanel, current_file);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (current_file);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
do_re_sort (p);
|
|
|
|
}
|
|
|
|
|
1998-03-11 08:55:05 +03:00
|
|
|
void
|
1998-02-27 07:54:42 +03:00
|
|
|
sort_cmd (void)
|
|
|
|
{
|
|
|
|
WPanel *p;
|
|
|
|
sortfn *sort_order;
|
|
|
|
|
|
|
|
if (!SELECTED_IS_PANEL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = MENU_PANEL;
|
|
|
|
sort_order = sort_box (p->sort_type, &p->reverse, &p->case_sensitive);
|
|
|
|
|
1998-12-31 02:49:58 +03:00
|
|
|
panel_set_sort_order (p, sort_order);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
1998-12-02 08:18:20 +03:00
|
|
|
#ifndef HAVE_GNOME
|
1998-02-27 07:54:42 +03:00
|
|
|
static void
|
|
|
|
tree_box (void)
|
|
|
|
{
|
|
|
|
char *sel_dir;
|
|
|
|
|
|
|
|
sel_dir = tree (selection (cpanel)->fname);
|
|
|
|
if (sel_dir){
|
|
|
|
do_cd(sel_dir, cd_exact);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (sel_dir);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
}
|
1998-12-02 08:18:20 +03:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
#if SOMEDAY_WE_WILL_FINISH_THIS_CODE
|
|
|
|
static void
|
|
|
|
listmode_cmd (void)
|
|
|
|
{
|
|
|
|
char *newmode;
|
|
|
|
newmode = listmode_edit ("half <type,>name,|,size:8,|,perm:4+");
|
|
|
|
message (0, " Listing format edit ", " New mode is \"%s\" ", newmode);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (newmode);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_GNOME
|
1998-12-03 00:27:27 +03:00
|
|
|
void init_menu (void) {};
|
|
|
|
void done_menu (void) {};
|
1998-02-27 07:54:42 +03:00
|
|
|
#else
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
/* NOTICE: hotkeys specified here are overriden in menubar_paint_idx (alex) */
|
1998-02-27 07:54:42 +03:00
|
|
|
static menu_entry PanelMenu [] = {
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Listing mode..."), 'L', listing_cmd },
|
|
|
|
{ ' ', N_("&Quick view C-x q"), 'Q', quick_view_cmd },
|
|
|
|
{ ' ', N_("&Info C-x i"), 'I', info_cmd },
|
|
|
|
{ ' ', N_("&Tree"), 'T', tree_cmd },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ ' ', "", ' ', 0 },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Sort order..."), 'S', sort_cmd },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ ' ', "", ' ', 0 },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Filter..."), 'F', filter_cmd },
|
1998-03-25 08:16:00 +03:00
|
|
|
#ifdef USE_NETCODE
|
|
|
|
{ ' ', "", ' ', 0 },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Network link..."), 'N', netlink_cmd },
|
|
|
|
{ ' ', N_("FT&P link..."), 'P', ftplink_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
{ ' ', "", ' ', 0 },
|
|
|
|
#ifdef OS2_NT
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Drive... M-d"), 'D', drive_cmd_a },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Rescan C-r"), 'R', reread_cmd }
|
1998-02-27 07:54:42 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
static menu_entry RightMenu [] = {
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Listing mode..."), 'L', listing_cmd },
|
|
|
|
{ ' ', N_("&Quick view C-x q"), 'Q', quick_view_cmd },
|
|
|
|
{ ' ', N_("&Info C-x i"), 'I', info_cmd },
|
|
|
|
{ ' ', N_("&Tree"), 'T', tree_cmd },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ ' ', "", ' ', 0 },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Sort order..."), 'S', sort_cmd },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ ' ', "", ' ', 0 },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Filter..."), 'F', filter_cmd },
|
1998-03-25 08:16:00 +03:00
|
|
|
#ifdef USE_NETCODE
|
|
|
|
{ ' ', "", ' ', 0 },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Network link..."), 'N', netlink_cmd },
|
|
|
|
{ ' ', N_("FT&P link..."), 'P', ftplink_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
{ ' ', "", ' ', 0 },
|
|
|
|
#ifdef OS2_NT
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Drive... M-d"), 'D', drive_cmd_b },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Rescan C-r"), 'R', reread_cmd }
|
1998-02-27 07:54:42 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
static menu_entry FileMenu [] = {
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&User menu F2"), 'U', user_menu_cmd },
|
|
|
|
{ ' ', N_("&View F3"), 'V', view_cmd },
|
1998-08-31 14:06:25 +04:00
|
|
|
{ ' ', N_("Vie&w file... "), 'W', view_file_cmd },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Filtered view M-!"), 'F', filtered_view_cmd },
|
|
|
|
{ ' ', N_("&Edit F4"), 'E', edit_cmd },
|
|
|
|
{ ' ', N_("&Copy F5"), 'C', copy_cmd },
|
|
|
|
{ ' ', N_("c&Hmod C-x c"), 'H', chmod_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifndef OS2_NT
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Link C-x l"), 'L', link_cmd },
|
|
|
|
{ ' ', N_("&SymLink C-x s"), 'S', symlink_cmd },
|
|
|
|
{ ' ', N_("edit s&Ymlink C-x C-s"), 'Y', edit_symlink_cmd },
|
|
|
|
{ ' ', N_("ch&Own C-x o"), 'O', chown_cmd },
|
|
|
|
{ ' ', N_("&Advanced chown "), 'A', chown_advanced_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Rename/Move F6"), 'R', ren_cmd },
|
|
|
|
{ ' ', N_("&Mkdir F7"), 'M', mkdir_cmd },
|
|
|
|
{ ' ', N_("&Delete F8"), 'D', delete_cmd },
|
|
|
|
{ ' ', N_("&Quick cd M-c"), 'Q', quick_cd_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
{ ' ', "", ' ', 0 },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("select &Group M-+"), 'G', select_cmd },
|
|
|
|
{ ' ', N_("u&Nselect group M-\\"),'N', unselect_cmd },
|
|
|
|
{ ' ', N_("reverse selec&Tion M-*"), 'T', reverse_selection_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
{ ' ', "", ' ', 0 },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("e&Xit F10"), 'X', (callfn) quit_cmd }
|
1998-02-27 07:54:42 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
void external_panelize (void);
|
|
|
|
static menu_entry CmdMenu [] = {
|
|
|
|
/* I know, I'm lazy, but the tree widget when it's not running
|
|
|
|
* as a panel still has some problems, I have not yet finished
|
|
|
|
* the WTree widget port, sorry.
|
|
|
|
*/
|
1998-12-02 08:18:20 +03:00
|
|
|
#ifndef HAVE_GNOME
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Directory tree"), 'D', tree_box },
|
1998-12-02 08:18:20 +03:00
|
|
|
#endif
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Find file M-?"), 'F', find_cmd },
|
|
|
|
{ ' ', N_("s&Wap panels C-u"), 'W', swap_cmd },
|
|
|
|
{ ' ', N_("switch &Panels on/off C-o"), 'P', view_other_cmd },
|
|
|
|
{ ' ', N_("&Compare directories C-x d"), 'C', compare_dirs_cmd },
|
|
|
|
{ ' ', N_("e&Xternal panelize C-x !"), 'X', external_panelize },
|
|
|
|
{ ' ', N_("show directory s&Izes"), 'I', dirsizes_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
{ ' ', "", ' ', 0 },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("command &History"), 'H', history_cmd },
|
|
|
|
{ ' ', N_("di&Rectory hotlist C-\\"), 'R', quick_chdir_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef USE_VFS
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Active VFS list C-x a"), 'A', reselect_vfs },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
#ifdef WITH_BACKGROUND
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Background jobs C-x j"), 'B', jobs_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
{ ' ', "", ' ', 0 },
|
|
|
|
#ifdef USE_EXT2FSLIB
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Undelete files (ext2fs only)"), 'U', undelete_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
#ifdef VERSION_4
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Listing format edit"), 'L', listmode_cmd},
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Extension file edit"), 'E', ext_cmd },
|
|
|
|
{ ' ', N_("&Menu file edit"), 'M', menu_edit_cmd }
|
1998-02-27 07:54:42 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Must keep in sync with the constants in menu_cmd */
|
|
|
|
static menu_entry OptMenu [] = {
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Configuration..."), 'C', configure_box },
|
|
|
|
{ ' ', N_("&Layout..."), 'L', layout_cmd },
|
|
|
|
{ ' ', N_("c&Onfirmation..."), 'O', confirm_box },
|
|
|
|
{ ' ', N_("&Display bits..."), 'D', display_bits_box },
|
1998-02-27 07:54:42 +03:00
|
|
|
#if !defined(HAVE_X) && !defined(OS2_NT)
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("learn &Keys..."), 'K', learn_keys },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
#ifdef USE_VFS
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Virtual FS..."), 'V', configure_vfs },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
{ ' ', "", ' ', 0 },
|
Fri Apr 3 05:23:20 1998 Alex Tkachenko <alex@bcs.zp.ua>
* configure.in: ALL_LINGUAS test added, to allow specify list
of languages to be installed by setting env variable before
configure. If it is empty, it defaults to full list.
* src/menu.h menu_entry.{hot_pos, is_dupped} dropped
* src/menu.c: consistency fixes: pull-down menu items are now
accessible either with arrow keys or with hotkeys, denoted with &
(and highlighted). (key combinations, placed to the right of items
intended to be used from outside the menus). Freeing menu entries
removed as it no longer needed
* src/main.c, edit/editmenu.c: menubar init code is changed to conform
above fixes.
* edit/edit.h: use of "Cancel" in error_dialogs replaced with
"Dismiss", to avoid collisions in translation of "Cancel" in other
places with this case.
* src/boxes.c: select_format() and it's support removed, as it is
obsoleted by input line history feature. display_init()/display_callback
fixed to suite i18n changes. sort_box() - alike.
* src/option.c: pause_options added &'s and gettext calls to expand
statically assigned values.
* src/widget.c: (radio_callback) hotkey recognition is changed to
&-notation, rather than simple uppercase.
* src/dlg.c: (dlg_try_hotkey) plain symbol comparison replaced with
call to isalpha(), this fixes errorneous exit from input line, when
button hotkey is 8-bit NLS char.
1998-04-04 00:00:00 +04:00
|
|
|
{ ' ', N_("&Save setup"), 'S', save_setup_cmd }
|
1998-02-27 07:54:42 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#define menu_entries(x) sizeof(x)/sizeof(menu_entry)
|
|
|
|
|
|
|
|
Menu MenuBar [5];
|
|
|
|
#ifndef HAVE_X
|
|
|
|
static Menu MenuBarEmpty [5];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
|
|
|
init_menu (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
#ifdef HAVE_X
|
1998-06-08 04:33:31 +04:00
|
|
|
MenuBar [0] = create_menu (_(" &Left "), PanelMenu, menu_entries (PanelMenu));
|
1998-02-27 07:54:42 +03:00
|
|
|
#else
|
1998-06-08 04:33:31 +04:00
|
|
|
MenuBar [0] = create_menu ( horizontal_split ? _(" &Above ") : _(" &Left "),
|
1998-02-27 07:54:42 +03:00
|
|
|
PanelMenu, menu_entries (PanelMenu));
|
|
|
|
#endif
|
1998-06-08 04:33:31 +04:00
|
|
|
MenuBar [1] = create_menu (_(" &File "), FileMenu, menu_entries (FileMenu));
|
|
|
|
MenuBar [2] = create_menu (_(" &Command "), CmdMenu, menu_entries (CmdMenu));
|
|
|
|
MenuBar [3] = create_menu (_(" &Options "), OptMenu, menu_entries (OptMenu));
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef HAVE_X
|
1998-06-08 04:33:31 +04:00
|
|
|
MenuBar [4] = create_menu (_(" &Right "), RightMenu, menu_entries (PanelMenu));
|
1998-02-27 07:54:42 +03:00
|
|
|
#else
|
1998-06-08 04:33:31 +04:00
|
|
|
MenuBar [4] = create_menu (horizontal_split ? _(" &Below ") : _(" &Right "),
|
1998-02-27 07:54:42 +03:00
|
|
|
RightMenu, menu_entries (PanelMenu));
|
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
MenuBarEmpty [i] = create_menu (MenuBar [i]->name, 0, 0);
|
|
|
|
#endif /* HAVE_X */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
done_menu (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++){
|
|
|
|
destroy_menu (MenuBar [i]);
|
|
|
|
#ifndef HAVE_X
|
|
|
|
destroy_menu (MenuBarEmpty [i]);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
|
|
|
menu_last_selected_cmd (void)
|
|
|
|
{
|
|
|
|
the_menubar->active = 1;
|
|
|
|
the_menubar->dropped = drop_menus;
|
|
|
|
the_menubar->previous_selection = dlg_item_number (midnight_dlg);
|
|
|
|
dlg_select_widget (midnight_dlg, the_menubar);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
menu_cmd (void)
|
|
|
|
{
|
|
|
|
if (the_menubar->active)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (get_current_index () == 0)
|
|
|
|
the_menubar->selected = 0;
|
|
|
|
else
|
|
|
|
the_menubar->selected = 4;
|
|
|
|
menu_last_selected_cmd ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Flag toggling functions */
|
|
|
|
void
|
|
|
|
toggle_confirm_delete (void)
|
|
|
|
{
|
|
|
|
confirm_delete = !confirm_delete;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
toggle_fast_reload (void)
|
|
|
|
{
|
|
|
|
fast_reload = !fast_reload;
|
|
|
|
if (fast_reload_w == 0 && fast_reload){
|
1998-03-25 08:16:00 +03:00
|
|
|
message (0, _(" Information "),
|
|
|
|
_(" Using the fast reload option may not reflect the exact \n"
|
|
|
|
" directory contents. In this cases you'll need to do a \n"
|
|
|
|
" manual reload of the directory. See the man page for \n"
|
|
|
|
" the details. "));
|
1998-02-27 07:54:42 +03:00
|
|
|
fast_reload_w = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
toggle_mix_all_files (void)
|
|
|
|
{
|
|
|
|
mix_all_files = !mix_all_files;
|
1998-04-30 07:21:52 +04:00
|
|
|
update_panels (UP_RELOAD, UP_KEEPSEL);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
toggle_show_backup (void)
|
|
|
|
{
|
|
|
|
show_backups = !show_backups;
|
1998-04-30 07:21:52 +04:00
|
|
|
update_panels (UP_RELOAD, UP_KEEPSEL);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
toggle_show_hidden (void)
|
|
|
|
{
|
|
|
|
show_dot_files = !show_dot_files;
|
1998-04-30 07:21:52 +04:00
|
|
|
update_panels (UP_RELOAD, UP_KEEPSEL);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
toggle_show_mini_status (void)
|
|
|
|
{
|
|
|
|
show_mini_info = !show_mini_info;
|
|
|
|
paint_panel (cpanel);
|
|
|
|
if (get_other_type () == view_listing)
|
|
|
|
paint_panel (opanel);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
toggle_align_extensions (void)
|
|
|
|
{
|
|
|
|
align_extensions = !align_extensions;
|
|
|
|
}
|
|
|
|
|
1998-07-31 02:56:58 +04:00
|
|
|
/*
|
|
|
|
* Just a hack for allowing url-like pathnames to be accepted from the
|
|
|
|
* command line.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
translated_mc_chdir (char *dir)
|
|
|
|
{
|
|
|
|
char *newdir;
|
|
|
|
|
1998-10-13 02:07:53 +04:00
|
|
|
newdir = vfs_translate_url (dir);
|
1998-07-31 02:56:58 +04:00
|
|
|
mc_chdir (newdir);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (newdir);
|
1998-07-31 02:56:58 +04:00
|
|
|
}
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifndef PORT_HAS_CREATE_PANELS
|
|
|
|
void
|
|
|
|
create_panels (void)
|
|
|
|
{
|
|
|
|
int current_index;
|
|
|
|
int other_index;
|
|
|
|
int current_mode;
|
|
|
|
int other_mode;
|
|
|
|
char original_dir [1024];
|
|
|
|
|
|
|
|
original_dir [0] = 0;
|
|
|
|
|
|
|
|
if (boot_current_is_left){
|
|
|
|
current_index = 0;
|
|
|
|
other_index = 1;
|
|
|
|
current_mode = startup_left_mode;
|
|
|
|
other_mode = startup_right_mode;
|
|
|
|
} else {
|
|
|
|
current_index = 1;
|
|
|
|
other_index = 0;
|
|
|
|
current_mode = startup_right_mode;
|
|
|
|
other_mode = startup_left_mode;
|
|
|
|
}
|
|
|
|
/* Creates the left panel */
|
|
|
|
if (this_dir){
|
|
|
|
if (other_dir){
|
|
|
|
/* Ok, user has specified two dirs, save the original one,
|
|
|
|
* since we may not be able to chdir to the proper
|
|
|
|
* second directory later
|
|
|
|
*/
|
|
|
|
mc_get_current_wd (original_dir, sizeof (original_dir)-2);
|
|
|
|
}
|
1998-07-31 02:56:58 +04:00
|
|
|
translated_mc_chdir (this_dir);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
set_display_type (current_index, current_mode);
|
|
|
|
|
|
|
|
/* The other panel */
|
|
|
|
if (other_dir){
|
|
|
|
if (original_dir [0])
|
1998-07-31 02:56:58 +04:00
|
|
|
translated_mc_chdir (original_dir);
|
|
|
|
translated_mc_chdir (other_dir);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
set_display_type (other_index, other_mode);
|
|
|
|
|
|
|
|
if (startup_left_mode == view_listing){
|
|
|
|
current_panel = left_panel;
|
|
|
|
} else {
|
|
|
|
if (right_panel)
|
|
|
|
current_panel = right_panel;
|
|
|
|
else
|
|
|
|
current_panel = left_panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create the nice widgets */
|
|
|
|
cmdline = command_new (0, 0, 0);
|
|
|
|
the_prompt = label_new (0, 0, prompt, NULL);
|
|
|
|
the_prompt->transparent = 1;
|
|
|
|
the_bar = buttonbar_new (keybar_visible);
|
|
|
|
|
|
|
|
#ifndef HAVE_GNOME
|
|
|
|
the_hint = label_new (0, 0, 0, NULL);
|
|
|
|
the_hint->transparent = 1;
|
|
|
|
the_hint->auto_adjust_cols = 0;
|
|
|
|
the_hint->widget.cols = COLS;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
the_menubar = menubar_new (0, 0, COLS, MenuBar, 5);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void copy_current_pathname (void)
|
|
|
|
{
|
|
|
|
if (!command_prompt)
|
|
|
|
return;
|
|
|
|
|
|
|
|
stuff (input_w (cmdline), cpanel->cwd, 0);
|
|
|
|
if (cpanel->cwd [strlen (cpanel->cwd) - 1] != PATH_SEP)
|
|
|
|
stuff (input_w (cmdline), PATH_SEP_STR, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void copy_other_pathname (void)
|
|
|
|
{
|
|
|
|
if (get_other_type () != view_listing)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!command_prompt)
|
|
|
|
return;
|
|
|
|
|
|
|
|
stuff (input_w (cmdline), opanel->cwd, 0);
|
|
|
|
if (cpanel->cwd [strlen (opanel->cwd) - 1] != PATH_SEP)
|
|
|
|
stuff (input_w (cmdline), PATH_SEP_STR, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void copy_readlink (WPanel *panel)
|
|
|
|
{
|
|
|
|
if (!command_prompt)
|
|
|
|
return;
|
|
|
|
if (S_ISLNK (selection (panel)->buf.st_mode)) {
|
|
|
|
char buffer [MC_MAXPATHLEN];
|
|
|
|
char *p = concat_dir_and_file (panel->cwd, selection (panel)->fname);
|
|
|
|
int i;
|
|
|
|
|
1998-05-10 17:41:43 +04:00
|
|
|
i = mc_readlink (p, buffer, MC_MAXPATHLEN);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (p);
|
1998-02-27 07:54:42 +03:00
|
|
|
if (i > 0) {
|
|
|
|
buffer [i] = 0;
|
|
|
|
stuff (input_w (cmdline), buffer, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void copy_current_readlink (void)
|
|
|
|
{
|
|
|
|
copy_readlink (cpanel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void copy_other_readlink (void)
|
|
|
|
{
|
|
|
|
if (get_other_type () != view_listing)
|
|
|
|
return;
|
|
|
|
copy_readlink (opanel);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Inserts the selected file name into the input line */
|
|
|
|
/* Exported so that the command modules uses it */
|
|
|
|
void copy_prog_name (void)
|
|
|
|
{
|
|
|
|
char *tmp;
|
|
|
|
if (!command_prompt)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (get_current_type () == view_tree){
|
|
|
|
WTree *tree = (WTree *) get_panel_widget (get_current_index ());
|
|
|
|
tmp = name_quote (tree->selected_ptr->name, 1);
|
|
|
|
} else
|
|
|
|
tmp = name_quote (selection (cpanel)->fname, 1);
|
|
|
|
stuff (input_w (cmdline), tmp, 1);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (tmp);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void copy_tagged (WPanel *panel)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!command_prompt)
|
|
|
|
return;
|
|
|
|
input_disable_update (input_w (cmdline));
|
|
|
|
if (panel->marked){
|
|
|
|
for (i = 0; i < panel->count; i++)
|
|
|
|
if (panel->dir.list [i].f.marked) {
|
|
|
|
char *tmp = name_quote (panel->dir.list [i].fname, 1);
|
|
|
|
stuff (input_w (cmdline), tmp, 1);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (tmp);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
char *tmp = name_quote (panel->dir.list [panel->selected].fname, 1);
|
|
|
|
stuff (input_w (cmdline), tmp, 1);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (tmp);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
input_enable_update (input_w (cmdline));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void copy_current_tagged (void)
|
|
|
|
{
|
|
|
|
copy_tagged (cpanel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void copy_other_tagged (void)
|
|
|
|
{
|
|
|
|
if (get_other_type () != view_listing)
|
|
|
|
return;
|
|
|
|
copy_tagged (opanel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void do_suspend_cmd (void)
|
|
|
|
{
|
|
|
|
pre_exec ();
|
|
|
|
|
|
|
|
if (console_flag && !use_subshell)
|
|
|
|
restore_console ();
|
|
|
|
|
1999-02-14 00:39:18 +03:00
|
|
|
#ifdef SIGTSTP
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
struct sigaction sigtstp_action;
|
|
|
|
|
|
|
|
/* Make sure that the SIGTSTP below will suspend us directly,
|
|
|
|
without calling ncurses' SIGTSTP handler; we *don't* want
|
|
|
|
ncurses to redraw the screen immediately after the SIGCONT */
|
|
|
|
sigaction (SIGTSTP, &startup_handler, &sigtstp_action);
|
|
|
|
|
|
|
|
kill (getpid (), SIGTSTP);
|
|
|
|
|
|
|
|
/* Restore previous SIGTSTP action */
|
|
|
|
sigaction (SIGTSTP, &sigtstp_action, NULL);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (console_flag && !use_subshell)
|
|
|
|
handle_console (CONSOLE_SAVE);
|
|
|
|
|
|
|
|
edition_post_exec ();
|
|
|
|
}
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
void
|
|
|
|
suspend_cmd (void)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
save_cwds_stat ();
|
|
|
|
do_suspend_cmd ();
|
1998-04-30 07:21:52 +04:00
|
|
|
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
1998-02-27 07:54:42 +03:00
|
|
|
do_refresh ();
|
|
|
|
}
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
static void
|
|
|
|
init_labels (Widget *paneletc)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
1998-03-25 08:16:00 +03:00
|
|
|
define_label (midnight_dlg, paneletc, 1, _("Help"), help_cmd);
|
|
|
|
define_label (midnight_dlg, paneletc, 2, _("Menu"), user_menu_cmd);
|
|
|
|
define_label (midnight_dlg, paneletc, 9, _("PullDn"), menu_cmd);
|
|
|
|
define_label (midnight_dlg, paneletc, 10, _("Quit"), (voidfn) quit_cmd);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static key_map ctl_x_map [] = {
|
|
|
|
{ XCTRL('c'), (callfn) quit_cmd },
|
|
|
|
#ifdef USE_VFS
|
|
|
|
{ 'a', reselect_vfs },
|
|
|
|
#endif
|
|
|
|
{ 'd', compare_dirs_cmd },
|
1998-05-05 09:49:57 +04:00
|
|
|
#ifndef HAVE_GNOME
|
1998-02-27 07:54:42 +03:00
|
|
|
{ 'p', copy_current_pathname },
|
|
|
|
{ XCTRL('p'), copy_other_pathname },
|
|
|
|
{ 't', copy_current_tagged },
|
|
|
|
{ XCTRL('t'), copy_other_tagged },
|
1998-05-05 09:49:57 +04:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
{ 'c', chmod_cmd },
|
|
|
|
#ifndef OS2_NT
|
|
|
|
{ 'o', chown_cmd },
|
|
|
|
{ 'l', link_cmd },
|
|
|
|
{ XCTRL('l'), other_symlink_cmd },
|
|
|
|
{ 's', symlink_cmd },
|
|
|
|
{ XCTRL('s'), edit_symlink_cmd },
|
|
|
|
{ 'r', copy_current_readlink },
|
|
|
|
{ XCTRL('r'), copy_other_readlink },
|
|
|
|
#endif
|
|
|
|
#ifndef HAVE_GNOME
|
|
|
|
{ 'i', info_cmd_no_menu },
|
|
|
|
{ 'q', quick_cmd_no_menu },
|
|
|
|
#endif
|
|
|
|
{ 'h', add2hotlist_cmd },
|
|
|
|
{ '!', external_panelize },
|
|
|
|
#ifdef WITH_BACKGROUND
|
|
|
|
{ 'j', jobs_cmd },
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SETSOCKOPT
|
|
|
|
{ '%', source_routing },
|
|
|
|
#endif
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
1998-05-05 09:49:57 +04:00
|
|
|
static int ctl_x_map_enabled = 0;
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
static void ctl_x_cmd (int ignore)
|
|
|
|
{
|
1998-05-05 09:49:57 +04:00
|
|
|
ctl_x_map_enabled = 1;
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void nothing ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static key_map default_map [] = {
|
1998-05-05 09:49:57 +04:00
|
|
|
#ifndef HAVE_GNOME
|
1998-02-27 07:54:42 +03:00
|
|
|
{ KEY_F(19), menu_last_selected_cmd },
|
|
|
|
{ KEY_F(20), (key_callback) quiet_quit_cmd },
|
|
|
|
|
|
|
|
/* Copy useful information to the command line */
|
|
|
|
{ ALT('\n'), copy_prog_name },
|
|
|
|
{ ALT('\r'), copy_prog_name },
|
|
|
|
{ ALT('a'), copy_current_pathname },
|
|
|
|
{ ALT('A'), copy_other_pathname },
|
|
|
|
|
|
|
|
{ ALT('c'), quick_cd_cmd },
|
|
|
|
|
|
|
|
/* To access the directory hotlist */
|
|
|
|
{ XCTRL('\\'), quick_chdir_cmd },
|
|
|
|
|
1998-05-05 09:49:57 +04:00
|
|
|
/* Suspend */
|
|
|
|
{ XCTRL('z'), suspend_cmd },
|
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
/* The filtered view command */
|
|
|
|
{ ALT('!'), filtered_view_cmd_cpanel },
|
|
|
|
|
|
|
|
/* Find file */
|
|
|
|
{ ALT('?'), find_cmd },
|
|
|
|
|
|
|
|
/* Panel refresh */
|
|
|
|
{ XCTRL('r'), reread_cmd },
|
|
|
|
|
|
|
|
{ ALT('t'), toggle_listing_cmd },
|
|
|
|
|
|
|
|
#ifndef HAVE_X
|
|
|
|
/* Swap panels */
|
|
|
|
{ XCTRL('u'), swap_cmd },
|
|
|
|
|
|
|
|
/* View output */
|
|
|
|
{ XCTRL('o'), view_other_cmd },
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Control-X keybindings */
|
|
|
|
{ XCTRL('x'), ctl_x_cmd },
|
|
|
|
|
|
|
|
/* Trap dlg's exit commands */
|
|
|
|
{ ESC_CHAR, nothing },
|
|
|
|
{ XCTRL('c'), nothing },
|
|
|
|
{ XCTRL('g'), nothing },
|
|
|
|
{ 0, 0 },
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifndef HAVE_X
|
|
|
|
static void setup_sigwinch ()
|
|
|
|
{
|
1998-09-22 18:45:38 +04:00
|
|
|
#if (defined(HAVE_SLANG) || (NCURSES_VERSION_MAJOR >= 4)) && \
|
|
|
|
!defined(OS2_NT) && defined(SIGWINCH)
|
1998-02-27 07:54:42 +03:00
|
|
|
struct sigaction act, oact;
|
1998-09-22 18:45:38 +04:00
|
|
|
act.sa_handler = flag_winch;
|
|
|
|
sigemptyset (&act.sa_mask);
|
|
|
|
act.sa_flags = 0;
|
|
|
|
# ifdef SA_RESTART
|
|
|
|
act.sa_flags |= SA_RESTART;
|
1998-02-27 07:54:42 +03:00
|
|
|
# endif
|
1998-09-22 18:45:38 +04:00
|
|
|
sigaction (SIGWINCH, &act, &oact);
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
setup_pre ()
|
|
|
|
{
|
|
|
|
/* Call all the inits */
|
|
|
|
#ifndef HAVE_SLANG
|
|
|
|
meta (stdscr, eight_bit_clean);
|
|
|
|
#else
|
|
|
|
SLsmg_Display_Eight_Bit = full_eight_bits ? 128 : 160;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define setup_pre()
|
|
|
|
#define setup_sigwinch()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
|
|
|
setup_post ()
|
|
|
|
{
|
|
|
|
setup_sigwinch ();
|
|
|
|
|
|
|
|
init_uid_gid_cache ();
|
|
|
|
|
|
|
|
#ifndef HAVE_X
|
|
|
|
if (baudrate () < 9600 || slow_terminal){
|
|
|
|
verbose = 0;
|
|
|
|
}
|
|
|
|
if (use_mouse_p)
|
|
|
|
init_mouse ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
midnight_colors [0] = 0;
|
|
|
|
midnight_colors [1] = REVERSE_COLOR; /* FOCUSC */
|
|
|
|
midnight_colors [2] = INPUT_COLOR; /* HOT_NORMALC */
|
|
|
|
midnight_colors [3] = NORMAL_COLOR; /* HOT_FOCUSC */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setup_mc (void)
|
|
|
|
{
|
|
|
|
setup_pre ();
|
|
|
|
init_menu ();
|
|
|
|
create_panels ();
|
1998-03-13 06:44:54 +03:00
|
|
|
|
|
|
|
#ifdef HAVE_GNOME
|
|
|
|
return;
|
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
setup_panels ();
|
|
|
|
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
if (use_subshell)
|
|
|
|
add_select_channel (subshell_pty, load_prompt, 0);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
setup_post ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setup_dummy_mc (const char *file)
|
|
|
|
{
|
|
|
|
char d[MC_MAXPATHLEN];
|
|
|
|
|
|
|
|
mc_get_current_wd (d, MC_MAXPATHLEN);
|
|
|
|
setup_mc ();
|
|
|
|
mc_chdir (d);
|
|
|
|
|
|
|
|
/* Create a fake current_panel, this is needed because the
|
|
|
|
* expand_format routine will use current panel.
|
|
|
|
*/
|
|
|
|
strcpy (cpanel->cwd, d);
|
|
|
|
cpanel->selected = 0;
|
|
|
|
cpanel->count = 1;
|
|
|
|
cpanel->dir.list[0].fname = (char *) file;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void done_mc ()
|
|
|
|
{
|
|
|
|
done_menu ();
|
|
|
|
|
|
|
|
/* Setup shutdown
|
|
|
|
*
|
|
|
|
* We sync the profiles since the hotlist may have changed, while
|
|
|
|
* we only change the setup data if we have the auto save feature set
|
|
|
|
*/
|
|
|
|
if (auto_save_setup)
|
|
|
|
save_setup (); /* does also call save_hotlist */
|
|
|
|
else
|
|
|
|
save_hotlist();
|
|
|
|
done_screen ();
|
|
|
|
vfs_add_current_stamps ();
|
|
|
|
if (xterm_flag && xterm_hintbar)
|
1998-03-25 08:16:00 +03:00
|
|
|
set_hintbar(_("Thank you for using GNU Midnight Commander"));
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This should be called after destroy_dlg since panel widgets
|
|
|
|
* save their state on the profiles
|
|
|
|
*/
|
|
|
|
static void done_mc_profile ()
|
|
|
|
{
|
|
|
|
if (!auto_save_setup)
|
|
|
|
profile_forget_profile (profile_name);
|
|
|
|
sync_profiles ();
|
|
|
|
done_setup ();
|
|
|
|
free_profiles ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This routine only handles cpanel, and opanel, it is easy to
|
|
|
|
* change to use npanels, just loop over the number of panels
|
|
|
|
* and use get_panel_widget (i) and make the test done below
|
|
|
|
*/
|
1998-12-03 00:27:27 +03:00
|
|
|
static void
|
|
|
|
make_panels_dirty ()
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
if (cpanel->dirty)
|
|
|
|
panel_update_contents (cpanel);
|
|
|
|
|
|
|
|
if ((get_other_type () == view_listing) && opanel->dirty)
|
|
|
|
panel_update_contents (opanel);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* In OS/2 and Windows NT people want to actually type the '\' key frequently */
|
|
|
|
#ifdef OS2_NT
|
|
|
|
# define check_key_backslash(x) 0
|
|
|
|
#else
|
|
|
|
# define check_key_backslash(x) ((x) == '\\')
|
|
|
|
#endif
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
int
|
|
|
|
midnight_callback (struct Dlg_head *h, int id, int msg)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
switch (msg){
|
|
|
|
/* Speed up routine: now, we just set the */
|
|
|
|
case DLG_PRE_EVENT:
|
|
|
|
make_panels_dirty ();
|
|
|
|
return MSG_HANDLED;
|
|
|
|
|
|
|
|
case DLG_KEY:
|
1998-05-05 09:49:57 +04:00
|
|
|
if (ctl_x_map_enabled){
|
|
|
|
ctl_x_map_enabled = 0;
|
|
|
|
for (i = 0; ctl_x_map [i].key_code; i++)
|
|
|
|
if (id == ctl_x_map [i].key_code){
|
|
|
|
(*ctl_x_map [i].fn)(id);
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
if (id == KEY_F(10) && !the_menubar->active){
|
|
|
|
quit_cmd ();
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (id == '\t')
|
|
|
|
free_completions (input_w (cmdline));
|
|
|
|
|
|
|
|
/* On Linux, we can tell the difference */
|
|
|
|
if (id == '\n' && ctrl_pressed ()){
|
|
|
|
copy_prog_name ();
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (id == '\n' && input_w (cmdline)->buffer [0]){
|
|
|
|
send_message_to (h, (Widget *) cmdline, WIDGET_KEY, id);
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
|
1998-04-01 02:36:24 +04:00
|
|
|
if ((!alternate_plus_minus || !(console_flag || xterm_flag)) &&
|
|
|
|
!quote && !cpanel->searching) {
|
1998-02-27 07:54:42 +03:00
|
|
|
if(!only_leading_plus_minus) {
|
|
|
|
/* Special treatement, since the input line will eat them */
|
1998-04-01 02:36:24 +04:00
|
|
|
if (id == '+' ) {
|
1998-02-27 07:54:42 +03:00
|
|
|
select_cmd ();
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
|
1998-04-01 02:36:24 +04:00
|
|
|
if (check_key_backslash (id) || id == '-'){
|
1998-02-27 07:54:42 +03:00
|
|
|
unselect_cmd ();
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
1998-04-01 02:36:24 +04:00
|
|
|
|
|
|
|
if (id == '*') {
|
|
|
|
reverse_selection_cmd ();
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
} else if (command_prompt && !strlen (input_w (cmdline)->buffer)) {
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Special treatement '+', '-', '\', '*' only when this is
|
|
|
|
* first char on input line
|
|
|
|
*/
|
|
|
|
|
1998-04-01 02:36:24 +04:00
|
|
|
if (id == '+') {
|
1998-02-27 07:54:42 +03:00
|
|
|
select_cmd ();
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
|
1998-04-01 02:36:24 +04:00
|
|
|
if (check_key_backslash (id) || id == '-') {
|
1998-02-27 07:54:42 +03:00
|
|
|
unselect_cmd ();
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
|
1998-04-01 02:36:24 +04:00
|
|
|
if (id == '*') {
|
1998-02-27 07:54:42 +03:00
|
|
|
reverse_selection_cmd ();
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DLG_HOTKEY_HANDLED:
|
|
|
|
if (get_current_type () == view_listing)
|
|
|
|
cpanel->searching = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DLG_UNHANDLED_KEY:
|
|
|
|
if (command_prompt){
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = send_message_to (h, (Widget *) cmdline, WIDGET_KEY, id);
|
|
|
|
if (v)
|
|
|
|
return v;
|
|
|
|
}
|
1998-05-05 09:49:57 +04:00
|
|
|
if (ctl_x_map_enabled){
|
|
|
|
ctl_x_map_enabled = 0;
|
|
|
|
for (i = 0; ctl_x_map [i].key_code; i++)
|
|
|
|
if (id == ctl_x_map [i].key_code){
|
|
|
|
(*ctl_x_map [i].fn)(id);
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; default_map [i].key_code; i++){
|
|
|
|
if (id == default_map [i].key_code){
|
|
|
|
(*default_map [i].fn)(id);
|
|
|
|
return MSG_HANDLED;
|
|
|
|
}
|
|
|
|
}
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
1998-05-05 09:49:57 +04:00
|
|
|
return MSG_NOT_HANDLED;
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifndef HAVE_X
|
|
|
|
/* We handle the special case of the output lines */
|
|
|
|
case DLG_DRAW:
|
|
|
|
attrset (SELECTED_COLOR);
|
|
|
|
if (console_flag && output_lines)
|
|
|
|
show_console_contents (output_start_y,
|
|
|
|
LINES-output_lines-keybar_visible-1,
|
|
|
|
LINES-keybar_visible-1);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
return default_dlg_callback (h, id, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_X
|
|
|
|
/* This should be rewritten in order to support as many panel containers as
|
|
|
|
the user wants */
|
|
|
|
|
1998-03-03 08:20:20 +03:00
|
|
|
#ifndef HAVE_GNOME
|
1998-02-27 07:54:42 +03:00
|
|
|
widget_data containers [2];
|
|
|
|
int containers_no = 2;
|
|
|
|
|
|
|
|
void
|
|
|
|
xtoolkit_panel_setup ()
|
|
|
|
{
|
|
|
|
containers [0] = x_create_panel_container (0);
|
|
|
|
containers [1] = x_create_panel_container (1);
|
|
|
|
input_w (cmdline)->widget.wcontainer = containers [0];
|
|
|
|
input_w (cmdline)->widget.area = AREA_BOTTOM;
|
|
|
|
the_prompt->widget.wcontainer = containers [0];
|
|
|
|
the_prompt->widget.area = AREA_BOTTOM;
|
|
|
|
the_bar->widget.wcontainer = containers [0];
|
|
|
|
the_bar->widget.area = AREA_TOP;
|
|
|
|
get_panel_widget (0)->wcontainer = containers [0];
|
|
|
|
get_panel_widget (0)->area = AREA_RIGHT;
|
|
|
|
get_panel_widget (1)->wcontainer = containers [1];
|
|
|
|
get_panel_widget (1)->area = AREA_RIGHT;
|
|
|
|
the_menubar->widget.wcontainer = (widget_data) NULL;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
# define xtoolkit_panel_setup()
|
|
|
|
#endif
|
|
|
|
|
1998-03-03 08:20:20 +03:00
|
|
|
#else
|
|
|
|
# define xtoolkit_panel_setup()
|
|
|
|
#endif
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifndef PORT_HAS_LOAD_HINT
|
|
|
|
void load_hint ()
|
|
|
|
{
|
|
|
|
char *hint;
|
|
|
|
|
|
|
|
if (!the_hint->widget.parent)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!message_visible && (!xterm_flag || !xterm_hintbar)){
|
|
|
|
label_set_text (the_hint, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((hint = get_random_hint ())){
|
|
|
|
if (*hint)
|
|
|
|
set_hintbar (hint);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (hint);
|
1998-02-27 07:54:42 +03:00
|
|
|
} else {
|
|
|
|
set_hintbar ("The Midnight Commander " VERSION
|
|
|
|
" (C) 1995-1997 the Free Software Foundation");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
|
|
|
setup_panels_and_run_mc ()
|
|
|
|
{
|
|
|
|
int first, second;
|
|
|
|
|
|
|
|
xtoolkit_panel_setup ();
|
|
|
|
#ifndef HAVE_X
|
|
|
|
add_widget (midnight_dlg, the_hint);
|
|
|
|
#endif /* HAVE_X */
|
|
|
|
load_hint ();
|
|
|
|
add_widgetl (midnight_dlg, cmdline, XV_WLAY_RIGHTOF);
|
|
|
|
add_widgetl (midnight_dlg, the_prompt, XV_WLAY_DONTCARE);
|
|
|
|
add_widget (midnight_dlg, the_bar);
|
1998-12-03 02:44:06 +03:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
if (boot_current_is_left){
|
|
|
|
first = 1;
|
|
|
|
second = 0;
|
|
|
|
} else {
|
|
|
|
first = 0;
|
|
|
|
second = 1;
|
|
|
|
}
|
|
|
|
add_widget (midnight_dlg, get_panel_widget (first));
|
|
|
|
add_widget (midnight_dlg, get_panel_widget (second));
|
|
|
|
add_widget (midnight_dlg, the_menubar);
|
|
|
|
|
|
|
|
init_labels (get_panel_widget (0));
|
|
|
|
init_labels (get_panel_widget (1));
|
|
|
|
|
|
|
|
/* Run the Midnight Commander if no file was specified in the command line */
|
|
|
|
run_dlg (midnight_dlg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* result must be free'd (I think this should go in util.c) */
|
1998-12-03 00:27:27 +03:00
|
|
|
static char *
|
1998-02-27 07:54:42 +03:00
|
|
|
prepend_cwd_on_local (char *filename)
|
|
|
|
{
|
|
|
|
char *d;
|
|
|
|
int l;
|
|
|
|
|
|
|
|
if (vfs_file_is_local (filename)){
|
|
|
|
if (*filename == PATH_SEP) /* an absolute pathname */
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
return g_strdup (filename);
|
|
|
|
d = g_malloc (MC_MAXPATHLEN + strlen (filename) + 2);
|
1998-02-27 07:54:42 +03:00
|
|
|
mc_get_current_wd (d, MC_MAXPATHLEN);
|
|
|
|
l = strlen(d);
|
|
|
|
d[l++] = PATH_SEP;
|
|
|
|
strcpy (d + l, filename);
|
|
|
|
return canonicalize_pathname (d);
|
|
|
|
} else
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
return g_strdup (filename);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USE_INTERNAL_EDIT
|
|
|
|
void edit (const char *file_name, int startline);
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
static int
|
1998-02-27 07:54:42 +03:00
|
|
|
mc_maybe_editor_or_viewer (void)
|
|
|
|
{
|
|
|
|
char *path;
|
|
|
|
|
|
|
|
if (!(view_one_file || edit_one_file))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Invoke the internal view/edit routine with:
|
|
|
|
* the default processing and forcing the internal viewer/editor
|
|
|
|
*/
|
|
|
|
if (view_one_file) {
|
|
|
|
path = prepend_cwd_on_local (view_one_file);
|
|
|
|
setup_dummy_mc (path);
|
|
|
|
view_file (path, 0, 1);
|
|
|
|
}
|
|
|
|
#ifdef USE_INTERNAL_EDIT
|
|
|
|
else {
|
|
|
|
path = prepend_cwd_on_local ("");
|
1999-02-16 00:19:03 +03:00
|
|
|
#ifndef HAVE_GNOME
|
1998-02-27 07:54:42 +03:00
|
|
|
setup_dummy_mc (path);
|
1999-02-16 00:19:03 +03:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
edit (edit_one_file, 1);
|
1999-02-16 00:19:03 +03:00
|
|
|
#ifdef HAVE_GNOME
|
|
|
|
gtk_main ();
|
|
|
|
exit (1);
|
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
#endif
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (path);
|
1998-02-27 07:54:42 +03:00
|
|
|
midnight_shutdown = 1;
|
|
|
|
done_mc ();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
|
|
|
do_nc (void)
|
|
|
|
{
|
|
|
|
midnight_dlg = create_dlg (0, 0, LINES, COLS, midnight_colors, midnight_callback, "[main]", "midnight", 0);
|
|
|
|
midnight_dlg->has_menubar = 1;
|
|
|
|
|
|
|
|
#ifdef USE_INTERNAL_EDIT
|
|
|
|
/* Check if we were invoked as an editor or file viewer */
|
|
|
|
if (mc_maybe_editor_or_viewer ())
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
setup_mc ();
|
|
|
|
|
1998-03-13 06:44:54 +03:00
|
|
|
#ifndef HAVE_GNOME
|
1998-02-27 07:54:42 +03:00
|
|
|
setup_panels_and_run_mc ();
|
1998-03-13 06:44:54 +03:00
|
|
|
#endif
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Program end */
|
|
|
|
midnight_shutdown = 1;
|
|
|
|
|
|
|
|
/* destroy_dlg destroys even cpanel->cwd, so we have to save a copy :) */
|
|
|
|
if (print_last_wd) {
|
|
|
|
if (!vfs_current_is_local ())
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
last_wd_string = g_strdup (".");
|
1998-02-27 07:54:42 +03:00
|
|
|
else
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
last_wd_string = g_strdup (cpanel->cwd);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
done_mc ();
|
|
|
|
|
|
|
|
#ifndef HAVE_GNOME
|
1998-03-13 06:44:54 +03:00
|
|
|
destroy_dlg (midnight_dlg);
|
1998-02-27 07:54:42 +03:00
|
|
|
current_panel = 0;
|
|
|
|
#endif
|
|
|
|
done_mc_profile ();
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "features.inc"
|
|
|
|
|
|
|
|
static void
|
|
|
|
version (int verbose)
|
|
|
|
{
|
1998-05-19 12:58:41 +04:00
|
|
|
fprintf (stderr, "The Midnight Commander %s\n", VERSION);
|
1998-02-27 07:54:42 +03:00
|
|
|
if (!verbose)
|
|
|
|
return;
|
|
|
|
|
|
|
|
#ifndef HAVE_X
|
|
|
|
fprintf (stderr,
|
1998-03-25 08:16:00 +03:00
|
|
|
_("with mouse support on xterm%s.\n"),
|
|
|
|
status_mouse_support ? _(" and the Linux console") : "");
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif /* HAVE_X */
|
|
|
|
|
|
|
|
fprintf (stderr, features);
|
|
|
|
if (print_last_wd)
|
|
|
|
write (stdout_fd, ".", 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined (_OS_NT)
|
|
|
|
/* Windows NT code */
|
|
|
|
#define CONTROL_FILE "\\mc.%d.control"
|
|
|
|
char control_file [sizeof (CONTROL_FILE) + 8];
|
|
|
|
|
|
|
|
void
|
|
|
|
OS_Setup ()
|
|
|
|
{
|
|
|
|
SetConsoleTitle ("GNU Midnight Commander");
|
|
|
|
|
|
|
|
shell = getenv ("COMSPEC");
|
|
|
|
if (!shell || !*shell)
|
|
|
|
shell = get_default_shell ();
|
|
|
|
|
|
|
|
/* Default opening mode for files is binary, not text (CR/LF translation) */
|
1998-05-12 20:38:27 +04:00
|
|
|
#ifndef __EMX__
|
1998-03-16 22:09:24 +03:00
|
|
|
_fmode = O_BINARY;
|
1998-05-12 20:38:27 +04:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
mc_home = get_mc_lib_dir ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sigchld_handler_no_subshell (int sig)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
init_sigchld (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
init_sigfatals (void)
|
|
|
|
{
|
|
|
|
/* Nothing to be done on the OS/2, Windows/NT */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined (__os2__)
|
|
|
|
/* OS/2 Version */
|
|
|
|
# define CONTROL_FILE "\\mc.%d.control"
|
|
|
|
char control_file [sizeof (CONTROL_FILE) + 8];
|
|
|
|
|
|
|
|
void
|
|
|
|
OS_Setup (void)
|
|
|
|
{
|
|
|
|
/* .ado: This does not work: */
|
|
|
|
/* DosSMSetTitle ((PSZ) "This is my app"); */
|
|
|
|
/* In DEF: IMPORTS
|
|
|
|
DosSMSetTitle = SESMGR.DOSSMSETTITLE */
|
|
|
|
shell = getenv ("COMSPEC");
|
|
|
|
if (!shell || !*shell)
|
|
|
|
shell = get_default_shell ();
|
|
|
|
|
|
|
|
mc_home = get_mc_lib_dir ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sigchld_handler_no_subshell (int sig)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
init_sigchld (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
init_sigfatals (void)
|
|
|
|
{
|
|
|
|
/* Nothing to be done on the OS/2, Windows/NT */
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
|
|
|
|
/* Unix version */
|
|
|
|
#define CONTROL_FILE "/tmp/mc.%d.control"
|
|
|
|
char control_file [sizeof (CONTROL_FILE) + 8];
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
static void
|
1998-02-27 07:54:42 +03:00
|
|
|
OS_Setup ()
|
|
|
|
{
|
|
|
|
char *termvalue;
|
1998-08-27 00:23:10 +04:00
|
|
|
char *mc_libdir;
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
termvalue = getenv ("TERM");
|
|
|
|
if (!termvalue){
|
1998-03-25 08:16:00 +03:00
|
|
|
fprintf (stderr, _("The TERM environment variable is unset!\n"));
|
1998-02-27 07:54:42 +03:00
|
|
|
termvalue = "";
|
|
|
|
}
|
|
|
|
#ifndef HAVE_X
|
1998-04-08 05:29:30 +04:00
|
|
|
if (force_xterm || (strncmp (termvalue, "xterm", 5) == 0 || strcmp (termvalue, "dtterm") == 0)){
|
1998-02-27 07:54:42 +03:00
|
|
|
use_mouse_p = XTERM_MOUSE;
|
|
|
|
xterm_flag = 1;
|
|
|
|
# ifdef SET_TITLE
|
|
|
|
printf ("\33]0;GNU Midnight Commander\7");
|
|
|
|
# endif
|
|
|
|
}
|
|
|
|
#endif /* ! HAVE_X */
|
|
|
|
shell = getenv ("SHELL");
|
|
|
|
if (!shell || !*shell)
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
shell = g_strdup (getpwuid (geteuid ())->pw_shell);
|
1998-02-27 07:54:42 +03:00
|
|
|
if (!shell || !*shell)
|
|
|
|
shell = "/bin/sh";
|
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_snprintf (control_file, sizeof (control_file), CONTROL_FILE, getpid ());
|
1998-02-27 07:54:42 +03:00
|
|
|
my_putenv ("MC_CONTROL_FILE", control_file);
|
|
|
|
|
1998-08-27 00:23:10 +04:00
|
|
|
/* This is the directory, where MC was installed, on Unix this is LIBDIR */
|
|
|
|
/* and can be overriden by the MC_LIBDIR environment variable */
|
|
|
|
if ((mc_libdir = getenv ("MC_LIBDIR")) != NULL) {
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
mc_home = g_strdup (mc_libdir);
|
1998-08-27 00:23:10 +04:00
|
|
|
} else {
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
mc_home = g_strdup (LIBDIR);
|
1998-08-27 00:23:10 +04:00
|
|
|
}
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sigchld_handler_no_subshell (int sig)
|
|
|
|
{
|
|
|
|
#ifndef HAVE_X
|
|
|
|
int pid, status;
|
|
|
|
|
|
|
|
if (!console_flag)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* COMMENT: if it were true that after the call to handle_console(..INIT)
|
|
|
|
the value of console_flag never changed, we could simply not install
|
|
|
|
this handler at all if (!console_flag && !use_subshell). */
|
|
|
|
|
|
|
|
/* That comment is no longer true. We need to wait() on a sigchld
|
|
|
|
handler (that's at least what the tarfs code expects currently). */
|
|
|
|
|
|
|
|
#ifndef SCO_FLAVOR
|
|
|
|
pid = waitpid (cons_saver_pid, &status, WUNTRACED | WNOHANG);
|
|
|
|
|
|
|
|
if (pid == cons_saver_pid){
|
|
|
|
/* {{{ Someone has stopped or killed cons.saver; restart it */
|
|
|
|
|
1999-02-14 00:39:18 +03:00
|
|
|
# ifdef SIGTSTP
|
1998-02-27 07:54:42 +03:00
|
|
|
if (WIFSTOPPED (status))
|
|
|
|
kill (pid, SIGCONT);
|
|
|
|
else
|
1999-02-14 00:39:18 +03:00
|
|
|
# endif
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
handle_console (CONSOLE_DONE);
|
|
|
|
handle_console (CONSOLE_INIT);
|
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
}
|
|
|
|
#endif /* ! SCO_FLAVOR */
|
|
|
|
|
|
|
|
/* If we get here, some other child exited; ignore it */
|
|
|
|
#endif /* ! HAVE_X */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
init_sigchld (void)
|
|
|
|
{
|
|
|
|
struct sigaction sigchld_action;
|
|
|
|
|
|
|
|
sigchld_action.sa_handler =
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
use_subshell ? sigchld_handler :
|
|
|
|
#endif
|
|
|
|
sigchld_handler_no_subshell;
|
|
|
|
|
|
|
|
sigemptyset (&sigchld_action.sa_mask);
|
|
|
|
|
|
|
|
#ifdef SA_RESTART
|
|
|
|
sigchld_action.sa_flags = SA_RESTART;
|
|
|
|
#else
|
|
|
|
sigchld_action.sa_flags = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
sigaction (SIGCHLD, &sigchld_action, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _OS_NT, __os2__, UNIX */
|
|
|
|
|
1998-12-02 08:18:20 +03:00
|
|
|
#ifndef HAVE_X
|
1998-03-07 23:27:44 +03:00
|
|
|
#if defined(HAVE_SLANG) && !defined(OS2_NT)
|
|
|
|
extern int SLtt_Try_Termcap;
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
1998-12-02 08:18:20 +03:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
static void
|
1998-05-20 06:19:17 +04:00
|
|
|
print_mc_usage (void)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
version (0);
|
|
|
|
fprintf (stderr,
|
1998-05-19 12:58:41 +04:00
|
|
|
"Usage is:\n\n"
|
1998-02-27 07:54:42 +03:00
|
|
|
"mc [flags] [this_dir] [other_panel_dir]\n\n"
|
|
|
|
#if defined(HAVE_SLANG) && !defined(OS2_NT)
|
|
|
|
"-a, --stickchars Force use of +, -, | for line drawing.\n"
|
|
|
|
#endif
|
|
|
|
"-b, --nocolor Force black and white display.\n"
|
|
|
|
#ifdef WITH_BACKGROUND
|
|
|
|
"-B, --background [DEVEL-ONLY: Debug the background code]\n"
|
|
|
|
#endif
|
|
|
|
"-c, --color Force color mode.\n"
|
|
|
|
"-C, --colors Specify colors (use --help-colors to get a list).\n"
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
"-d, --nomouse Disable mouse support.\n"
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef USE_INTERNAL_EDIT
|
|
|
|
"-e, --edit Startup the internal editor.\n"
|
|
|
|
#endif
|
|
|
|
"-f, --libdir Print configured paths.\n"
|
|
|
|
"-h, --help Shows this help message.\n"
|
|
|
|
"-k, --resetsoft Reset softkeys (HP terminals only) to their terminfo/termcap\n"
|
|
|
|
" default.\n"
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
#ifdef USE_NETCODE
|
|
|
|
"-l, --ftplog file Log ftpfs commands to the file.\n"
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_MAD
|
|
|
|
"-M, --memory file [DEVEL-ONLY: Log MAD messages to the file.]\n"
|
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
"-P, --printwd At exit, print the last working directory.\n"
|
|
|
|
"-s, --slow Disables verbose operation (for slow terminals).\n"
|
1998-03-07 23:27:44 +03:00
|
|
|
#if defined(HAVE_SLANG) && !defined(OS2_NT)
|
1998-02-27 07:54:42 +03:00
|
|
|
"-t, --termcap Activate support for the TERMCAP variable.\n"
|
|
|
|
#endif
|
|
|
|
#if defined(HAVE_SLANG) && defined(OS2_NT)
|
|
|
|
"-S, --createcmdile Create command file to set default directory upon exit.\n"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
"-u, --nosubshell Disable the concurrent subshell mode.\n"
|
|
|
|
"-U, --subshell Force the concurrent subshell mode.\n"
|
|
|
|
"-r, --forceexec Force subshell execution.\n"
|
|
|
|
#endif
|
|
|
|
"-v, --view fname Start up into the viewer mode.\n"
|
|
|
|
"-V, --version Report version and configuration options.\n"
|
|
|
|
"-x, --xterm Force xterm mouse support and screen save/restore.\n"
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
"-X, --dbgsubshell [DEVEL-ONLY: Debug the subshell].\n"
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
print_color_usage (void)
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"--colors KEYWORD={FORE},{BACK}\n\n"
|
|
|
|
"{FORE} and {BACK} can be ommited, and the default will be used\n"
|
|
|
|
"\n"
|
|
|
|
"Keywords:\n"
|
|
|
|
" Global: errors, reverse, gauge, input\n"
|
|
|
|
" File display: normal, selected, marked, markselect\n"
|
|
|
|
" Dialog boxes: dnormal, dfocus, dhotnormal, dhotfocus\n"
|
|
|
|
" Menus: menu, menuhot, menusel, menuhotsel\n"
|
|
|
|
" Help: helpnormal, helpitalic, helplink, helpslink\n"
|
|
|
|
" File types: directory, execute, link, device, special, core\n"
|
|
|
|
"\n"
|
|
|
|
"Colors:\n"
|
|
|
|
" black, gray, red, brightred, green, brightgreen, brown,\n"
|
|
|
|
" yellow, blue, brightblue, magenta, brightmagenta, cyan,\n"
|
|
|
|
" brightcyan, lightgray and white\n\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
1998-04-09 08:58:24 +04:00
|
|
|
|
|
|
|
static void
|
|
|
|
probably_finish_program (void)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
1998-04-09 08:58:24 +04:00
|
|
|
if (finish_program){
|
|
|
|
if (print_last_wd)
|
|
|
|
printf (".");
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
}
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-04-30 10:03:17 +04:00
|
|
|
enum {
|
1998-05-05 03:50:57 +04:00
|
|
|
GEOMETRY_KEY = -1,
|
|
|
|
NOWIN_KEY = -2
|
1998-04-30 10:03:17 +04:00
|
|
|
};
|
|
|
|
|
1998-05-19 12:58:41 +04:00
|
|
|
static void
|
1999-02-25 08:11:35 +03:00
|
|
|
process_args (int c, const char *option_arg)
|
1998-04-09 08:58:24 +04:00
|
|
|
{
|
|
|
|
switch (c) {
|
|
|
|
case 'V':
|
|
|
|
version (1);
|
|
|
|
finish_program = 1;
|
|
|
|
break;
|
1999-03-20 21:08:52 +03:00
|
|
|
|
1998-04-09 08:58:24 +04:00
|
|
|
case 'c':
|
|
|
|
disable_colors = 0;
|
|
|
|
#ifdef HAVE_SLANG
|
|
|
|
force_colors = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'f':
|
|
|
|
fprintf (stderr, _("Library directory for the Midnight Commander: %s\n"), mc_home);
|
|
|
|
finish_program = 1;
|
|
|
|
break;
|
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
#ifdef USE_NETCODE
|
|
|
|
case 'l':
|
|
|
|
ftpfs_set_debug (option_arg);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
1998-04-09 08:58:24 +04:00
|
|
|
case 'm':
|
|
|
|
fprintf (stderr, _("Option -m is obsolete. Please look at Display Bits... in the Option's menu\n"));
|
|
|
|
finish_program = 1;
|
|
|
|
break;
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
|
|
|
|
#ifdef HAVE_MAD
|
|
|
|
case 'M':
|
|
|
|
mad_set_debug (option_arg);
|
1998-04-09 08:58:24 +04:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef OS2_NT
|
|
|
|
case 'S':
|
|
|
|
print_last_wd = 2;
|
|
|
|
batch_file_name = option_arg;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
use_mouse_p = NO_MOUSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'X':
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
debug_subshell = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'U':
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
use_subshell = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'u':
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
use_subshell = 0;
|
|
|
|
#endif
|
|
|
|
break;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-04-09 08:58:24 +04:00
|
|
|
case 'r':
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
force_subshell_execution = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'H':
|
|
|
|
print_color_usage ();
|
|
|
|
finish_program = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'h':
|
|
|
|
#ifndef PORT_WANTS_ARGP
|
1998-05-20 06:19:17 +04:00
|
|
|
print_mc_usage ();
|
1998-04-09 08:58:24 +04:00
|
|
|
finish_program = 1;
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
1998-04-09 08:58:24 +04:00
|
|
|
}
|
|
|
|
}
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-12-22 02:30:53 +03:00
|
|
|
#ifdef HAVE_GNOME
|
|
|
|
static void parse_an_arg (poptContext state,
|
|
|
|
enum poptCallbackReason reason,
|
|
|
|
const struct poptOption *opt,
|
|
|
|
const char *arg, void *data)
|
|
|
|
{
|
|
|
|
process_args (opt->shortName, arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
1998-11-04 02:34:54 +03:00
|
|
|
char *cmdline_geometry = NULL;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-12-03 02:44:06 +03:00
|
|
|
static struct poptOption argument_table [] = {
|
1998-12-22 02:30:53 +03:00
|
|
|
#ifdef HAVE_GNOME
|
|
|
|
{ NULL, '\0', POPT_ARG_CALLBACK, parse_an_arg, 0},
|
|
|
|
#endif
|
1998-04-09 08:58:24 +04:00
|
|
|
#ifdef WITH_BACKGROUND
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "background", 'B', POPT_ARG_NONE, &background_wait, 0,
|
|
|
|
N_("Use to debug the background code") },
|
1998-04-09 08:58:24 +04:00
|
|
|
#endif
|
|
|
|
#if defined(HAVE_SLANG) && defined(OS2_NT)
|
|
|
|
{ "createcmdfile", 'S', POPT_ARG_STRING, NULL, 'S' },
|
|
|
|
#endif
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "color", 'c', POPT_ARG_NONE, NULL, 'c',
|
|
|
|
N_("Request to run in color mode") },
|
|
|
|
{ "colors", 'C', POPT_ARG_STRING, &command_line_colors, 0,
|
|
|
|
N_("Specifies a color configuration") },
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
1998-04-09 08:58:24 +04:00
|
|
|
{ "dbgsubshell", 'X', POPT_ARG_NONE, &debug_subshell, 0 },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "edit", 'e', POPT_ARG_STRING, &edit_one_file, 0,
|
|
|
|
N_("Edits one file") },
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-11-04 02:34:54 +03:00
|
|
|
#ifndef HAVE_GNOME
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "help", 'h', POPT_ARG_NONE, NULL, 'h',
|
|
|
|
N_("Displays this help message") },
|
1998-11-04 02:34:54 +03:00
|
|
|
#endif
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "help-colors", 'H', POPT_ARG_NONE, NULL, 'H',
|
|
|
|
N_("Displays a help screen on how to change the color scheme") },
|
1998-04-09 08:58:24 +04:00
|
|
|
#ifdef USE_NETCODE
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "ftplog", 'l', POPT_ARG_STRING, NULL, 'l',
|
|
|
|
N_("Log ftp dialog to specified file") },
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_MAD
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "memory", 'M', POPT_ARG_STRING, NULL, 'M', },
|
1998-04-09 08:58:24 +04:00
|
|
|
#endif
|
|
|
|
{ "libdir", 'f', POPT_ARG_NONE, NULL, 'f' },
|
1999-03-11 05:00:12 +03:00
|
|
|
{ NULL, 'm', POPT_ARG_NONE, NULL, 'm',
|
|
|
|
N_("Obsolete") },
|
|
|
|
{ "nocolor", 'b', POPT_ARG_NONE, &disable_colors, 0,
|
|
|
|
N_("Requests to run in black and white") },
|
|
|
|
{ "nomouse", 'd', POPT_ARG_NONE, NULL, 'd',
|
|
|
|
N_("Disable mouse support in text version") },
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "nosubshell", 'u', POPT_ARG_NONE, NULL, 'u',
|
|
|
|
N_("Disables subshell support") },
|
1998-04-09 08:58:24 +04:00
|
|
|
{ "forceexec", 'r', POPT_ARG_NONE, NULL, 'r' },
|
|
|
|
#endif
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "printwd", 'P', POPT_ARG_NONE, &print_last_wd, 0,
|
|
|
|
N_("Prints working directory at program exit") },
|
|
|
|
{ "resetsoft", 'k', POPT_ARG_NONE, &reset_hp_softkeys, 0,
|
|
|
|
N_("Resets soft keys on HP terminals") },
|
|
|
|
{ "slow", 's', POPT_ARG_NONE, &slow_terminal, 0,
|
|
|
|
N_("To run on slow terminals") },
|
1998-04-09 08:58:24 +04:00
|
|
|
#if defined(HAVE_SLANG) && !defined(OS2_NT)
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "stickchars", 'a', 0, &force_ugly_line_drawing, 0,
|
|
|
|
N_("Use stickchars to draw") },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "subshell", 'U', POPT_ARG_NONE, NULL, 'U',
|
|
|
|
N_("Enables subshell support (default)")},
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
1998-12-02 08:18:20 +03:00
|
|
|
#if !defined(HAVE_X)
|
1998-04-09 08:58:24 +04:00
|
|
|
#if defined(HAVE_SLANG) && !defined(OS2_NT)
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "termcap", 't', 0, &SLtt_Try_Termcap, 0,
|
|
|
|
N_("Tries to use termcap instead of terminfo") },
|
1998-12-02 08:18:20 +03:00
|
|
|
#endif
|
1998-04-09 08:58:24 +04:00
|
|
|
#endif
|
1999-03-11 05:00:12 +03:00
|
|
|
{ "version", 'V', POPT_ARG_NONE, NULL, 'V',
|
|
|
|
N_("Displays the current version") },
|
|
|
|
{ "view", 'v', POPT_ARG_STRING, &view_one_file, 0,
|
|
|
|
N_("Launches the file viewer on a file") },
|
|
|
|
{ "xterm", 'x', POPT_ARG_NONE, &force_xterm, 0,
|
|
|
|
N_("Forces xterm features") },
|
1998-11-04 02:34:54 +03:00
|
|
|
#ifdef HAVE_GNOME
|
|
|
|
{ "geometry", '\0', POPT_ARG_STRING, &cmdline_geometry, 0, N_("Geometry for the window"), N_("GEOMETRY")},
|
|
|
|
{"nowindows", '\0', POPT_ARG_NONE, &nowindows, 0, N_("No windows opened at startup"), NULL},
|
1999-03-20 21:08:52 +03:00
|
|
|
{"desktop-linksdir", '\0', POPT_ARG_NONE, &display_linksdir, 0,
|
1999-03-30 10:09:56 +04:00
|
|
|
N_("Display the directory that holds the .links startup files and exit")},
|
1998-11-04 02:34:54 +03:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-04-09 08:58:24 +04:00
|
|
|
{ NULL, 0, 0, NULL, 0 }
|
|
|
|
};
|
|
|
|
|
1999-03-30 10:09:56 +04:00
|
|
|
/* Convenience function to display the desktop initialization directory and exit */
|
|
|
|
static void
|
|
|
|
maybe_display_linksdir (void)
|
1998-12-31 06:38:48 +03:00
|
|
|
{
|
1999-03-30 10:09:56 +04:00
|
|
|
if (display_linksdir) {
|
|
|
|
puts (DESKTOP_INIT_DIR);
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-12-31 06:38:48 +03:00
|
|
|
#ifdef HAVE_CORBA
|
1999-03-30 10:09:56 +04:00
|
|
|
/* Initializes the ORB and does the initial argument processing */
|
|
|
|
static void
|
|
|
|
init_corba_with_args (int *argc, char **argv, poptContext *ctx)
|
|
|
|
{
|
|
|
|
CORBA_Environment ev;
|
|
|
|
|
|
|
|
CORBA_exception_init (&ev);
|
|
|
|
orb = gnome_CORBA_init_with_popt_table ("gmc", VERSION, argc, argv, argument_table, 0, ctx,
|
|
|
|
GNORBA_INIT_SERVER_FUNC, &ev);
|
|
|
|
|
|
|
|
maybe_display_linksdir ();
|
|
|
|
|
|
|
|
if (ev._major != CORBA_NO_EXCEPTION) {
|
|
|
|
CORBA_exception_free (&ev);
|
|
|
|
g_warning ("Could not initialize CORBA");
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
CORBA_exception_free (&ev);
|
|
|
|
|
|
|
|
if (!corba_init_server ()) {
|
|
|
|
g_warning ("Could not initialize the CORBA server");
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
}
|
1998-12-31 06:38:48 +03:00
|
|
|
#endif
|
1999-03-30 10:09:56 +04:00
|
|
|
|
|
|
|
#ifndef HAVE_CORBA
|
|
|
|
void
|
|
|
|
corba_create_window (void)
|
|
|
|
{
|
|
|
|
/* nothing */
|
1998-12-31 06:38:48 +03:00
|
|
|
}
|
1999-03-30 10:09:56 +04:00
|
|
|
#endif
|
1998-12-31 06:38:48 +03:00
|
|
|
|
1998-04-09 08:58:24 +04:00
|
|
|
static void
|
|
|
|
handle_args (int argc, char *argv [])
|
|
|
|
{
|
1998-05-13 12:29:55 +04:00
|
|
|
char *tmp, *option_arg, *base;
|
1998-04-09 08:58:24 +04:00
|
|
|
int c;
|
1998-12-03 02:44:06 +03:00
|
|
|
poptContext ctx;
|
1998-04-09 08:58:24 +04:00
|
|
|
|
1998-11-04 02:34:54 +03:00
|
|
|
#ifdef HAVE_GNOME
|
1998-12-03 02:44:06 +03:00
|
|
|
#ifdef HAVE_CORBA
|
1999-03-30 10:09:56 +04:00
|
|
|
init_corba_with_args (&argc, argv, &ctx);
|
1998-12-03 02:44:06 +03:00
|
|
|
#else
|
|
|
|
gnome_init_with_popt_table ("gmc", VERSION, argc, argv, argument_table, 0, &ctx);
|
1998-12-31 04:18:31 +03:00
|
|
|
#endif
|
1999-03-30 10:09:56 +04:00
|
|
|
maybe_display_linksdir ();
|
|
|
|
|
1998-12-30 05:51:01 +03:00
|
|
|
gtk_widget_push_visual (gdk_imlib_get_visual ());
|
|
|
|
gtk_widget_push_colormap (gdk_imlib_get_colormap ());
|
|
|
|
|
1999-03-18 21:43:52 +03:00
|
|
|
/* poptResetContext (ctx); */
|
1998-11-04 02:34:54 +03:00
|
|
|
#else
|
1998-12-03 02:44:06 +03:00
|
|
|
ctx = poptGetContext ("mc", argc, argv, argument_table, 0);
|
1998-11-04 02:34:54 +03:00
|
|
|
#endif
|
1998-04-09 08:58:24 +04:00
|
|
|
|
1998-12-02 08:18:20 +03:00
|
|
|
#ifndef HAVE_X
|
1998-04-09 08:58:24 +04:00
|
|
|
#ifdef USE_TERMCAP
|
|
|
|
SLtt_Try_Termcap = 1;
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
1998-12-02 08:18:20 +03:00
|
|
|
#endif
|
1998-12-22 02:30:53 +03:00
|
|
|
|
|
|
|
#ifndef HAVE_GNOME
|
1998-12-03 02:44:06 +03:00
|
|
|
while ((c = poptGetNextOpt (ctx)) > 0){
|
|
|
|
option_arg = poptGetOptArg (ctx);
|
1998-04-09 08:58:24 +04:00
|
|
|
|
1998-05-19 12:58:41 +04:00
|
|
|
process_args (c, option_arg);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (c < -1){
|
1998-05-20 06:19:17 +04:00
|
|
|
print_mc_usage ();
|
1998-02-27 07:54:42 +03:00
|
|
|
fprintf(stderr, "%s: %s\n",
|
1998-12-03 02:44:06 +03:00
|
|
|
poptBadOption (ctx, POPT_BADOPTION_NOALIAS),
|
|
|
|
poptStrerror (c));
|
1998-02-27 07:54:42 +03:00
|
|
|
finish_program = 1;
|
|
|
|
}
|
1998-12-22 02:30:53 +03:00
|
|
|
#endif
|
1998-04-09 08:58:24 +04:00
|
|
|
probably_finish_program ();
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-12-03 02:44:06 +03:00
|
|
|
/*
|
|
|
|
* Check for special invocation names mcedit and mcview,
|
1998-02-27 07:54:42 +03:00
|
|
|
* if none apply then set the current directory and the other
|
|
|
|
* directory from the command line arguments
|
|
|
|
*/
|
1998-12-03 02:44:06 +03:00
|
|
|
tmp = poptGetArg (ctx);
|
1998-05-13 12:29:55 +04:00
|
|
|
base = x_basename (argv[0]);
|
|
|
|
if (!STRNCOMP (base, "mce", 3) || !STRCOMP(base, "vi")) {
|
1998-02-27 07:54:42 +03:00
|
|
|
edit_one_file = "";
|
|
|
|
if (tmp)
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
edit_one_file = g_strdup (tmp);
|
1998-03-23 08:27:15 +03:00
|
|
|
} else
|
1998-05-13 12:29:55 +04:00
|
|
|
if (!STRNCOMP (base, "mcv", 3) || !STRCOMP(base, "view")) {
|
1998-03-23 08:27:15 +03:00
|
|
|
if (tmp)
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
view_one_file = g_strdup (tmp);
|
1998-02-27 07:54:42 +03:00
|
|
|
} else {
|
|
|
|
/* sets the current dir and the other dir */
|
|
|
|
if (tmp) {
|
|
|
|
char buffer[MC_MAXPATHLEN + 2];
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
this_dir = g_strdup (tmp);
|
1998-02-27 07:54:42 +03:00
|
|
|
mc_get_current_wd (buffer, sizeof (buffer) - 2);
|
1998-12-03 02:44:06 +03:00
|
|
|
if ((tmp = poptGetArg (ctx)))
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
other_dir = g_strdup (tmp);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
}
|
1998-11-04 02:34:54 +03:00
|
|
|
|
1998-12-03 02:44:06 +03:00
|
|
|
poptFreeContext (ctx);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The compatibility_move_mc_files routine is intended to
|
|
|
|
* move all of the hidden .mc files into a private ~/.mc
|
|
|
|
* directory in the home directory, to avoid cluttering the users.
|
|
|
|
*
|
|
|
|
* Previous versions of the program had all of their files in
|
|
|
|
* the $HOME, we are now putting them in $HOME/.mc
|
|
|
|
*/
|
|
|
|
#ifdef OS2_NT
|
|
|
|
# define compatibility_move_mc_files()
|
|
|
|
#else
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
static int
|
1998-02-27 07:54:42 +03:00
|
|
|
do_mc_filename_rename (char *mc_dir, char *o_name, char *n_name)
|
|
|
|
{
|
|
|
|
char *full_o_name = concat_dir_and_file (home_dir, o_name);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
char *full_n_name = g_strconcat (home_dir, MC_BASE, n_name, NULL);
|
1998-02-27 07:54:42 +03:00
|
|
|
int move;
|
|
|
|
|
|
|
|
move = 0 == rename (full_o_name, full_n_name);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (full_o_name);
|
|
|
|
g_free (full_n_name);
|
1998-02-27 07:54:42 +03:00
|
|
|
return move;
|
|
|
|
}
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
static void
|
1998-02-27 07:54:42 +03:00
|
|
|
do_compatibility_move (char *mc_dir)
|
|
|
|
{
|
|
|
|
struct stat s;
|
|
|
|
int move;
|
|
|
|
|
|
|
|
if (stat (mc_dir, &s) == 0)
|
|
|
|
return;
|
|
|
|
if (errno != ENOENT)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (mkdir (mc_dir, 0777) == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
move = do_mc_filename_rename (mc_dir, ".mc.ini", "ini");
|
|
|
|
move += do_mc_filename_rename (mc_dir, ".mc.hot", "hotlist");
|
|
|
|
move += do_mc_filename_rename (mc_dir, ".mc.ext", "ext");
|
|
|
|
move += do_mc_filename_rename (mc_dir, ".mc.menu", "menu");
|
|
|
|
move += do_mc_filename_rename (mc_dir, ".mc.bashrc", "bashrc");
|
|
|
|
move += do_mc_filename_rename (mc_dir, ".mc.inputrc", "inputrc");
|
|
|
|
move += do_mc_filename_rename (mc_dir, ".mc.tcshrc", "tcshrc");
|
|
|
|
move += do_mc_filename_rename (mc_dir, ".mc.tree", "tree");
|
|
|
|
|
|
|
|
if (!move)
|
|
|
|
return;
|
|
|
|
|
|
|
|
show_change_notice = 1;
|
|
|
|
}
|
|
|
|
|
1998-12-03 00:27:27 +03:00
|
|
|
static void
|
1998-02-27 07:54:42 +03:00
|
|
|
compatibility_move_mc_files (void)
|
|
|
|
{
|
|
|
|
char *mc_dir = concat_dir_and_file (home_dir, ".mc");
|
|
|
|
|
|
|
|
do_compatibility_move (mc_dir);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (mc_dir);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-01-12 08:55:12 +03:00
|
|
|
void
|
1999-01-14 04:10:32 +03:00
|
|
|
mc_tree_store_load (void)
|
1999-01-12 08:55:12 +03:00
|
|
|
{
|
|
|
|
char *tree_file;
|
|
|
|
|
|
|
|
tree_file = concat_dir_and_file (home_dir, MC_TREE);
|
|
|
|
tree_store_init ();
|
|
|
|
tree_store_load (tree_file);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (tree_file);
|
1999-01-12 08:55:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-01-14 04:10:32 +03:00
|
|
|
mc_tree_store_save (void)
|
1999-01-12 08:55:12 +03:00
|
|
|
{
|
|
|
|
char *tree_file;
|
|
|
|
|
|
|
|
tree_file = concat_dir_and_file (home_dir, MC_TREE);
|
|
|
|
tree_store_save (tree_file);
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (tree_file);
|
1999-01-12 08:55:12 +03:00
|
|
|
}
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
1998-03-25 08:16:00 +03:00
|
|
|
/* We had LC_CTYPE before, LC_ALL includs LC_TYPE as well */
|
|
|
|
setlocale (LC_ALL, "");
|
|
|
|
bindtextdomain ("mc", LOCALEDIR);
|
|
|
|
textdomain ("mc");
|
1999-03-30 10:09:56 +04:00
|
|
|
#if 0
|
|
|
|
/* This is here to debug startup stuff */
|
1998-12-30 05:51:01 +03:00
|
|
|
{
|
1999-03-30 10:09:56 +04:00
|
|
|
volatile int i = 0;
|
1998-12-30 05:51:01 +03:00
|
|
|
|
1999-03-30 10:09:56 +04:00
|
|
|
printf ("GMC IS WAITING %d\n", getpid ());
|
1998-12-30 05:51:01 +03:00
|
|
|
while (!i)
|
|
|
|
;
|
|
|
|
|
|
|
|
}
|
1999-03-30 10:09:56 +04:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Initialize list of all user group for timur_clr_mode */
|
|
|
|
init_groups ();
|
1998-03-25 08:16:00 +03:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
OS_Setup ();
|
|
|
|
|
1998-12-31 06:38:48 +03:00
|
|
|
/* This variable is used by the subshell */
|
|
|
|
home_dir = getenv ("HOME");
|
|
|
|
if (!home_dir) {
|
|
|
|
/* mc_home was computed by OS_Setup */
|
|
|
|
home_dir = mc_home;
|
|
|
|
}
|
|
|
|
|
1998-08-27 00:23:10 +04:00
|
|
|
vfs_init ();
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef HAVE_X
|
|
|
|
/* NOTE: This call has to be before any our argument handling :) */
|
1998-04-09 08:58:24 +04:00
|
|
|
|
|
|
|
#ifdef HAVE_GNOME
|
|
|
|
{
|
|
|
|
char *base = x_basename (argv [0]);
|
|
|
|
|
|
|
|
if (base){
|
|
|
|
if (strcmp (base, "mcedit") == 0)
|
|
|
|
edit_one_file = "";
|
|
|
|
|
|
|
|
if (strcmp (base, "mcview") == 0)
|
|
|
|
view_one_file = "";
|
|
|
|
}
|
|
|
|
}
|
1998-11-04 02:34:54 +03:00
|
|
|
|
|
|
|
handle_args(argc, argv);
|
|
|
|
|
1999-01-12 08:55:12 +03:00
|
|
|
mc_tree_store_load ();
|
|
|
|
|
1999-03-30 10:09:56 +04:00
|
|
|
session_init ();
|
1998-04-09 08:58:24 +04:00
|
|
|
probably_finish_program ();
|
|
|
|
#endif
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
if (xtoolkit_init (&argc, argv) == -1)
|
|
|
|
exit (1);
|
1998-04-09 08:58:24 +04:00
|
|
|
#endif /* HAVE_X */
|
|
|
|
|
1998-12-02 08:18:20 +03:00
|
|
|
|
|
|
|
#ifndef HAVE_X
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef HAVE_SLANG
|
|
|
|
SLtt_Ignore_Beep = 1;
|
|
|
|
#endif
|
1998-12-02 08:18:20 +03:00
|
|
|
#endif
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* NOTE: This has to be called before slang_init or whatever routine
|
|
|
|
calls any define_sequence */
|
|
|
|
init_key ();
|
|
|
|
|
1998-11-10 06:00:25 +03:00
|
|
|
#ifndef HAVE_GNOME
|
1998-04-09 08:58:24 +04:00
|
|
|
handle_args (argc, argv);
|
|
|
|
#endif
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Used to report the last working directory at program end */
|
|
|
|
if (print_last_wd){
|
|
|
|
#ifndef OS2_NT
|
|
|
|
stdout_fd = dup (1);
|
|
|
|
close (1);
|
|
|
|
if (open (ttyname (0), O_RDWR) < 0)
|
|
|
|
if (open ("/dev/tty", O_RDWR) < 0) {
|
|
|
|
/* Try if stderr is not redirected as the last chance */
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
char *p = g_strdup (ttyname (0));
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
if (!strcmp (p, ttyname (2)))
|
|
|
|
dup2 (2, 1);
|
|
|
|
else {
|
|
|
|
fprintf (stderr,
|
1998-03-25 08:16:00 +03:00
|
|
|
_("Couldn't open tty line. You have to run mc without the -P flag.\n"
|
|
|
|
"On some systems you may want to run # `which mc`\n"));
|
1998-02-27 07:54:42 +03:00
|
|
|
exit (1);
|
|
|
|
}
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (p);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
# ifdef HAVE_X
|
|
|
|
/* This is to avoid subshell trying to restard any child pid
|
|
|
|
* that happends to have cons_saver_pid (a random startup value).
|
|
|
|
* and PID 1 is init, unlikely we could be the parent of it.
|
|
|
|
*/
|
|
|
|
/* cons_saver_pid = 1; */
|
|
|
|
# else
|
|
|
|
/* Must be done before installing the SIGCHLD handler [[FIXME]] */
|
|
|
|
handle_console (CONSOLE_INIT);
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
subshell_get_console_attributes ();
|
|
|
|
# endif
|
|
|
|
|
|
|
|
/* Install the SIGCHLD handler; must be done before init_subshell() */
|
|
|
|
init_sigchld ();
|
|
|
|
|
|
|
|
compatibility_move_mc_files ();
|
|
|
|
|
|
|
|
# ifdef HAVE_X
|
|
|
|
/* We need this, since ncurses endwin () doesn't restore the signals */
|
|
|
|
save_stop_handler ();
|
|
|
|
# endif
|
|
|
|
|
|
|
|
/* Must be done before init_subshell, to set up the terminal size: */
|
|
|
|
/* FIXME: Should be removed and LINES and COLS computed on subshell */
|
|
|
|
slang_init ();
|
|
|
|
/* NOTE: This call has to be after slang_init. It's the small part from
|
|
|
|
the previous init_key which had to be moved after the call of slang_init */
|
|
|
|
init_key_input_fd ();
|
|
|
|
|
|
|
|
load_setup ();
|
|
|
|
|
1998-03-07 03:05:06 +03:00
|
|
|
#ifdef HAVE_GNOME
|
|
|
|
init_colors ();
|
|
|
|
#else
|
1998-02-27 07:54:42 +03:00
|
|
|
init_curses ();
|
|
|
|
#endif
|
1998-03-13 06:44:54 +03:00
|
|
|
|
|
|
|
#ifdef HAVE_GNOME
|
|
|
|
use_subshell = 0;
|
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
# ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
/* Done here to ensure that the subshell doesn't */
|
|
|
|
/* inherit the file descriptors opened below, etc */
|
|
|
|
|
|
|
|
if (use_subshell)
|
|
|
|
init_subshell ();
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef HAVE_X
|
|
|
|
/* Removing this from the X code let's us type C-c */
|
|
|
|
load_key_defs ();
|
|
|
|
|
|
|
|
/* Also done after init_subshell, to save any shell init file messages */
|
|
|
|
if (console_flag)
|
|
|
|
handle_console (CONSOLE_SAVE);
|
1998-04-01 02:36:24 +04:00
|
|
|
|
|
|
|
if (alternate_plus_minus)
|
|
|
|
application_keypad_mode ();
|
1998-02-27 07:54:42 +03:00
|
|
|
# endif
|
1999-03-30 10:09:56 +04:00
|
|
|
|
1999-03-17 22:21:16 +03:00
|
|
|
#ifdef HAVE_GNOME
|
1999-03-30 10:09:56 +04:00
|
|
|
gnome_check_super_user ();
|
1999-03-17 22:21:16 +03:00
|
|
|
#endif
|
1999-03-30 10:09:56 +04:00
|
|
|
|
1998-03-18 00:29:22 +03:00
|
|
|
if (show_change_notice){
|
1998-03-25 08:16:00 +03:00
|
|
|
message (1, _(" Notice "),
|
|
|
|
_(" The Midnight Commander configuration files \n"
|
|
|
|
" are now stored in the ~/.mc directory, the \n"
|
|
|
|
" files have been moved now\n"));
|
1998-03-18 00:29:22 +03:00
|
|
|
}
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
# ifdef HAVE_SUBSHELL_SUPPORT
|
|
|
|
if (use_subshell){
|
|
|
|
prompt = strip_ctrl_codes (subshell_prompt);
|
|
|
|
if (!prompt)
|
|
|
|
prompt = "";
|
|
|
|
} else
|
|
|
|
# endif
|
|
|
|
prompt = (geteuid () == 0) ? "# " : "$ ";
|
|
|
|
|
|
|
|
/* Program main loop */
|
|
|
|
do_nc ();
|
1999-04-06 07:49:34 +04:00
|
|
|
|
|
|
|
/* Save the tree store */
|
|
|
|
mc_tree_store_save ();
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
/* Virtual File System shutdown */
|
|
|
|
vfs_shut ();
|
|
|
|
|
|
|
|
/* Delete list of all user groups*/
|
|
|
|
delete_groups ();
|
|
|
|
|
|
|
|
flush_extension_file (); /* does only free memory */
|
|
|
|
|
|
|
|
# ifndef HAVE_X
|
|
|
|
/* Miguel, maybe the fix in slang is not required and
|
|
|
|
* it could be done by removing the slang_done_screen.
|
|
|
|
* Do I need to call slang_reset_tty then?
|
|
|
|
*/
|
|
|
|
endwin ();
|
|
|
|
slang_shutdown ();
|
|
|
|
|
|
|
|
if (console_flag && !(quit & SUBSHELL_EXIT))
|
|
|
|
restore_console ();
|
1998-04-01 02:36:24 +04:00
|
|
|
if (alternate_plus_minus)
|
|
|
|
numeric_keypad_mode ();
|
1998-02-27 07:54:42 +03:00
|
|
|
# endif
|
|
|
|
|
|
|
|
#ifndef OS2_NT
|
|
|
|
signal (SIGCHLD, SIG_DFL); /* Disable the SIGCHLD handler */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
# ifndef HAVE_X
|
|
|
|
if (console_flag)
|
|
|
|
handle_console (CONSOLE_DONE);
|
|
|
|
putchar ('\r'); /* Hack to make shell's prompt start at left of screen */
|
|
|
|
# endif
|
|
|
|
|
|
|
|
#ifdef _OS_NT
|
|
|
|
/* On NT, home_dir is malloced */
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (home_dir);
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
#if defined(OS2_NT)
|
|
|
|
if (print_last_wd == 2){
|
|
|
|
FILE *bat_file;
|
|
|
|
|
|
|
|
print_last_wd = 0;
|
|
|
|
bat_file = fopen(batch_file_name, "w");
|
|
|
|
if (bat_file != NULL){
|
|
|
|
/* .ado: \r\n for Win95 */
|
|
|
|
fprintf(bat_file, "@echo off\r\n");
|
|
|
|
if (isalpha(last_wd_string[0]))
|
|
|
|
fprintf(bat_file, "%c:\r\n", last_wd_string[0]);
|
|
|
|
fprintf(bat_file, "cd %s\r\n", last_wd_string);
|
|
|
|
fclose(bat_file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (print_last_wd) {
|
|
|
|
if (print_last_revert || edit_one_file || view_one_file)
|
|
|
|
write (stdout_fd, ".", 1);
|
|
|
|
else
|
|
|
|
write (stdout_fd, last_wd_string, strlen (last_wd_string));
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
g_free (last_wd_string);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_MAD
|
|
|
|
done_key ();
|
|
|
|
#endif
|
|
|
|
mad_finalize (__FILE__, __LINE__);
|
|
|
|
#ifdef HAVE_X
|
|
|
|
xtoolkit_end ();
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|