The following commit has been merged in the master branch: commit 5f77615b35a09d8cb1941b0d37f5cf24d4b7dbc5 Merge: b407c65b74060df2bf16337ac3f2768d715f1bba 54d6ec88dcb9648d77ae84d063fdaedb76233b39 Author: Enrico Weigelt, metux IT service <weig...@metux.de> Date: Sat Jan 31 18:20:54 2009 +0100
Merge commit 'origin/mc-4.6' diff --combined ChangeLog index 9dca9f9,9afbd3d..3d714e5 --- a/ChangeLog +++ b/ChangeLog @@@ -1,3 -1,6 +1,6 @@@ + 2009-01-31 Enrico Weigelt, metux ITS <weig...@metux.de> + + * replaced buggy concat_dir_and_file() by mhl_str_dir_plus_file() (in mhl/string.h) 2009-01-30 Enrico Weigelt, metux ITS <weig...@metux.de> @@@ -34,10 -37,6 +37,10 @@@ * mhl/string.h, vfs/fish.c, vfs/utilvfs.c, vfs/utilvfs.h: Reworked fish code so that symlinks and files which special characters works now +2009-01-25 Mikhail S. Pobolovets <styx...@gmail.com> + * src/cmd.c src/option.c src/setup.c src/main.h: Automatic new directory(Mkdir, F7) + name filling. Can be configured (on|off) in 'Configure options' + 2009-01-25 Enrico Weigelt <weig...@metux.de> * edit/editcmd.c, src/cmd.c, src/ext.c, src/history.h: @@@ -57,19 -56,10 +60,19 @@@ - prevent . to match a newline (\n) - match from start of line and not from cursor position +2009-01-24 Enrico Weigelt, metux IT service <weig...@metux.de> + + * syntax/Syntax, syntax/nemerle.syntax: Added syntax rules + for Nemerle source files + +2009-01-19 Patrick Winnertz <win...@debian.org> + + * edit/edit.h: Add two more ints + * src/setup.c: Add keybinding to disable tab highlighting + 2009-01-18 Patrick Winnertz <win...@debian.org> - * edit/editdraw.c: Moved var into if clause as it's only used - there + * edit/editdraw.c: Moved var into if clause as it's only used there * edit/editlock.c: Removed unnecessary arguement to if condition * src/cmd.c: Removed unused pointer * src/hotlist.c: Removed unused function save_group @@@ -107,29 -97,7 +110,29 @@@ 2009-01-11 Patrick Winnertz <win...@debian.org> * syntax/pascal.syntax: Added syntax highlighting for - some delphi keywords + some delphi keywords + +2009-01-10 Enrico Weigelt, metux ITS <weig...@metux.de> + + * syntax/Makefile.am syntax/Syntax syntax/haskell.syntax: + added syntax definition for Haskell (taken from rhclub-tree) + * syntax: added ebuild Syntax defition (taken from rhclub-tree) + +2009-01-10 Enrico Weigelt, metux ITS <weig...@metux.de> + + * edit/editcmd.c: + * src/achown.c src/background.c src/boxes.c src/chmod.c: + * src/chown.c src/cmd.c src/command.c src/dir.c src/execute.c: + * src/ext.c src/file.c src/filegui.c src/find.c src/help.c: + * src/learn.c src/main.c src/panelize.c src/screen.c: + * src/selcodepage.c src/subshell.c src/tree.c src/user.c: + * src/utilunix.c src/view.c: + * vfs/cpio.c vfs/direntry.c vfs/extfs.c vfs/fish.c vfs/ftpfs.c: + * vfs/mcfs.c vfs/sfs.c vfs/smbfs.c vfs/tar.c vfs/undelfs.c: + * vfs/utilvfs.c vfs/vfs.c: + + Changed message type codes on calls to message(), query_dialog(), + close_error_pipe() from numeric IDs to symbols D_ERROR, D_NORMAL 2008-12-18 Roland Illig <roland.il...@gmx.de> @@@ -307,7 -275,7 +310,7 @@@ * doc/mc.1.in: Document `fish_directory_timeout'. -2006-02-18 David Martin <<dmart...@excite.com> +2006-02-18 David Martin <dmart...@excite.com> * doc/es/mc.1.in: Cleanup. Fix key naming. diff --combined edit/editcmd.c index 46ae06b,5b5c7e7..9910f5c --- a/edit/editcmd.c +++ b/edit/editcmd.c @@@ -28,7 -28,6 +28,6 @@@ #include <assert.h> #include <ctype.h> - #include <stdio.h> #include <stdarg.h> #include <sys/types.h> @@@ -36,9 -35,10 +35,10 @@@ #include <string.h> #include <errno.h> #include <sys/stat.h> - #include <stdlib.h> + #include <mhl/string.h> + #include "../src/global.h" #include "../src/history.h" @@@ -235,7 -235,7 +235,7 @@@ edit_save_file (WEdit *edit, const cha return 0; if (*filename != PATH_SEP && edit->dir) { - savename = concat_dir_and_file (edit->dir, filename); + savename = mhl_str_dir_plus_file (edit->dir, filename); filename = catstrs (savename, (char *) NULL); g_free (savename); } @@@ -301,7 -301,7 +301,7 @@@ savedir[slashpos - filename + 1] = '\0'; } else savedir = g_strdup ("."); - saveprefix = concat_dir_and_file (savedir, "cooledit"); + saveprefix = mhl_str_dir_plus_file (savedir, "cooledit"); g_free (savedir); fd = mc_mkstemps (&savename, saveprefix, NULL); g_free (saveprefix); @@@ -2052,7 -2052,7 +2052,7 @@@ edit_replace_cmd (WEdit *edit, int agai edit->force |= REDRAW_PAGE; edit_render_keypress (edit); if (times_replaced) { - message (0, msg, _(" %ld replacements made. "), + message (D_NORMAL, msg, _(" %ld replacements made. "), times_replaced); } else query_dialog (msg, _(" Search string not found "), @@@ -2131,7 -2131,7 +2131,7 @@@ void edit_search_cmd (WEdit * edit, in } if (found) { /* in response to number of bookmarks added because of string being found %d times */ - message (0, _("Search"), _(" %d items found, %d bookmarks added "), found, books); + message (D_NORMAL, _("Search"), _(" %d items found, %d bookmarks added "), found, books); } else { edit_error_dialog (_ ("Search"), _ (" Search string not found ")); } @@@ -2589,7 -2589,7 +2589,7 @@@ edit_block_process_cmd (WEdit *edit, co quoted_name, (char *) NULL)); } g_free (quoted_name); - close_error_pipe (0, 0); + close_error_pipe (D_NORMAL, NULL); edit_refresh_cmd (edit); edit->force |= REDRAW_COMPLETELY; diff --combined src/cmd.c index 84f6e07,f82165c..e222714 --- a/src/cmd.c +++ b/src/cmd.c @@@ -34,6 -34,8 +34,8 @@@ #endif #include <unistd.h> + #include <mhl/string.h> + #include "global.h" #include "cmd.h" /* Our definitions */ #include "fileopctx.h" /* file_op_context_new() */ @@@ -77,8 -79,6 +79,8 @@@ int output_starts_shell = 0 /* If set, use the builtin editor */ int use_internal_edit = 1; +/* Automatically fills name with current selected item name on mkdir */ +int auto_fill_mkdir_name = 1; int view_file_at_line (const char *filename, int plain_view, int internal, @@@ -192,13 -192,13 +194,13 @@@ do_view_cmd (int normal || link_isdir (selection (current_panel))) { if (confirm_view_dir && (current_panel->marked || current_panel->dirs_marked)) { if (query_dialog - (_(" Confirmation "), _("Files tagged, want to cd?"), 0, 2, + (_(" Confirmation "), _("Files tagged, want to cd?"), D_NORMAL, 2, _("&Yes"), _("&No")) != 0) { return; } } if (!do_cd (selection (current_panel)->fname, cd_exact)) - message (1, MSG_ERROR, _("Cannot change directory")); + message (D_ERROR, MSG_ERROR, _("Cannot change directory")); repaint_screen(); return; @@@ -353,25 -353,18 +355,25 @@@ voi mkdir_cmd (void) { char *dir, *absdir; + char *name = ""; + + /* If 'on' then automatically fills name with current selected item name */ + if (auto_fill_mkdir_name) + name = selection (current_panel)->fname; dir = input_expand_dialog (_("Create a new Directory"), - _(" Enter directory name:"), - MC_HISTORY_FM_MKDIR, ""); + _(" Enter directory name:"), + MC_HISTORY_FM_MKDIR, + name); + if (!dir) return; if (dir[0] == '/' || dir[0] == '~') absdir = g_strdup (dir); else - absdir = concat_dir_and_file (current_panel->cwd, dir); + absdir = mhl_str_dir_plus_file (current_panel->cwd, dir); save_cwds_stat (); if (my_mkdir (absdir, 0777) == 0) { @@@ -379,7 -372,7 +381,7 @@@ repaint_screen (); select_item (current_panel); } else { - message (1, MSG_ERROR, " %s ", unix_error_string (errno)); + message (D_ERROR, MSG_ERROR, " %s ", unix_error_string (errno)); } g_free (absdir); @@@ -522,7 -515,7 +524,7 @@@ select_unselect_cmd (const char *title c = regexp_match (reg_exp_t, current_panel->dir.list[i].fname, match_file); if (c == -1) { - message (1, MSG_ERROR, _(" Malformed regular expression ")); + message (D_ERROR, MSG_ERROR, _(" Malformed regular expression ")); g_free (reg_exp); return; } @@@ -574,13 -567,13 +576,13 @@@ void ext_cmd (void dir = 0; if (geteuid () == 0){ dir = query_dialog (_("Extension file edit"), - _(" Which extension file you want to edit? "), 0, 2, + _(" Which extension file you want to edit? "), D_NORMAL, 2, _("&User"), _("&System Wide")); } - extdir = concat_dir_and_file (mc_home, MC_LIB_EXT); + extdir = mhl_str_dir_plus_file (mc_home, MC_LIB_EXT); if (dir == 0){ - buffer = concat_dir_and_file (home_dir, MC_USER_EXT); + buffer = mhl_str_dir_plus_file (home_dir, MC_USER_EXT); check_for_default (extdir, buffer); do_edit (buffer); g_free (buffer); @@@ -603,11 -596,11 +605,11 @@@ menu_edit_cmd (int where dir = query_dialog ( _(" Menu edit "), _(" Which menu file do you want to edit? "), - 0, geteuid() ? 2 : 3, + D_NORMAL, geteuid() ? 2 : 3, _("&Local"), _("&User"), _("&System Wide") ); - menufile = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); + menufile = mhl_str_dir_plus_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); switch (dir) { case 0: @@@ -616,12 -609,12 +618,12 @@@ break; case 1: - buffer = concat_dir_and_file (home_dir, where ? CEDIT_HOME_MENU : MC_HOME_MENU); + buffer = mhl_str_dir_plus_file (home_dir, where ? CEDIT_HOME_MENU : MC_HOME_MENU); check_for_default (menufile, buffer); break; case 2: - buffer = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); + buffer = mhl_str_dir_plus_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); break; default: @@@ -647,7 -640,7 +649,7 @@@ void quick_chdir_cmd (void tree_chdir (the_tree, target); else if (!do_cd (target, cd_exact)) - message (1, MSG_ERROR, _("Cannot change directory") ); + message (D_ERROR, MSG_ERROR, _("Cannot change directory") ); g_free (target); } @@@ -677,13 -670,13 +679,13 @@@ edit_syntax_cmd (void if (geteuid () == 0) { dir = query_dialog (_("Syntax file edit"), - _(" Which syntax file you want to edit? "), 0, 2, + _(" Which syntax file you want to edit? "), D_NORMAL, 2, _("&User"), _("&System Wide")); } - extdir = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax"); + extdir = mhl_str_dir_plus_file (mc_home, "syntax" PATH_SEP_STR "Syntax"); if (dir == 0) { - buffer = concat_dir_and_file (home_dir, SYNTAX_FILE); + buffer = mhl_str_dir_plus_file (home_dir, SYNTAX_FILE); check_for_default (extdir, buffer); do_edit (buffer); g_free (buffer); @@@ -704,7 -697,7 +706,7 @@@ void reselect_vfs (void return; if (!do_cd (target, cd_exact)) - message (1, MSG_ERROR, _("Cannot change directory") ); + message (D_ERROR, MSG_ERROR, _("Cannot change directory") ); g_free (target); } #endif /* USE_VFS */ @@@ -814,8 -807,8 +816,8 @@@ compare_dir (WPanel *panel, WPanel *oth } /* Thorough compare on, do byte-by-byte comparison */ - src_name = concat_dir_and_file (panel->cwd, source->fname); - dst_name = concat_dir_and_file (other->cwd, target->fname); + src_name = mhl_str_dir_plus_file (panel->cwd, source->fname); + dst_name = mhl_str_dir_plus_file (other->cwd, target->fname); if (compare_files (src_name, dst_name, source->st.st_size)) do_file_mark (panel, i, 1); g_free (src_name); @@@ -832,8 -825,8 +834,8 @@@ compare_dirs_cmd (void choice = query_dialog (_(" Compare directories "), - _(" Select compare method: "), 0, 3, _("&Quick"), - _("&Size only"), _("&Thorough"), _("&Cancel")); + _(" Select compare method: "), 0, D_NORMAL, + _("&Quick"), _("&Size only"), _("&Thorough"), _("&Cancel")); if (choice < 0 || choice > 2) return; @@@ -845,7 -838,7 +847,7 @@@ compare_dir (current_panel, other_panel, thorough_flag); compare_dir (other_panel, current_panel, thorough_flag); } else { - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" Both panels should be in the " "listing mode to use this command ")); } @@@ -862,7 -855,7 +864,7 @@@ history_cmd (void cmdline->need_push = 0; } if (!cmdline->history) { - message (1, MSG_ERROR, _(" The command history is empty ")); + message (D_ERROR, MSG_ERROR, _(" The command history is empty ")); return; } current = g_list_first (cmdline->history); @@@ -901,7 -894,7 +903,7 @@@ view_other_cmd (void if (!xterm_flag && !console_flag && !use_subshell && !output_starts_shell) { if (message_flag) - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" Not an xterm or Linux console; \n" " the panels cannot be toggled. ")); message_flag = FALSE; @@@ -922,17 -915,17 +924,17 @@@ do_link (int symbolic_link, const char goto cleanup; save_cwds_stat (); if (-1 == mc_link (fname, dest)) - message (1, MSG_ERROR, _(" link: %s "), + message (D_ERROR, MSG_ERROR, _(" link: %s "), unix_error_string (errno)); } else { char *s; char *d; /* suggest the full path for symlink */ - s = concat_dir_and_file (current_panel->cwd, fname); + s = mhl_str_dir_plus_file (current_panel->cwd, fname); if (get_other_type () == view_listing) { - d = concat_dir_and_file (other_panel->cwd, fname); + d = mhl_str_dir_plus_file (other_panel->cwd, fname); } else { d = g_strdup (fname); } @@@ -945,7 -938,7 +947,7 @@@ goto cleanup; save_cwds_stat (); if (-1 == mc_symlink (dest, src)) - message (1, MSG_ERROR, _(" symlink: %s "), + message (D_ERROR, MSG_ERROR, _(" symlink: %s "), unix_error_string (errno)); } update_panels (UP_OPTIMIZE, UP_KEEPSEL); @@@ -991,11 -984,11 +993,11 @@@ void edit_symlink_cmd (void if (*dest && strcmp (buffer, dest)) { save_cwds_stat (); if (-1 == mc_unlink (p)){ - message (1, MSG_ERROR, _(" edit symlink, unable to remove %s: %s "), + message (D_ERROR, MSG_ERROR, _(" edit symlink, unable to remove %s: %s "), p, unix_error_string (errno)); } else { if (-1 == mc_symlink (dest, p)) - message (1, MSG_ERROR, _(" edit symlink: %s "), + message (D_ERROR, MSG_ERROR, _(" edit symlink: %s "), unix_error_string (errno)); } update_panels (UP_OPTIMIZE, UP_KEEPSEL); @@@ -1006,7 -999,7 +1008,7 @@@ } g_free (q); } else { - message (1, MSG_ERROR, _("`%s' is not a symbolic link"), + message (D_ERROR, MSG_ERROR, _("`%s' is not a symbolic link"), selection (current_panel)->fname); } } @@@ -1123,7 -1116,7 +1125,7 @@@ nice_cd (const char *text, const char * if (do_panel_cd (MENU_PANEL, cd_path, 0)) directory_history_add (MENU_PANEL, (MENU_PANEL)->cwd); else - message (1, MSG_ERROR, _(" Cannot chdir to %s "), cd_path); + message (D_ERROR, MSG_ERROR, _(" Cannot chdir to %s "), cd_path); g_free (cd_path); g_free (machine); } @@@ -1243,7 -1236,7 +1245,7 @@@ save_setup_cmd (void save_setup (); sync_profiles (); - message (0, _(" Setup "), _(" Setup saved to ~/%s"), PROFILE_NAME); + message (D_NORMAL, _(" Setup "), _(" Setup saved to ~/%s"), PROFILE_NAME); } static void diff --combined src/command.c index d118c03,ec11dcf..35fa5ec --- a/src/command.c +++ b/src/command.c @@@ -27,6 -27,8 +27,8 @@@ #include <errno.h> #include <string.h> + #include <mhl/string.h> + #include "global.h" /* home_dir */ #include "tty.h" #include "widget.h" /* WInput */ @@@ -124,7 -126,7 +126,7 @@@ examine_cd (char *path c = *s; *s = 0; if (*p) { - r = concat_dir_and_file (p, q); + r = mhl_str_dir_plus_file (p, q); result = do_cd (r, cd_parse_command); g_free (r); } @@@ -176,14 -178,14 +178,14 @@@ void do_cd_command (char *cmd } else { char *old = current_panel->cwd; char *new; - new = concat_dir_and_file (old, cmd+3); + new = mhl_str_dir_plus_file (old, cmd+3); sync_tree (new); g_free (new); } } else if (!examine_cd (&cmd [3])) { char *d = strip_password (g_strdup (&cmd [3]), 1); - message (1, MSG_ERROR, _(" Cannot chdir to \"%s\" \n %s "), + message (D_ERROR, MSG_ERROR, _(" Cannot chdir to \"%s\" \n %s "), d, unix_error_string (errno)); g_free (d); return; @@@ -215,7 -217,7 +217,7 @@@ enter (WInput *cmdline size_t i, j, cmd_len; if (!vfs_current_is_local ()) { - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _ (" Cannot execute commands on non-local filesystems")); @@@ -225,7 -227,7 +227,7 @@@ /* Check this early before we clean command line * (will be checked again by shell_execute) */ if (use_subshell && subshell_state != INACTIVE) { - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" The shell is already running a command ")); return MSG_NOT_HANDLED; } diff --combined src/ext.c index 14d888f,a0bee25..2699bd8 --- a/src/ext.c +++ b/src/ext.c @@@ -25,9 -25,10 +25,10 @@@ #include <errno.h> #include <stdio.h> #include <string.h> - #include <unistd.h> + #include <mhl/string.h> + #include "global.h" #include "tty.h" #include "user.h" @@@ -100,7 -101,7 +101,7 @@@ exec_extension (const char *filename, c cmd_file_fd = mc_mkstemps (&file_name, "mcext", SCRIPT_SUFFIX); if (cmd_file_fd == -1) { - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" Cannot create temporary command file \n %s "), unix_error_string (errno)); return; @@@ -440,11 -441,11 +441,11 @@@ regex_command (const char *filename, co int mc_user_ext = 1; int home_error = 0; - extension_file = concat_dir_and_file (home_dir, MC_USER_EXT); + extension_file = mhl_str_dir_plus_file (home_dir, MC_USER_EXT); if (!exist_file (extension_file)) { g_free (extension_file); check_stock_mc_ext: - extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT); + extension_file = mhl_str_dir_plus_file (mc_home, MC_LIB_EXT); mc_user_ext = 0; } data = load_file (extension_file); @@@ -464,7 -465,7 +465,7 @@@ char *title = g_strdup_printf (_(" %s%s file error"), mc_home, MC_LIB_EXT); - message (1, title, _("The format of the %smc.ext " + message (D_ERROR, title, _("The format of the %smc.ext " "file has changed with version 3.0. It seems that " "the installation failed. Please fetch a fresh " "copy from the Midnight Commander package."), @@@ -477,7 -478,7 +478,7 @@@ if (home_error) { char *title = g_strdup_printf (_(" ~/%s file error "), MC_USER_EXT); - message (1, title, _("The format of the ~/%s file has " + message (D_ERROR, title, _("The format of the ~/%s file has " "changed with version 3.0. You may either want to copy " "it from %smc.ext or use that file as an example of how " "to write it."), MC_USER_EXT, mc_home); diff --combined src/file.c index 5606691,de91806..dff29de --- a/src/file.c +++ b/src/file.c @@@ -214,7 -214,7 +214,7 @@@ do_transform_source (FileOpContext *ctx case '*': if (next_reg < 0 || next_reg >= RE_NREGS || ctx->regs.start[next_reg] < 0) { - message (1, MSG_ERROR, _(" Invalid target mask ")); + message (D_ERROR, MSG_ERROR, _(" Invalid target mask ")); transform_error = FILE_ABORT; return NULL; } @@@ -314,7 -314,7 +314,7 @@@ check_hardlinks (const char *src_name, } } } - message (1, MSG_ERROR, _(" Cannot make the hardlink ")); + message (D_ERROR, MSG_ERROR, _(" Cannot make the hardlink ")); return 0; } lp = (struct link *) g_malloc (sizeof (struct link) + strlen (src_name) @@@ -368,7 -368,7 +368,7 @@@ make_symlink (FileOpContext *ctx, cons if (ctx->stable_symlinks) if (!vfs_file_is_local (src_path) || !vfs_file_is_local (dst_path)) { - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" Cannot make stable symlinks across " "non-local filesystems: \n\n" " Option Stable Symlinks will be disabled ")); @@@ -512,7 -512,7 +512,7 @@@ copy_file_file (FileOpContext *ctx, con if (dst_exists) { /* Destination already exists */ if (sb.st_dev == sb2.st_dev && sb.st_ino == sb2.st_ino) { - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" `%s' and `%s' are the same file "), src_path, dst_path); do_refresh (); return FILE_SKIP; @@@ -588,7 -588,7 +588,7 @@@ if (ctx->do_reget) { if (mc_lseek (src_desc, ctx->do_reget, SEEK_SET) != ctx->do_reget) { - message (1, _("Warning"), + message (D_ERROR, _("Warning"), _(" Reget failed, about to overwrite file ")); ctx->do_reget = ctx->do_append = 0; } @@@ -870,7 -870,7 +870,7 @@@ copy_dir_dir (FileOpContext *ctx, cons if (is_in_linklist (parent_dirs, s, &cbuf)) { /* we found a cyclic symbolic link */ - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" Cannot copy cyclic symbolic link \n `%s' "), s); return FILE_SKIP; } @@@ -913,7 -913,7 +913,7 @@@ } /* Dive into subdir if exists */ if (toplevel && ctx->dive_into_subdirs) { - dest_dir = concat_dir_and_file (d, x_basename (s)); + dest_dir = mhl_str_dir_plus_file (d, x_basename (s)); } else { dest_dir = g_strdup (d); goto dont_mkdir; @@@ -959,11 -959,11 +959,11 @@@ continue; /* get the filename and add it to the src directory */ - path = concat_dir_and_file (s, next->d_name); + path = mhl_str_dir_plus_file (s, next->d_name); (*ctx->stat_func) (path, &buf); if (S_ISDIR (buf.st_mode)) { - mdpath = concat_dir_and_file (dest_dir, next->d_name); + mdpath = mhl_str_dir_plus_file (dest_dir, next->d_name); /* * From here, we just intend to recursively copy subdirs, not * the double functionality of copying different when the target @@@ -974,7 -974,7 +974,7 @@@ parent_dirs, progress_count, progress_bytes); g_free (mdpath); } else { - dest_file = concat_dir_and_file (dest_dir, x_basename (path)); + dest_file = mhl_str_dir_plus_file (dest_dir, x_basename (path)); return_status = copy_file_file (ctx, path, dest_file, 1, progress_count, progress_bytes, 0); g_free (dest_file); @@@ -1054,14 -1054,14 +1054,14 @@@ move_file_file (FileOpContext *ctx, con strcpy (st, path_trunc (s, msize)); strcpy (dt, path_trunc (d, msize)); - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" `%s' and `%s' are the same file "), st, dt); do_refresh (); return FILE_SKIP; } if (S_ISDIR (dst_stats.st_mode)) { - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" Cannot overwrite directory `%s' "), d); do_refresh (); return FILE_SKIP; @@@ -1164,7 -1164,7 +1164,7 @@@ move_dir_dir (FileOpContext *ctx, cons destdir = g_strdup (d); move_over = 1; } else - destdir = concat_dir_and_file (d, x_basename (s)); + destdir = mhl_str_dir_plus_file (d, x_basename (s)); if (sbuf.st_dev == dbuf.st_dev && sbuf.st_ino == dbuf.st_ino) { int msize = COLS - 36; @@@ -1177,7 -1177,7 +1177,7 @@@ strcpy (st, path_trunc (s, msize)); strcpy (dt, path_trunc (d, msize)); - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" `%s' and `%s' are the same directory "), st, dt); do_refresh (); return FILE_SKIP; @@@ -1321,7 -1321,7 +1321,7 @@@ recursive_erase (FileOpContext *ctx, co continue; if (!strcmp (next->d_name, "..")) continue; - path = concat_dir_and_file (s, next->d_name); + path = mhl_str_dir_plus_file (s, next->d_name); if (mc_lstat (path, &buf)) { g_free (path); mc_closedir (reading); @@@ -1512,7 -1512,7 +1512,7 @@@ compute_dir_size (const char *dirname, if (strcmp (dirent->d_name, "..") == 0) continue; - fullname = concat_dir_and_file (dirname, dirent->d_name); + fullname = mhl_str_dir_plus_file (dirname, dirent->d_name); res = mc_lstat (fullname, &s); @@@ -1569,7 -1569,7 +1569,7 @@@ panel_compute_totals (WPanel *panel, of double subdir_bytes = 0; dir_name = - concat_dir_and_file (panel->cwd, panel->dir.list[i].fname); + mhl_str_dir_plus_file (panel->cwd, panel->dir.list[i].fname); compute_dir_size (dir_name, &subdir_count, &subdir_bytes); *ret_marked += subdir_count; @@@ -1755,7 -1755,7 +1755,7 @@@ panel_operate (void *source_panel, File } if (!strcmp (source, "..")) { - message (1, MSG_ERROR, _(" Cannot operate on \"..\"! ")); + message (D_ERROR, MSG_ERROR, _(" Cannot operate on \"..\"! ")); return 0; } } @@@ -1833,7 -1833,7 +1833,7 @@@ g_strconcat (op_names[operation], ": ", panel->cwd, NULL)); if (v == -1) { - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" Sorry, I could not put the job in background ")); } @@@ -1877,7 -1877,7 +1877,7 @@@ /* The source and src_stat variables have been initialized before */ #ifdef WITH_FULL_PATHS - source_with_path = concat_dir_and_file (panel->cwd, source); + source_with_path = mhl_str_dir_plus_file (panel->cwd, source); #endif /* WITH_FULL_PATHS */ if (operation == OP_DELETE) { @@@ -1892,7 -1892,7 +1892,7 @@@ if (temp == NULL) { value = transform_error; } else { - char *temp2 = concat_dir_and_file (dest, temp); + char *temp2 = mhl_str_dir_plus_file (dest, temp); g_free (dest); dest = temp2; temp = NULL; @@@ -1970,7 -1970,7 +1970,7 @@@ #ifdef WITH_FULL_PATHS g_free (source_with_path); - source_with_path = concat_dir_and_file (panel->cwd, source); + source_with_path = mhl_str_dir_plus_file (panel->cwd, source); #endif /* WITH_FULL_PATHS */ if (operation == OP_DELETE) { @@@ -1986,7 -1986,7 +1986,7 @@@ if (temp == NULL) value = transform_error; else { - char *temp2 = concat_dir_and_file (dest, temp); + char *temp2 = mhl_str_dir_plus_file (dest, temp); switch (operation) { case OP_COPY: diff --combined src/find.c index 9fce565,95103f1..7590811 --- a/src/find.c +++ b/src/find.c @@@ -25,9 -25,10 +25,10 @@@ #include <stdio.h> #include <stdlib.h> #include <string.h> - #include <sys/stat.h> + #include <mhl/string.h> + #include "global.h" #include "tty.h" #include "win.h" @@@ -166,7 -167,7 +167,7 @@@ find_parm_callback (struct Dlg_head *h flags |= REG_ICASE; if (regcomp (r, in_with->buffer, flags)) { - message (1, MSG_ERROR, _(" Malformed regular expression ")); + message (D_ERROR, MSG_ERROR, _(" Malformed regular expression ")); dlg_select_widget (in_with); h->running = 1; /* Don't stop the dialog */ } @@@ -354,7 -355,7 +355,7 @@@ push_directory (const char *dir dir_stack *new; new = g_new (dir_stack, 1); - new->name = concat_dir_and_file (dir, ""); + new->name = mhl_str_dir_plus_file (dir, NULL); new->prev = dir_stack_base; dir_stack_base = new; } @@@ -516,7 -517,7 +517,7 @@@ search_content (Dlg_head *h, const cha int file_fd; int ret_val = 0; - fname = concat_dir_and_file (directory, filename); + fname = mhl_str_dir_plus_file (directory, filename); if (mc_stat (fname, &s) != 0 || !S_ISREG (s.st_mode)){ g_free (fname); @@@ -692,7 -693,7 +693,7 @@@ do_search (struct Dlg_head *h } if (subdirs_left && find_recursively && directory) { /* Can directory be NULL ? */ - char *tmp_name = concat_dir_and_file (directory, dp->d_name); + char *tmp_name = mhl_str_dir_plus_file (directory, dp->d_name); if (!mc_lstat (tmp_name, &tmp_stat) && S_ISDIR (tmp_stat.st_mode)) { push_directory (tmp_name); @@@ -752,8 -753,8 +753,8 @@@ make_fullname (const char *dirname, con if (strcmp(dirname, ".") == 0 || strcmp(dirname, "."PATH_SEP_STR) == 0) return g_strdup (filename); if (strncmp(dirname, "."PATH_SEP_STR, 2) == 0) - return concat_dir_and_file (dirname + 2, filename); - return concat_dir_and_file (dirname, filename); + return mhl_str_dir_plus_file (dirname + 2, filename); + return mhl_str_dir_plus_file (dirname, filename); } static void diff --combined src/main.c index 6ba72e0,f1a78b0..8be5841 --- a/src/main.c +++ b/src/main.c @@@ -29,11 -29,12 +29,12 @@@ #include <stdio.h> #include <stdlib.h> #include <string.h> - #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> + #include <mhl/string.h> + #include "global.h" #include "tty.h" #include "dir.h" @@@ -425,7 -426,7 +426,7 @@@ voi do_possible_cd (const char *new_dir) { if (!do_cd (new_dir, cd_exact)) - message (1, _("Warning"), + message (D_ERROR, _("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" @@@ -471,7 -472,7 +472,7 @@@ quit_cmd_internal (int quiet } else { if (query_dialog (_(" The Midnight Commander "), - _(" Do you really want to quit the Midnight Commander? "), 0, + _(" Do you really want to quit the Midnight Commander? "), D_NORMAL, 2, _("&Yes"), _("&No")) == 0) q = 1; } @@@ -686,7 -687,7 +687,7 @@@ directory_history_list (WPanel *panel if (_do_panel_cd (panel, s, cd_exact)) directory_history_add (panel, panel->cwd); else - message (1, MSG_ERROR, _("Cannot change directory")); + message (D_ERROR, MSG_ERROR, _("Cannot change directory")); g_free (s); } @@@ -993,7 -994,7 +994,7 @@@ toggle_fast_reload (void { fast_reload = !fast_reload; if (fast_reload_w == 0 && fast_reload) { - message (0, _(" Information "), + message (D_NORMAL, _(" Information "), _ (" Using the fast reload option may not reflect the exact \n" " directory contents. In this case you'll need to do a \n" @@@ -1137,7 -1138,7 +1138,7 @@@ copy_readlink (WPanel *panel if (S_ISLNK (selection (panel)->st.st_mode)) { char buffer[MC_MAXPATHLEN]; char *p = - concat_dir_and_file (panel->cwd, selection (panel)->fname); + mhl_str_dir_plus_file (panel->cwd, selection (panel)->fname); int i; i = mc_readlink (p, buffer, MC_MAXPATHLEN - 1); diff --combined src/screen.c index a1ae531,6c3821b..42c4337 --- a/src/screen.c +++ b/src/screen.c @@@ -25,9 -25,10 +25,10 @@@ #include <stdio.h> #include <stdlib.h> #include <string.h> - #include <unistd.h> + #include <mhl/string.h> + #include "global.h" #include "tty.h" #include "dir.h" @@@ -47,7 -48,7 +48,7 @@@ #include "execute.h" #include "widget.h" #include "menu.h" /* menubar_visible */ -#define WANT_WIDGETS +#include "main-widgets.h" #include "main.h" /* the_menubar */ #include "unixcompat.h" @@@ -709,7 -710,7 +710,7 @@@ display_mini_info (WPanel *panel char *link, link_target [MC_MAXPATHLEN]; int len; - link = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname); + link = mhl_str_dir_plus_file (panel->cwd, panel->dir.list [panel->selected].fname); len = mc_readlink (link, link_target, MC_MAXPATHLEN - 1); g_free (link); if (len > 0){ @@@ -1965,7 -1966,7 +1966,7 @@@ do_enter_on_file_entry (file_entry *fe if (S_ISDIR (fe->st.st_mode) || link_isdir (fe) || (fe->st.st_mode == 0)) { if (!do_cd (fe->fname, cd_exact)) - message (1, MSG_ERROR, _("Cannot change directory")); + message (D_ERROR, MSG_ERROR, _("Cannot change directory")); return 1; } @@@ -1974,7 -1975,7 +1975,7 @@@ return 1; /* Check if the file is executable */ - full_name = concat_dir_and_file (current_panel->cwd, fe->fname); + full_name = mhl_str_dir_plus_file (current_panel->cwd, fe->fname); if (!is_exe (fe->st.st_mode) || !if_link_is_exe (full_name, fe)) { g_free (full_name); return 0; @@@ -1984,7 -1985,7 +1985,7 @@@ if (confirm_execute) { if (query_dialog (_(" The Midnight Commander "), - _(" Do you really want to execute? "), 0, 2, _("&Yes"), + _(" Do you really want to execute? "), D_NORMAL, 2, _("&Yes"), _("&No")) != 0) return 1; } @@@ -1993,7 -1994,7 +1994,7 @@@ char *tmp; int ret; - tmp = concat_dir_and_file (vfs_get_current_dir (), fe->fname); + tmp = mhl_str_dir_plus_file (vfs_get_current_dir (), fe->fname); ret = mc_setctl (tmp, VFS_SETCTL_RUN, NULL); g_free (tmp); /* We took action only if the dialog was shown or the execution @@@ -2030,10 -2031,10 +2031,10 @@@ chdir_other_panel (WPanel *panel } if (!S_ISDIR (panel->dir.list [panel->selected].st.st_mode)) { - new_dir = concat_dir_and_file (panel->cwd, ".."); + new_dir = mhl_str_dir_plus_file (panel->cwd, ".."); sel_entry = strrchr(panel->cwd, PATH_SEP); } else - new_dir = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname); + new_dir = mhl_str_dir_plus_file (panel->cwd, panel->dir.list [panel->selected].fname); change_panel (); do_cd (new_dir, cd_exact); @@@ -2099,7 -2100,7 +2100,7 @@@ chdir_to_readlink (WPanel *panel if (*buffer == PATH_SEP) new_dir = g_strdup (buffer); else - new_dir = concat_dir_and_file (panel->cwd, buffer); + new_dir = mhl_str_dir_plus_file (panel->cwd, buffer); change_panel (); do_cd (new_dir, cd_exact); @@@ -2252,7 -2253,7 +2253,7 @@@ panel_callback (Widget *w, widget_msg_ panel->active = 1; if (mc_chdir (panel->cwd) != 0) { char *cwd = strip_password (g_strdup (panel->cwd), 1); - message (1, MSG_ERROR, _(" Cannot chdir to \"%s\" \n %s "), + message (D_ERROR, MSG_ERROR, _(" Cannot chdir to \"%s\" \n %s "), cwd, unix_error_string (errno)); g_free(cwd); } else diff --combined src/setup.c index e806f10,67dec4a..aa0f6bc --- a/src/setup.c +++ b/src/setup.c @@@ -20,10 -20,11 +20,11 @@@ #include <string.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> + #include <mhl/string.h> + #include "global.h" #include "tty.h" #include "dir.h" @@@ -216,14 -217,11 +217,14 @@@ static const struct { "editor_option_typewriter_wrap", &option_typewriter_wrap }, { "editor_edit_confirm_save", &edit_confirm_save }, { "editor_syntax_highlighting", &option_syntax_highlighting }, + { "editor_visible_tabs", &visible_tabs }, + { "editor_visible_spaces", &visible_tws }, #endif /* USE_INTERNAL_EDIT */ { "nice_rotating_dash", &nice_rotating_dash }, { "horizontal_split", &horizontal_split }, { "mcview_remember_file_position", &mcview_remember_file_position }, + { "auto_fill_mkdir_name", &auto_fill_mkdir_name }, { 0, 0 } }; @@@ -284,7 -282,7 +285,7 @@@ save_layout (void int i; char buffer [BUF_TINY]; - profile = concat_dir_and_file (home_dir, PROFILE_NAME); + profile = mhl_str_dir_plus_file (home_dir, PROFILE_NAME); /* Save integer options */ for (i = 0; layout [i].opt_name; i++){ @@@ -301,7 -299,7 +302,7 @@@ save_configure (void char *profile; int i; - profile = concat_dir_and_file (home_dir, PROFILE_NAME); + profile = mhl_str_dir_plus_file (home_dir, PROFILE_NAME); /* Save integer options */ for (i = 0; int_options[i].opt_name; i++) @@@ -349,7 -347,7 +350,7 @@@ save_setup (void char *profile; saving_setup = 1; - profile = concat_dir_and_file (home_dir, PROFILE_NAME); + profile = mhl_str_dir_plus_file (home_dir, PROFILE_NAME); save_configure (); @@@ -484,9 -482,9 +485,9 @@@ setup_init (void if (profile_name) return profile_name; - profile = concat_dir_and_file (home_dir, PROFILE_NAME); + profile = mhl_str_dir_plus_file (home_dir, PROFILE_NAME); if (!exist_file (profile)){ - inifile = concat_dir_and_file (mc_home, "mc.ini"); + inifile = mhl_str_dir_plus_file (mc_home, "mc.ini"); if (exist_file (inifile)){ g_free (profile); profile = inifile; @@@ -509,7 -507,7 +510,7 @@@ load_setup (void /* mc.lib is common for all users, but has priority lower than ~/.mc/ini. FIXME: it's only used for keys and treestore now */ - global_profile_name = concat_dir_and_file (mc_home, "mc.lib"); + global_profile_name = mhl_str_dir_plus_file (mc_home, "mc.lib"); /* Load integer boolean options */ for (i = 0; int_options[i].opt_name; i++) diff --combined src/user.c index e47b842,49e5d06..faa0ba9 --- a/src/user.c +++ b/src/user.c @@@ -23,6 -23,8 +23,8 @@@ #include <stdio.h> #include <string.h> + #include <mhl/string.h> + #include "global.h" #include "tty.h" #include "color.h" @@@ -131,7 -133,7 +133,7 @@@ int check_format_var (const char *p, ch return 0; if (!dots || dots == q+5){ - message (1, + message (D_ERROR, _(" Format error on file Extensions File "), !dots ? _(" The %%var macro has no default ") : _(" The %%var macro has no variable ")); @@@ -464,7 -466,7 +466,7 @@@ debug_out (char *start, char *end, int len = strlen (msg); if (len) msg [len - 1] = 0; - message (0, _(" Debug "), "%s", msg); + message (D_NORMAL, _(" Debug "), "%s", msg); } debug_flag = 0; @@@ -581,7 -583,7 +583,7 @@@ execute_menu_command (WEdit *edit_widge cmd_file_fd = mc_mkstemps (&file_name, "mcusr", SCRIPT_SUFFIX); if (cmd_file_fd == -1){ - message (1, MSG_ERROR, _(" Cannot create temporary command file \n %s "), + message (D_ERROR, MSG_ERROR, _(" Cannot create temporary command file \n %s "), unix_error_string (errno)); return; } @@@ -689,7 -691,7 +691,7 @@@ menu_file_own(char* path } if (verbose) { - message (0, _(" Warning -- ignoring file "), + message (D_NORMAL, _(" Warning -- ignoring file "), _("File %s is not owned by root or you or is world writable.\n" "Using it may compromise your security"), path @@@ -713,7 -715,7 +715,7 @@@ user_menu_cmd (struct WEdit *edit_widge Listbox *listbox; if (!vfs_current_is_local ()){ - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" Cannot execute commands on non-local filesystems")); return; } @@@ -721,17 -723,17 +723,17 @@@ menu = g_strdup (edit_widget ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU); if (!exist_file (menu) || !menu_file_own (menu)){ g_free (menu); - menu = concat_dir_and_file \ + menu = mhl_str_dir_plus_file \ (home_dir, edit_widget ? CEDIT_HOME_MENU : MC_HOME_MENU); if (!exist_file (menu)){ g_free (menu); - menu = concat_dir_and_file \ + menu = mhl_str_dir_plus_file \ (mc_home, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); } } if ((data = load_file (menu)) == NULL){ - message (1, MSG_ERROR, _(" Cannot open file %s \n %s "), + message (D_ERROR, MSG_ERROR, _(" Cannot open file %s \n %s "), menu, unix_error_string (errno)); g_free (menu); menu = NULL; @@@ -812,7 -814,7 +814,7 @@@ } if (menu_lines == 0) { - message (1, MSG_ERROR, _(" No suitable entries found in %s "), menu); + message (D_ERROR, MSG_ERROR, _(" No suitable entries found in %s "), menu); } else { max_cols = min (max (max_cols, col), MAX_ENTRY_LEN); diff --combined vfs/extfs.c index 7212aeb,03bbf25..b46057d --- a/vfs/extfs.c +++ b/vfs/extfs.c @@@ -35,6 -35,9 +35,9 @@@ #include <sys/wait.h> #endif #include <errno.h> + + #include <mhl/string.h> + #include "../src/global.h" #include "../src/tty.h" /* enable/disable interrupt key */ #include "../src/wtools.h" /* message() */ @@@ -246,7 -249,7 +249,7 @@@ extfs_open_archive (int fstype, const c tmp = name_quote (name, 0); } - mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); + mc_extfsdir = mhl_str_dir_plus_file (mc_home, "extfs" PATH_SEP_STR); cmd = g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ", local_name ? local_name : tmp, (char *) NULL); @@@ -256,7 -259,7 +259,7 @@@ result = popen (cmd, "r"); g_free (cmd); if (result == NULL) { - close_error_pipe (1, NULL); + close_error_pipe (D_ERROR, NULL); if (local_name) { mc_ungetlocalcopy (name, local_name, 0); g_free(local_name); @@@ -314,7 -317,7 +317,7 @@@ extfs_read_archive (int fstype, const c if ((extfsd = extfs_open_archive (fstype, name, ¤t_archive)) == NULL) { - message (1, MSG_ERROR, _("Cannot open %s archive\n%s"), + message (D_ERROR, MSG_ERROR, _("Cannot open %s archive\n%s"), extfs_prefixes[fstype], name); return -1; } @@@ -354,7 -357,7 +357,7 @@@ /* FIXME: Should clean everything one day */ g_free (buffer); pclose (extfsd); - close_error_pipe (1, _("Inconsistent extfs archive")); + close_error_pipe (D_ERROR, _("Inconsistent extfs archive")); return -1; } entry = g_new (struct entry, 1); @@@ -373,7 -376,7 +376,7 @@@ /* FIXME: Should clean everything one day */ g_free (buffer); pclose (extfsd); - close_error_pipe (1, + close_error_pipe (D_ERROR, _("Inconsistent extfs archive")); return -1; } else { @@@ -425,11 -428,11 +428,11 @@@ /* Check if extfs 'list' returned 0 */ if (pclose (extfsd) != 0) { extfs_free (current_archive); - close_error_pipe (1, _("Inconsistent extfs archive")); + close_error_pipe (D_ERROR, _("Inconsistent extfs archive")); return -1; } - close_error_pipe (1, NULL); + close_error_pipe (D_ERROR, NULL); *pparc = current_archive; return 0; } @@@ -621,7 -624,7 +624,7 @@@ extfs_cmd (const char *extfs_cmd, struc archive_name = name_quote (extfs_get_archive_name (archive), 0); quoted_localname = name_quote (localname, 0); - mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); + mc_extfsdir = mhl_str_dir_plus_file (mc_home, "extfs" PATH_SEP_STR); cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], extfs_cmd, archive_name, " ", quoted_file, " ", quoted_localname, (char *) NULL); @@@ -633,7 -636,7 +636,7 @@@ open_error_pipe (); retval = my_system (EXECUTE_AS_SHELL, shell, cmd); g_free (cmd); - close_error_pipe (1, NULL); + close_error_pipe (D_ERROR, NULL); return retval; } @@@ -650,7 -653,7 +653,7 @@@ extfs_run (struct vfs_class *me, const g_free (p); archive_name = name_quote (extfs_get_archive_name (archive), 0); - mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); + mc_extfsdir = mhl_str_dir_plus_file (mc_home, "extfs" PATH_SEP_STR); cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], " run ", archive_name, " ", q, (char *) NULL); g_free (mc_extfsdir); @@@ -724,7 -727,7 +727,7 @@@ extfs_open (struct vfs_class *me, cons return extfs_info; } -static int extfs_read (void *data, char *buffer, int count) +static ssize_t extfs_read (void *data, char *buffer, int count) { struct pseudofile *file = (struct pseudofile *)data; @@@ -1016,7 -1019,7 +1019,7 @@@ static int extfs_chmod (struct vfs_clas return 0; } -static int extfs_write (void *data, const char *buf, int nbyte) +static ssize_t extfs_write (void *data, const char *buf, int nbyte) { struct pseudofile *file = (struct pseudofile *)data; @@@ -1141,7 -1144,7 +1144,7 @@@ extfs_chdir (struct vfs_class *me, cons return 0; } -static int extfs_lseek (void *data, off_t offset, int whence) +static off_t extfs_lseek (void *data, off_t offset, int whence) { struct pseudofile *file = (struct pseudofile *) data; @@@ -1295,7 -1298,7 +1298,7 @@@ static int extfs_init (struct vfs_clas (void) me; - mc_extfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "extfs.ini"); + mc_extfsini = mhl_str_dir_plus_file (mc_home, "extfs" PATH_SEP_STR "extfs.ini"); cfg = fopen (mc_extfsini, "r"); /* We may not use vfs_die() message or message or similar, diff --combined vfs/ftpfs.c index 7737e93,68f6967..023f14b --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@@ -44,7 -44,7 +44,7 @@@ What to do with this int f = !strcmp( remote_path, "/~" ); if (f || !strncmp( remote_path, "/~/", 3 )) { char *s; - s = concat_dir_and_file( qhome (*bucket), remote_path +3-f ); + s = mhl_str_dir_plus_file( qhome (*bucket), remote_path +3-f ); g_free (remote_path); remote_path = s; } @@@ -69,6 -69,8 +69,8 @@@ #include <errno.h> #include <ctype.h> + #include <mhl/string.h> + #include "../src/global.h" #include "../src/tty.h" /* enable/disable interrupt key */ #include "../src/wtools.h" /* message() */ @@@ -528,7 -530,7 +530,7 @@@ ftpfs_login_server (struct vfs_class *m goto login_fail; } } - message (1, MSG_ERROR, _("ftpfs: Login incorrect for user %s "), + message (D_ERROR, MSG_ERROR, _("ftpfs: Login incorrect for user %s "), SUP.user); login_fail: wipe_password (pass); @@@ -555,7 -557,7 +557,7 @@@ ftpfs_load_no_proxy_list (void if (mc_file) return; - mc_file = concat_dir_and_file (mc_home, "mc.no_proxy"); + mc_file = mhl_str_dir_plus_file (mc_home, "mc.no_proxy"); if (exist_file (mc_file) && (npf = fopen (mc_file, "r"))) { while (fgets (s, sizeof (s), npf)) { @@@ -1230,7 -1232,7 +1232,7 @@@ ftpfs_dir_load (struct vfs_class *me, s ftpfs_open_data_connection (me, super, "LIST -la", 0, TYPE_ASCII, 0); else { /* Trailing "/." is necessary if remote_path is a symlink */ - char *path = concat_dir_and_file (remote_path, "."); + char *path = mhl_str_dir_plus_file (remote_path, "."); sock = ftpfs_open_data_connection (me, super, "LIST -la", path, TYPE_ASCII, 0); @@@ -1787,7 -1789,7 +1789,7 @@@ static int ftpfs_netrc_bad_mode (const if (stat (netrcname, &mystat) >= 0 && (mystat.st_mode & 077)) { if (be_angry) { - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _("~/.netrc file has incorrect mode.\n" "Remove password or correct mode.")); be_angry = 0; @@@ -1886,7 -1888,7 +1888,7 @@@ static int ftpfs_netrc_lookup (const ch } /* Load current .netrc */ - netrcname = concat_dir_and_file (home_dir, ".netrc"); + netrcname = mhl_str_dir_plus_file (home_dir, ".netrc"); netrcp = netrc = load_file (netrcname); if (netrc == NULL) { g_free (netrcname); diff --combined vfs/mcfs.c index 9f5ace2,796db65..884c523 --- a/vfs/mcfs.c +++ b/vfs/mcfs.c @@@ -130,7 -130,7 +130,7 @@@ mcfs_login_server (int my_socket, char return 0; if (result != MC_VERSION_OK) { - message (1, _(" MCFS "), + message (D_ERROR, _(" MCFS "), _(" The server does not support this version ")); close (my_socket); return 0; @@@ -151,7 -151,7 +151,7 @@@ (" The remote server is not running on a system port \n" " you need a password to log in, but the information may \n" " not be safe on the remote side. Continue? \n"), - 3, 2, _("&Yes"), _("&No")); + D_ERROR, 2, _("&Yes"), _("&No")); if (v == 1) { close (my_socket); @@@ -175,7 -175,7 +175,7 @@@ return 0; if (result != MC_LOGINOK) { - message (1, _(" MCFS "), _(" Invalid password ")); + message (D_ERROR, _(" MCFS "), _(" Invalid password ")); rpc_send (my_socket, RPC_INT, MC_QUIT, RPC_END); close (my_socket); return 0; @@@ -235,7 -235,7 +235,7 @@@ mcfs_create_tcp_link (const char *host sizeof (inaddr)); else { if ((hp = gethostbyname (host)) == NULL) { - message (1, caller, _(" Cannot locate hostname: %s "), + message (D_ERROR, caller, _(" Cannot locate hostname: %s "), host); return 0; } @@@ -254,13 -254,13 +254,13 @@@ server_address.sin_port = htons (*port); if ((my_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) { - message (1, caller, _(" Cannot create socket: %s "), + message (D_ERROR, caller, _(" Cannot create socket: %s "), unix_error_string (errno)); return 0; } if (connect (my_socket, (struct sockaddr *) &server_address, sizeof (server_address)) < 0) { - message (1, caller, _(" Cannot connect to server: %s "), + message (D_ERROR, caller, _(" Cannot connect to server: %s "), unix_error_string (errno)); close (my_socket); return 0; @@@ -330,7 -330,7 +330,7 @@@ mcfs_open_link (char *host, char *user return &mcfs_connections[i]; } if (mcfs_open_connections == MCFS_MAX_CONNECTIONS) { - message (1, MSG_ERROR, _(" Too many open connections ")); + message (D_ERROR, MSG_ERROR, _(" Too many open connections ")); return 0; } @@@ -406,7 -406,7 +406,7 @@@ mcfs_get_path (mcfs_connection **mc, co int f = !strcmp (remote_path, "/~"); if (f || !strncmp (remote_path, "/~/", 3)) { char *s; - s = concat_dir_and_file (mcfs_gethome (*mc), + s = mhl_str_dir_plus_file (mcfs_gethome (*mc), remote_path + 3 - f); g_free (remote_path); remote_path = s; @@@ -551,7 -551,7 +551,7 @@@ mcfs_open (struct vfs_class *me, const return remote_handle; } -static int +static ssize_t mcfs_read (void *data, char *buffer, int count) { mcfs_handle *info = (mcfs_handle *) data; @@@ -578,7 -578,7 +578,7 @@@ return result; } -static int +static ssize_t mcfs_write (void *data, const char *buf, int nbyte) { mcfs_handle *info = (mcfs_handle *) data; @@@ -1069,7 -1069,7 +1069,7 @@@ mcfs_chdir (struct vfs_class *me, cons return 0; } -static int +static off_t mcfs_lseek (void *data, off_t offset, int whence) { mcfs_handle *info = (mcfs_handle *) data; diff --combined vfs/sfs.c index 0770482,42df544..34fee61 --- a/vfs/sfs.c +++ b/vfs/sfs.c @@@ -34,6 -34,8 +34,8 @@@ #include <stdio.h> #include <string.h> + #include <mhl/string.h> + #include "../src/global.h" #include "../src/tty.h" /* enable/disable interrupt key */ #include "../src/wtools.h" /* message() */ @@@ -147,11 -149,11 +149,11 @@@ sfs_vfmake (struct vfs_class *me, cons g_free (pqname); open_error_pipe (); if (my_system (EXECUTE_AS_SHELL, "/bin/sh", pad)) { - close_error_pipe (1, NULL); + close_error_pipe (D_ERROR, NULL); return -1; } - close_error_pipe (0, NULL); + close_error_pipe (D_NORMAL, NULL); return 0; /* OK */ } @@@ -336,7 -338,7 +338,7 @@@ static int sfs_init (struct vfs_class * (void) me; - mc_sfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "sfs.ini"); + mc_sfsini = mhl_str_dir_plus_file (mc_home, "extfs" PATH_SEP_STR "sfs.ini"); cfg = fopen (mc_sfsini, "r"); if (!cfg){ diff --combined vfs/smbfs.c index b07c802,f4d2345..bb82bc2 --- a/vfs/smbfs.c +++ b/vfs/smbfs.c @@@ -366,7 -366,7 +366,7 @@@ smbfs_fill_names (struct vfs_class *me #define GNAL_VNC(s) unix_to_dos(s,False) /* does same as do_get() in client.c */ /* called from vfs.c:1080, count = buffer size */ -static int +static ssize_t smbfs_read (void *data, char *buffer, int count) { smbfs_handle *info = (smbfs_handle *) data; @@@ -380,7 -380,7 +380,7 @@@ return n; } -static int +static ssize_t smbfs_write (void *data, const char *buf, int nbyte) { smbfs_handle *info = (smbfs_handle *) data; @@@ -604,7 -604,7 +604,7 @@@ smbfs_reconnect(smbfs_connection *conn cli_shutdown(conn->cli); if (!(conn->cli = smbfs_do_connect(host, conn->service))) { - message (1, MSG_ERROR, + message (D_ERROR, MSG_ERROR, _(" reconnect to %s failed\n "), conn->host); g_free(host); return False; @@@ -1162,7 -1162,7 +1162,7 @@@ smbfs_open_link (char *host, char *path if (my_errno != EPERM) return 0; - message (1, MSG_ERROR, _(" Authentication failed ")); + message (D_ERROR, MSG_ERROR, _(" Authentication failed ")); /* authentication failed, try again */ smbfs_auth_remove (bucket->host, bucket->service); @@@ -1211,7 -1211,7 +1211,7 @@@ smbfs_get_path (smbfs_connection ** sc int f = !strcmp (remote_path, "/~"); if (f || !strncmp (remote_path, "/~/", 3)) { char *s; - s = concat_dir_and_file ((*sc)->home, remote_path + 3 - f); + s = mhl_str_dir_plus_file ((*sc)->home, remote_path + 3 - f); g_free (remote_path); return s; } @@@ -1625,7 -1625,7 +1625,7 @@@ smbfs_stat (struct vfs_class * me, cons #define smbfs_lstat smbfs_stat /* no symlinks on smb filesystem? */ -static int +static off_t smbfs_lseek (void *data, off_t offset, int whence) { smbfs_handle *info = (smbfs_handle *) data; @@@ -1685,7 -1685,7 +1685,7 @@@ smbfs_mkdir (struct vfs_class * me, con if (!cli_mkdir (sc->cli, cpath)) { my_errno = cli_error (sc->cli, NULL, &err, NULL); - message (1, MSG_ERROR, _(" Error %s creating directory %s "), + message (D_ERROR, MSG_ERROR, _(" Error %s creating directory %s "), cli_errstr (sc->cli), CNV_LANG (cpath)); g_free (cpath); return -1; @@@ -1711,7 -1711,7 +1711,7 @@@ smbfs_rmdir (struct vfs_class *me, cons if (!cli_rmdir(sc->cli, cpath)) { my_errno = cli_error(sc->cli, NULL, &err, NULL); - message (1, MSG_ERROR, _(" Error %s removing directory %s "), + message (D_ERROR, MSG_ERROR, _(" Error %s removing directory %s "), cli_errstr(sc->cli), CNV_LANG(cpath)); g_free (cpath); return -1; @@@ -1813,7 -1813,7 +1813,7 @@@ smbfs_open_readwrite (smbfs_handle *rem flags : O_RDONLY, DENY_NONE); #endif if (remote_handle->fnum == -1) { - message (1, MSG_ERROR, _(" %s opening remote file %s "), + message (D_ERROR, MSG_ERROR, _(" %s opening remote file %s "), cli_errstr (remote_handle->cli), CNV_LANG (rname)); DEBUG (1, ("smbfs_open(rname:%s) error:%s\n", rname, cli_errstr (remote_handle->cli))); @@@ -1829,7 -1829,7 +1829,7 @@@ NULL) && !cli_getattrE (remote_handle->cli, remote_handle->fnum, &remote_handle->attr, &size, NULL, NULL, NULL)) { - message (1, MSG_ERROR, " getattrib: %s ", + message (D_ERROR, MSG_ERROR, " getattrib: %s ", cli_errstr (remote_handle->cli)); DEBUG (1, ("smbfs_open(rname:%s) getattrib:%s\n", rname, @@@ -1892,7 -1892,7 +1892,7 @@@ smbfs_unlink (struct vfs_class *me, con remote_file = free_after(smbfs_convert_path (remote_file, FALSE), remote_file); if (!cli_unlink(sc->cli, remote_file)) { - message (1, MSG_ERROR, _(" %s removing remote file %s "), + message (D_ERROR, MSG_ERROR, _(" %s removing remote file %s "), cli_errstr(sc->cli), CNV_LANG(remote_file)); g_free (remote_file); return -1; @@@ -1927,7 -1927,7 +1927,7 @@@ smbfs_rename (struct vfs_class *me, con g_free (rb); if (!retval) { - message (1, MSG_ERROR, _(" %s renaming files\n"), + message (D_ERROR, MSG_ERROR, _(" %s renaming files\n"), cli_errstr(sc->cli)); return -1; } diff --combined vfs/vfs.c index 8ea71f7,39fdc73..f13d217 --- a/vfs/vfs.c +++ b/vfs/vfs.c @@@ -38,6 -38,8 +38,8 @@@ #include <signal.h> #include <ctype.h> /* is_digit() */ + #include <mhl/string.h> + #include "../src/global.h" #include "../src/tty.h" /* enable/disable interrupt key */ #include "../src/wtools.h" /* message() */ @@@ -377,7 -379,7 +379,7 @@@ MC_NAMEOP (mknod, (const char *path, mo #define MC_HANDLEOP(name, inarg, callarg) \ -int mc_##name inarg \ +ssize_t mc_##name inarg \ { \ struct vfs_class *vfs; \ int result; \ @@@ -390,8 -392,8 +392,8 @@@ return result; \ } -MC_HANDLEOP(read, (int handle, void *buffer, int count), (vfs_info (handle), buffer, count) ) -MC_HANDLEOP (write, (int handle, const void *buf, int nbyte), (vfs_info (handle), buf, nbyte)) +MC_HANDLEOP(read, (int handle, void *buffer, int count), (vfs_info (handle), buffer, count)) +MC_HANDLEOP(write, (int handle, const void *buf, int nbyte), (vfs_info (handle), buf, nbyte)) #define MC_RENAMEOP(name) \ @@@ -656,7 -658,7 +658,7 @@@ vfs_canon (const char *path if (*path != PATH_SEP){ char *local, *result; - local = concat_dir_and_file (current_dir, path); + local = mhl_str_dir_plus_file (current_dir, path); result = vfs_canon (local); g_free (local); @@@ -841,7 -843,7 +843,7 @@@ mc_def_ungetlocalcopy (struct vfs_clas return 0; failed: - message (1, _("Changes to file lost"), "%s", filename); + message (D_ERROR, _("Changes to file lost"), "%s", filename); if (fdout != -1) mc_close (fdout); if (fdin != -1) -- Midnight Commander Development _______________________________________________ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel