/* 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
#include "popt.h"
-/* "$Id: main.c,v 1.1 2001/12/30 09:55:24 sedwards Exp $" */
+/* "$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 */
/* 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
+/* 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;
try_to_select (panel, panel->lwd);
else
#ifdef USE_VFS
- if ((!strncmp (panel->lwd, "tar:", 4) &&
+ if ((!strncmp (panel->lwd, "tar:", 4) &&
!strncmp (panel->lwd + 4, panel->cwd, strlen (panel->cwd))) ||
- ((i = extfs_prefix_to_type (panel->lwd)) != -1 &&
- !strncmp (panel->lwd + (j = strlen (extfs_get_prefix (i)) + 1),
+ ((i = extfs_prefix_to_type (panel->lwd)) != -1 &&
+ !strncmp (panel->lwd + (j = strlen (extfs_get_prefix (i)) + 1),
panel->cwd, strlen (panel->cwd)))) {
p = strdup (panel->lwd + j + strlen (panel->cwd));
q = strchr (p, PATH_SEP);
{
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) {
+ 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").
ftpfs_flushdir ();
bzero (&(panel->dir_stat), sizeof (panel->dir_stat));
}
-
+
/* If current_file == -1 (an invalid pointer) then preserve selection */
if (current_file == UP_KEEPSEL){
free_pointer = 1;
current_file = strdup (panel->dir.list [panel->selected].fname);
} else
free_pointer = 0;
-
+
if (panel->is_panelized)
reload_panelized (panel);
else
{
if (i >= panel->count)
return;
-
+
unselect_item (panel);
panel->selected = i;
-#ifndef HAVE_X
+#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);
}
int i;
FILE *file;
struct stat s;
-
+
if ((file = fopen (control_file, "r")) == NULL){
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){
#endif
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
-
+
parse_control_file ();
#ifndef __os2__
unlink (control_file);
}
panel->dir_history = panel->dir_history->next;
panel->dir_history->text = strdup (s);
-
+
panel_update_marks (panel);
}
{
char *directory, *olddir;
char temp [MC_MAXPATHLEN];
-#ifdef USE_VFS
+#ifdef USE_VFS
vfs *oldvfs;
vfsid oldvfsid;
struct vfs_stamping *parent;
-#endif
+#endif
olddir = strdup (panel->cwd);
/* 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;
/* 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
do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type)
{
int r;
-
+
r = _do_panel_cd (panel, new_dir, cd_type);
if (r)
directory_history_add (cpanel, cpanel->cwd);
{
if (!read_subshell_prompt (QUIETLY))
return 0;
-
+
if (command_prompt){
int prompt_len;
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
+ /* 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
*/
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;
-
+
current_file = strdup (cpanel->dir.list [cpanel->selected].fname);
panel_reload (cpanel);
try_to_select (cpanel, current_file);
/* The directory is already sorted, we have to load the unsorted stuff */
if (sort_order == (sortfn *) unsorted){
char *current_file;
-
+
current_file = strdup (cpanel->dir.list [cpanel->selected].fname);
panel_reload (cpanel);
try_to_select (cpanel, current_file);
/* NOTICE: hotkeys specified here are overriden in menubar_paint_idx (alex) */
static menu_entry PanelMenu [] = {
{ ' ', N_("&Listing mode..."), 'L', listing_cmd },
- { ' ', N_("&Quick view C-x q"), 'Q', quick_view_cmd },
+ { ' ', N_("&Quick view C-x q"), 'Q', quick_view_cmd },
{ ' ', N_("&Info C-x i"), 'I', info_cmd },
{ ' ', N_("&Tree"), 'T', tree_cmd },
- { ' ', "", ' ', 0 },
+ { ' ', "", ' ', 0 },
{ ' ', N_("&Sort order..."), 'S', sort_cmd },
- { ' ', "", ' ', 0 },
+ { ' ', "", ' ', 0 },
{ ' ', N_("&Filter..."), 'F', filter_cmd },
-#ifdef USE_NETCODE
- { ' ', "", ' ', 0 },
+#ifdef USE_NETCODE
+ { ' ', "", ' ', 0 },
{ ' ', N_("&Network link..."), 'N', netlink_cmd },
{ ' ', N_("FT&P link..."), 'P', ftplink_cmd },
#endif
static menu_entry RightMenu [] = {
{ ' ', N_("&Listing mode..."), 'L', listing_cmd },
- { ' ', N_("&Quick view C-x q"), 'Q', quick_view_cmd },
+ { ' ', N_("&Quick view C-x q"), 'Q', quick_view_cmd },
{ ' ', N_("&Info C-x i"), 'I', info_cmd },
{ ' ', N_("&Tree"), 'T', tree_cmd },
- { ' ', "", ' ', 0 },
+ { ' ', "", ' ', 0 },
{ ' ', N_("&Sort order..."), 'S', sort_cmd },
- { ' ', "", ' ', 0 },
+ { ' ', "", ' ', 0 },
{ ' ', N_("&Filter..."), 'F', filter_cmd },
-#ifdef USE_NETCODE
- { ' ', "", ' ', 0 },
+#ifdef USE_NETCODE
+ { ' ', "", ' ', 0 },
{ ' ', N_("&Network link..."), 'N', netlink_cmd },
{ ' ', N_("FT&P link..."), 'P', ftplink_cmd },
#endif
{ ' ', N_("&Edit F4"), 'E', edit_cmd },
{ ' ', N_("&Copy F5"), 'C', copy_cmd },
{ ' ', N_("c&Hmod C-x c"), 'H', chmod_cmd },
-#ifndef OS2_NT
+#ifndef OS2_NT
{ ' ', 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 },
-#endif
+#endif
{ ' ', N_("&Rename/Move F6"), 'R', ren_cmd },
{ ' ', N_("&Mkdir F7"), 'M', mkdir_cmd },
{ ' ', N_("&Delete F8"), 'D', delete_cmd },
*/
{ ' ', N_("&Directory tree"), 'D', tree_box },
{ ' ', N_("&Find file M-?"), 'F', find_cmd },
-#ifndef HAVE_XVIEW
+#ifndef HAVE_XVIEW
{ ' ', N_("s&Wap panels C-u"), 'W', swap_cmd },
{ ' ', N_("switch &Panels on/off C-o"), 'P', view_other_cmd },
-#endif
+#endif
{ ' ', N_("&Compare directories C-x d"), 'C', compare_dirs_cmd },
{ ' ', N_("e&Xternal panelize C-x !"), 'X', external_panelize },
#ifdef HAVE_DUSUM
#if !defined(HAVE_X) && !defined(OS2_NT)
{ ' ', N_("learn &Keys..."), 'K', learn_keys },
#endif
-#ifdef USE_VFS
+#ifdef USE_VFS
{ ' ', N_("&Virtual FS..."), 'V', configure_vfs },
#endif
- { ' ', "", ' ', 0 },
+ { ' ', "", ' ', 0 },
{ ' ', N_("&Save setup"), 'S', save_setup_cmd }
};
{
int i;
-#ifdef HAVE_X
+#ifdef HAVE_X
MenuBar [0] = create_menu (_(" Left "), PanelMenu, menu_entries (PanelMenu));
#else
- MenuBar [0] = create_menu ( horizontal_split ? _(" Above ") : _(" Left "),
+ MenuBar [0] = create_menu ( horizontal_split ? _(" Above ") : _(" Left "),
PanelMenu, menu_entries (PanelMenu));
#endif
MenuBar [1] = create_menu (_(" File "), FileMenu, menu_entries (FileMenu));
#ifdef HAVE_X
MenuBar [4] = create_menu (_(" Right "), RightMenu, menu_entries (PanelMenu));
#else
- MenuBar [4] = create_menu (horizontal_split ? _(" Below ") : _(" Right "),
+ MenuBar [4] = create_menu (horizontal_split ? _(" Below ") : _(" Right "),
RightMenu, menu_entries (PanelMenu));
for (i = 0; i < 5; i++)
MenuBarEmpty [i] = create_menu (MenuBar [i]->name, 0, 0);
}
}
#endif
-
+
static void
menu_last_selected_cmd (void)
{
{
if (the_menubar->active)
return;
-
+
if (get_current_index () == 0)
the_menubar->selected = 0;
else
char original_dir [1024];
original_dir [0] = 0;
-
+
if (boot_current_is_left){
current_index = 0;
other_index = 1;
the_hint->auto_adjust_cols = 0;
the_hint->widget.cols = COLS;
#endif
-
+
#ifndef HAVE_XVIEW
the_menubar = menubar_new (0, 0, COLS, MenuBar, 5);
#else
char buffer [MC_MAXPATHLEN];
char *p = concat_dir_and_file (panel->cwd, selection (panel)->fname);
int i;
-
+
i = mc_readlink (p, buffer, MC_MAXPATHLEN);
free (p);
if (i > 0) {
tmp = name_quote (selection (cpanel)->fname, 1);
stuff (input_w (cmdline), tmp, 1);
free (tmp);
-}
+}
static void copy_tagged (WPanel *panel)
{
}
input_enable_update (input_w (cmdline));
}
-
+
static void copy_current_tagged (void)
{
copy_tagged (cpanel);
#ifndef OS2_NT
{
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 ();
}
{ 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 */
#endif
/* 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 },
{
#ifndef OS2_NT
struct sigaction act, oact;
-
+
# if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4
# ifdef SIGWINCH
act.sa_handler = flag_winch;
setup_post ()
{
setup_sigwinch ();
-
+
init_uid_gid_cache ();
#ifndef HAVE_X
return;
#endif
setup_panels ();
-
+
#ifdef HAVE_SUBSHELL_SUPPORT
if (use_subshell)
add_select_channel (subshell_pty, load_prompt, 0);
#endif
-
+
setup_post ();
}
static void done_mc ()
{
done_menu ();
-
+
/* Setup shutdown
*
* We sync the profiles since the hotlist may have changed, while
{
if (cpanel->dirty)
panel_update_contents (cpanel);
-
+
if ((get_other_type () == view_listing) && opanel->dirty)
panel_update_contents (opanel);
}
int midnight_callback (struct Dlg_head *h, int id, int msg)
{
int i;
-
+
switch (msg){
#ifndef HAVE_XVIEW
case DLG_PRE_EVENT:
make_panels_dirty ();
return MSG_HANDLED;
-
+
case DLG_KEY:
if (ctl_x_map_enabled){
ctl_x_map_enabled = 0;
return MSG_HANDLED;
}
}
-
+
if (id == KEY_F(10) && !the_menubar->active){
quit_cmd ();
return MSG_HANDLED;
return MSG_HANDLED;
}
} else if (command_prompt && !strlen (input_w (cmdline)->buffer)) {
- /* Special treatement '+', '-', '\', '*' only when this is
+ /* Special treatement '+', '-', '\', '*' only when this is
* first char on input line
*/
-
+
if (id == '+') {
select_cmd ();
return MSG_HANDLED;
}
-
+
if (check_key_backslash (id) || id == '-') {
unselect_cmd ();
return MSG_HANDLED;
}
-
+
if (id == '*') {
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;
}
}
return MSG_NOT_HANDLED;
-
+
#endif
#ifndef HAVE_X
/* We handle the special case of the output lines */
LINES-keybar_visible-1);
break;
#endif
-
+
}
return default_dlg_callback (h, id, msg);
}
if (!the_hint->widget.parent)
return;
-
+
if (!message_visible && (!xterm_flag || !xterm_hintbar)){
label_set_text (the_hint, 0);
return;
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));
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 (mc_maybe_editor_or_viewer ())
return;
#endif
-
+
setup_mc ();
#ifndef HAVE_GNOME
setup_panels_and_run_mc ();
#endif
-
+
/* Program end */
midnight_shutdown = 1;
last_wd_string = strdup (cpanel->cwd);
}
done_mc ();
-
+
#ifndef HAVE_GNOME
destroy_dlg (midnight_dlg);
current_panel = 0;
fprintf (stderr, "The Midnight Commander %s\n", VERSION);
if (!verbose)
return;
-
+
#ifndef HAVE_X
fprintf (stderr,
_("with mouse support on xterm%s.\n"),
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) */
#ifndef __EMX__
_fmode = O_BINARY;
{
char *termvalue;
char *mc_libdir;
-
+
termvalue = getenv ("TERM");
if (!termvalue){
fprintf (stderr, _("The TERM environment variable is unset!\n"));
sprintf (control_file, CONTROL_FILE, getpid ());
my_putenv ("MC_CONTROL_FILE", control_file);
-
+
/* This is the directory, where MC was installed, on Unix this is LIBDIR */
/* and can be overriden by the MCHOME environment variable */
if ((mc_libdir = getenv ("MCHOME")) != NULL) {
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). */
#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 */
sa.sa_hanlder = mc_fatal_signal;
sa.sa_mask = 0;
sa.sa_flags = 0;
-
+
sigaction (SIGSEGV, &sa, NULL);
sigaction (SIGBUS, &sa, NULL);
sigaction (SIGFPE, &sa, NULL);
}
#else
-#define init_sigfatals()
+#define init_sigfatals()
#endif
void
#endif
sigaction (SIGCHLD, &sigchld_action, NULL);
-}
+}
#endif /* _OS_NT, __os2__, UNIX */
version (0);
fprintf (stderr,
"Usage is:\n\n"
- "mc [flags] [this_dir] [other_panel_dir]\n\n"
+ "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
#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"
version (1);
finish_program = 1;
break;
-
+
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;
-
+
case 'm':
fprintf (stderr, _("Option -m is obsolete. Please look at Display Bits... in the Option's menu\n"));
finish_program = 1;
break;
-
+
#ifdef USE_NETCODE
case 'l':
ftpfs_set_debug (option_arg);
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;
force_subshell_execution = 1;
#endif
break;
-
+
case 'H':
print_color_usage ();
finish_program = 1;
break;
-
+
case 'h':
#ifndef PORT_WANTS_ARGP
print_mc_usage ();
#endif
#if defined(HAVE_SLANG) && defined(OS2_NT)
{ "createcmdfile", 'S', "CMDFILE", , 0, N_("Create command file to set default directory upon exit."), 1 },
-#endif
+#endif
{ "color", 'c', NULL, 0, N_("Force color mode."), 0 },
{ "colors", 'C', "COLORS", 0, N_("Specify colors (use --help-colors to get a list)."), 1 },
#ifdef HAVE_SUBSHELL_SUPPORT
case 'b':
disable_colors = 1;
return 0;
-
+
case 'P':
print_last_wd = 1;
return 0;
-
+
case 'k':
reset_hp_softkeys = 1;
return 0;
case 'x':
force_xterm = 1;
return 0;
-
+
#if defined(HAVE_SLANG) && !defined(OS2_NT)
case 't':
SLtt_Try_Termcap = 1;
case NOWIN_KEY:
nowindows = 1;
-
+
case ARGP_KEY_ARG:
break;
case ARGP_KEY_INIT:
case ARGP_KEY_FINI:
return 0;
-
+
default:
process_args (key, arg);
}
edit_one_file = strdup (arg);
else if (view_one_file)
view_one_file = strdup (arg);
- else
+ else
directory_list = g_list_append (directory_list, arg);
}
return 0;
argp_options, parse_an_arg, N_("[this dir] [other dir]"), NULL, NULL, NULL, NULL
};
-#else
+#else
static struct poptOption argumentTable[] = {
#ifdef WITH_BACKGROUND
if (c < -1){
print_mc_usage ();
- fprintf(stderr, "%s: %s\n",
- poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
+ fprintf(stderr, "%s: %s\n",
+ poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
poptStrerror(c));
finish_program = 1;
}
char *full_o_name = concat_dir_and_file (home_dir, o_name);
char *full_n_name = copy_strings (home_dir, MC_BASE, n_name, NULL);
int move;
-
+
move = 0 == rename (full_o_name, full_n_name);
free (full_o_name);
free (full_n_name);
{
struct stat s;
int move;
-
+
if (stat (mc_dir, &s) == 0)
return;
if (errno != ENOENT)
return;
-
+
if (mkdir (mc_dir, 0777) == -1)
return;
compatibility_move_mc_files (void)
{
char *mc_dir = concat_dir_and_file (home_dir, ".mc");
-
+
do_compatibility_move (mc_dir);
free (mc_dir);
}
/* Initialize list of all user group for timur_clr_mode */
init_groups ();
-
+
OS_Setup ();
vfs_init ();
if (base){
if (strcmp (base, "mcedit") == 0)
edit_one_file = "";
-
+
if (strcmp (base, "mcview") == 0)
view_one_file = "";
}
gnome_init ("gmc", &mc_argp_parser, argc, argv, 0, NULL);
probably_finish_program ();
#endif
-
+
if (xtoolkit_init (&argc, argv) == -1)
exit (1);
#endif /* HAVE_X */
-
+
#ifdef HAVE_SLANG
SLtt_Ignore_Beep = 1;
#endif
#ifndef PORT_WANTS_ARGP
handle_args (argc, argv);
#endif
-
+
/* Used to report the last working directory at program end */
if (print_last_wd){
-#ifndef OS2_NT
+#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 */
char *p = strdup (ttyname (0));
-
+
if (!strcmp (p, ttyname (2)))
dup2 (2, 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 ();
init_sigfatals ();
-
+
/* This variable is used by the subshell */
home_dir = getenv ("HOME");
if (!home_dir) {
}
compatibility_move_mc_files ();
-
+
# ifdef HAVE_X
/* We need this, since ncurses endwin () doesn't restore the signals */
save_stop_handler ();
/* 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 */
+ the previous init_key which had to be moved after the call of slang_init */
init_key_input_fd ();
load_setup ();
#ifdef HAVE_GNOME
use_subshell = 0;
#endif
-
+
# 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 ();
+ init_subshell ();
# endif
# ifndef HAVE_X
/* Also done after init_subshell, to save any shell init file messages */
if (console_flag)
handle_console (CONSOLE_SAVE);
-
+
if (alternate_plus_minus)
application_keypad_mode ();
# endif
" are now stored in the ~/.mc directory, the \n"
" files have been moved now\n"));
}
-
+
# ifdef HAVE_SUBSHELL_SUPPORT
if (use_subshell){
prompt = strip_ctrl_codes (subshell_prompt);
/* Program main loop */
do_nc ();
-
+
/* Virtual File System shutdown */
vfs_shut ();
#ifndef OS2_NT
signal (SIGCHLD, SIG_DFL); /* Disable the SIGCHLD handler */
#endif
-
+
# ifndef HAVE_X
if (console_flag)
handle_console (CONSOLE_DONE);