updated: [3b8f37b] Moved some functions out of mhl into src/util.c
- From: "Patrick Winnertz" <winnie debian org>
- To: mc-devel gnome org
- Subject: updated: [3b8f37b] Moved some functions out of mhl into src/util.c
- Date: Tue, 10 Feb 2009 12:49:56 +0100 (CET)
The following commit has been merged in the master branch:
commit 3b8f37b99e551eb1db84b8136f828c4165e4be6f
Author: Patrick Winnertz <winnie debian org>
Date: Fri Feb 6 11:17:03 2009 +0100
Moved some functions out of mhl into src/util.c
This commit moves the mhl_str_concat_dir_and_file back into src/util.c whitout changing atm the functionality.
Please note that this is an incomplete fix and needs to be partially enhanced in order to keep the full functionality with glib.
Signed-off-by: Patrick Winnertz <winnie debian org>
diff --git a/edit/edit.c b/edit/edit.c
index e8c0c8e..12f5b72 100644
--- a/edit/edit.c
+++ b/edit/edit.c
@@ -2667,7 +2667,7 @@ user_menu (WEdit * edit)
int nomark;
struct stat status;
long start_mark, end_mark;
- char *block_file = mhl_str_dir_plus_file (home_dir, BLOCK_FILE);
+ char *block_file = concat_dir_and_file (home_dir, BLOCK_FILE);
int rc = 0;
nomark = eval_marks (edit, &start_mark, &end_mark);
diff --git a/edit/editcmd.c b/edit/editcmd.c
index 6d3c2ed..26930c6 100644
--- a/edit/editcmd.c
+++ b/edit/editcmd.c
@@ -215,7 +215,7 @@ edit_save_file (WEdit *edit, const char *filename)
return 0;
if (*filename != PATH_SEP && edit->dir) {
- savename = mhl_str_dir_plus_file (edit->dir, filename);
+ savename = concat_dir_and_file (edit->dir, filename);
filename = catstrs (savename, (char *) NULL);
g_free (savename);
}
@@ -281,7 +281,7 @@ edit_save_file (WEdit *edit, const char *filename)
savedir[slashpos - filename + 1] = '\0';
} else
savedir = mhl_str_dup (".");
- saveprefix = mhl_str_dir_plus_file (savedir, "cooledit");
+ saveprefix = concat_dir_and_file (savedir, "cooledit");
g_free (savedir);
fd = mc_mkstemps (&savename, saveprefix, NULL);
g_free (saveprefix);
diff --git a/edit/editwidget.c b/edit/editwidget.c
index 8fb8c14..89e0a5a 100644
--- a/edit/editwidget.c
+++ b/edit/editwidget.c
@@ -176,7 +176,7 @@ edit_file (const char *_file, int line)
WButtonBar *edit_bar;
if (!made_directory) {
- char *dir = mhl_str_dir_plus_file (home_dir, EDIT_DIR);
+ char *dir = concat_dir_and_file (home_dir, EDIT_DIR);
made_directory = (mkdir (dir, 0700) != -1 || errno == EEXIST);
g_free (dir);
}
diff --git a/edit/syntax.c b/edit/syntax.c
index 8fdea33..427d24e 100644
--- a/edit/syntax.c
+++ b/edit/syntax.c
@@ -1026,7 +1026,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
f = fopen (syntax_file, "r");
if (!f){
- lib_file = mhl_str_dir_plus_file (mc_home, "syntax" PATH_SEP_STR "Syntax");
+ lib_file = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax");
f = fopen (lib_file, "r");
g_free (lib_file);
if (!f)
@@ -1187,7 +1187,7 @@ edit_load_syntax (WEdit *edit, char ***pnames, const char *type)
if (!*edit->filename && !type)
return;
}
- f = mhl_str_dir_plus_file (home_dir, SYNTAX_FILE);
+ f = concat_dir_and_file (home_dir, SYNTAX_FILE);
r = edit_read_syntax_file (edit, pnames, f, edit ? edit->filename : 0,
get_first_editor_line (edit), type);
if (r == -1) {
diff --git a/edit/usermap.c b/edit/usermap.c
index e30c011..bb8e0db 100644
--- a/edit/usermap.c
+++ b/edit/usermap.c
@@ -599,7 +599,7 @@ edit_load_user_map(WEdit *edit)
if (edit_key_emulation != EDIT_KEY_EMULATION_USER)
return TRUE;
- file = mhl_str_dir_plus_file(home_dir, MC_USERMAP);
+ file = concat_dir_and_file(home_dir, MC_USERMAP);
if (stat(file, &s) < 0) {
char *msg = g_strdup_printf(_("%s not found!"), file);
diff --git a/src/charsets.c b/src/charsets.c
index f2e69e0..10bbefc 100644
--- a/src/charsets.c
+++ b/src/charsets.c
@@ -50,7 +50,7 @@ load_codepages_list (void)
extern int display_codepage;
char *default_codepage = NULL;
- fname = mhl_str_dir_plus_file (mc_home, CHARSETS_INDEX);
+ fname = concat_dir_and_file (mc_home, CHARSETS_INDEX);
if (!(f = fopen (fname, "r"))) {
fprintf (stderr, _("Warning: file %s not found\n"), fname);
g_free (fname);
diff --git a/src/cmd.c b/src/cmd.c
index 0bab86e..048037d 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -374,7 +374,7 @@ mkdir_cmd (void)
if (dir[0] == '/' || dir[0] == '~')
absdir = g_strdup (dir);
else
- absdir = mhl_str_dir_plus_file (current_panel->cwd, dir);
+ absdir = concat_dir_and_file (current_panel->cwd, dir);
save_cwds_stat ();
if (my_mkdir (absdir, 0777) == 0) {
@@ -580,10 +580,10 @@ void ext_cmd (void)
_(" Which extension file you want to edit? "), D_NORMAL, 2,
_("&User"), _("&System Wide"));
}
- extdir = mhl_str_dir_plus_file (mc_home, MC_LIB_EXT);
+ extdir = concat_dir_and_file (mc_home, MC_LIB_EXT);
if (dir == 0){
- buffer = mhl_str_dir_plus_file (home_dir, MC_USER_EXT);
+ buffer = concat_dir_and_file (home_dir, MC_USER_EXT);
check_for_default (extdir, buffer);
do_edit (buffer);
g_free (buffer);
@@ -610,7 +610,7 @@ menu_edit_cmd (int where)
_("&Local"), _("&User"), _("&System Wide")
);
- menufile = mhl_str_dir_plus_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
+ menufile = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
switch (dir) {
case 0:
@@ -619,12 +619,12 @@ menu_edit_cmd (int where)
break;
case 1:
- buffer = mhl_str_dir_plus_file (home_dir, where ? CEDIT_HOME_MENU : MC_HOME_MENU);
+ buffer = concat_dir_and_file (home_dir, where ? CEDIT_HOME_MENU : MC_HOME_MENU);
check_for_default (menufile, buffer);
break;
case 2:
- buffer = mhl_str_dir_plus_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
+ buffer = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
break;
default:
@@ -683,10 +683,10 @@ edit_syntax_cmd (void)
_(" Which syntax file you want to edit? "), D_NORMAL, 2,
_("&User"), _("&System Wide"));
}
- extdir = mhl_str_dir_plus_file (mc_home, "syntax" PATH_SEP_STR "Syntax");
+ extdir = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax");
if (dir == 0) {
- buffer = mhl_str_dir_plus_file (home_dir, SYNTAX_FILE);
+ buffer = concat_dir_and_file (home_dir, SYNTAX_FILE);
check_for_default (extdir, buffer);
do_edit (buffer);
g_free (buffer);
@@ -817,8 +817,8 @@ compare_dir (WPanel *panel, WPanel *other, enum CompareMode mode)
}
/* Thorough compare on, do byte-by-byte comparison */
- src_name = mhl_str_dir_plus_file (panel->cwd, source->fname);
- dst_name = mhl_str_dir_plus_file (other->cwd, target->fname);
+ src_name = concat_dir_and_file (panel->cwd, source->fname);
+ dst_name = concat_dir_and_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);
@@ -932,10 +932,10 @@ do_link (int symbolic_link, const char *fname)
char *d;
/* suggest the full path for symlink */
- s = mhl_str_dir_plus_file (current_panel->cwd, fname);
+ s = concat_dir_and_file (current_panel->cwd, fname);
if (get_other_type () == view_listing) {
- d = mhl_str_dir_plus_file (other_panel->cwd, fname);
+ d = concat_dir_and_file (other_panel->cwd, fname);
} else {
d = g_strdup (fname);
}
diff --git a/src/command.c b/src/command.c
index 07f66dc..a21da8c 100644
--- a/src/command.c
+++ b/src/command.c
@@ -67,7 +67,7 @@ examine_cd (char *path)
const char *t;
/* Tilde expansion */
- path = mhl_shell_unescape_buf(path);
+ path = shell_unescape(path);
path_tilde = tilde_expand (path);
/* Leave space for further expansion */
@@ -128,7 +128,7 @@ examine_cd (char *path)
c = *s;
*s = 0;
if (*p) {
- r = mhl_str_dir_plus_file (p, q);
+ r = concat_dir_and_file (p, q);
result = do_cd (r, cd_parse_command);
g_free (r);
}
@@ -180,7 +180,7 @@ void do_cd_command (char *cmd)
} else {
char *old = current_panel->cwd;
char *new;
- new = mhl_str_dir_plus_file (old, cmd+3);
+ new = concat_dir_and_file (old, cmd+3);
sync_tree (new);
g_free (new);
}
diff --git a/src/complete.c b/src/complete.c
index 6a7b19d..44858c3 100644
--- a/src/complete.c
+++ b/src/complete.c
@@ -86,7 +86,7 @@ filename_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
SHOW_C_CTX("filename_completion_function");
if (text && (flags & INPUT_COMPLETE_SHELL_ESC))
- text = mhl_shell_unescape_buf (text);
+ text = shell_unescape (text);
/* If we're starting the match process, initialize us a bit. */
if (!state){
@@ -206,7 +206,7 @@ filename_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
if (temp && (flags & INPUT_COMPLETE_SHELL_ESC))
{
- temp = mhl_shell_escape_dup(temp);
+ temp = shell_escape(temp);
}
return temp;
}
@@ -461,7 +461,7 @@ command_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
if (!(flags & INPUT_COMPLETE_COMMANDS))
return 0;
- text = mhl_shell_unescape_buf(text);
+ text = shell_unescape(text);
flags &= ~INPUT_COMPLETE_SHELL_ESC;
if (!state) { /* Initialize us a little bit */
@@ -484,7 +484,7 @@ command_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
p = filename_completion_function (text, state, flags);
if (!p)
return 0;
- p = mhl_shell_escape_dup(p);
+ p = shell_escape(p);
return p;
}
@@ -517,7 +517,7 @@ command_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
if (cur_path >= path_end)
break;
expanded = tilde_expand (*cur_path ? cur_path : ".");
- cur_word = mhl_str_dir_plus_file (expanded, text);
+ cur_word = concat_dir_and_file (expanded, text);
g_free (expanded);
canonicalize_pathname (cur_word);
cur_path = strchr (cur_path, 0) + 1;
@@ -540,7 +540,7 @@ command_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
}
if ((p = strrchr (found, PATH_SEP)) != NULL) {
p++;
- p = mhl_shell_escape_dup(p);
+ p = shell_escape(p);
g_free(found);
return p;
}
@@ -811,7 +811,7 @@ try_complete (char *text, int *start, int *end, INPUT_COMPLETE_FLAGS flags)
c = *s;
*s = 0;
if (*cdpath){
- r = mhl_str_dir_plus_file (cdpath, word);
+ r = concat_dir_and_file (cdpath, word);
SHOW_C_CTX("try_complete:filename_subst_2");
matches = completion_matches (r, filename_completion_function, flags);
g_free (r);
diff --git a/src/cons.handler.c b/src/cons.handler.c
index 1fe35b0..b08c266 100644
--- a/src/cons.handler.c
+++ b/src/cons.handler.c
@@ -28,8 +28,6 @@
#endif
#include <unistd.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "cons.saver.h"
@@ -145,7 +143,7 @@ handle_console_linux (unsigned char action)
open ("/dev/null", O_WRONLY);
if (tty_name) {
/* Exec the console save/restore handler */
- mc_conssaver = mhl_str_dir_plus_file (SAVERDIR, "cons.saver");
+ mc_conssaver = concat_dir_and_file (SAVERDIR, "cons.saver");
execl (mc_conssaver, "cons.saver", tty_name, (char *) NULL);
}
/* Console is not a tty or execl() failed */
diff --git a/src/cons.saver.c b/src/cons.saver.c
index 7086cd6..ccd0647 100644
--- a/src/cons.saver.c
+++ b/src/cons.saver.c
@@ -53,8 +53,6 @@
#endif
#include <unistd.h>
-#include <mhl/string.h>
-
#define LINUX_CONS_SAVER_C
#include "cons.saver.h"
diff --git a/src/ext.c b/src/ext.c
index 8d7abef..827e8a2 100644
--- a/src/ext.c
+++ b/src/ext.c
@@ -442,11 +442,11 @@ regex_command (const char *filename, const char *action, int *move_dir)
int mc_user_ext = 1;
int home_error = 0;
- extension_file = mhl_str_dir_plus_file (home_dir, MC_USER_EXT);
+ extension_file = concat_dir_and_file (home_dir, MC_USER_EXT);
if (!exist_file (extension_file)) {
g_free (extension_file);
check_stock_mc_ext:
- extension_file = mhl_str_dir_plus_file (mc_home, MC_LIB_EXT);
+ extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT);
mc_user_ext = 0;
}
data = load_file (extension_file);
diff --git a/src/file.c b/src/file.c
index 4ef043c..dd0e8f1 100644
--- a/src/file.c
+++ b/src/file.c
@@ -181,7 +181,7 @@ do_transform_source (FileOpContext *ctx, const char *source)
for (next_reg = 1, j = 0, k = 0; j < strlen (ctx->dest_mask); j++) {
switch (ctx->dest_mask[j]) {
case '\\':
- if (mhl_shell_is_char_escaped (&ctx->dest_mask[j])){
+ if (shell_is_char_escaped (&ctx->dest_mask[j])){
fntarget[k++] = ctx->dest_mask[j++];
fntarget[k++] = ctx->dest_mask[j];
break;
@@ -922,7 +922,7 @@ copy_dir_dir (FileOpContext *ctx, const char *s, const char *d, int toplevel,
}
/* Dive into subdir if exists */
if (toplevel && ctx->dive_into_subdirs) {
- dest_dir = mhl_str_dir_plus_file (d, x_basename (s));
+ dest_dir = concat_dir_and_file (d, x_basename (s));
} else {
dest_dir = g_strdup (d);
goto dont_mkdir;
@@ -968,11 +968,11 @@ copy_dir_dir (FileOpContext *ctx, const char *s, const char *d, int toplevel,
continue;
/* get the filename and add it to the src directory */
- path = mhl_str_dir_plus_file (s, next->d_name);
+ path = concat_dir_and_file (s, next->d_name);
(*ctx->stat_func) (path, &buf);
if (S_ISDIR (buf.st_mode)) {
- mdpath = mhl_str_dir_plus_file (dest_dir, next->d_name);
+ mdpath = concat_dir_and_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
@@ -983,7 +983,7 @@ copy_dir_dir (FileOpContext *ctx, const char *s, const char *d, int toplevel,
parent_dirs, progress_count, progress_bytes);
g_free (mdpath);
} else {
- dest_file = mhl_str_dir_plus_file (dest_dir, x_basename (path));
+ dest_file = concat_dir_and_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);
@@ -1173,7 +1173,7 @@ move_dir_dir (FileOpContext *ctx, const char *s, const char *d,
destdir = g_strdup (d);
move_over = 1;
} else
- destdir = mhl_str_dir_plus_file (d, x_basename (s));
+ destdir = concat_dir_and_file (d, x_basename (s));
if (sbuf.st_dev == dbuf.st_dev && sbuf.st_ino == dbuf.st_ino) {
int msize = COLS - 36;
@@ -1330,7 +1330,7 @@ recursive_erase (FileOpContext *ctx, const char *s, off_t *progress_count,
continue;
if (!strcmp (next->d_name, ".."))
continue;
- path = mhl_str_dir_plus_file (s, next->d_name);
+ path = concat_dir_and_file (s, next->d_name);
if (mc_lstat (path, &buf)) {
g_free (path);
mc_closedir (reading);
@@ -1521,7 +1521,7 @@ compute_dir_size (const char *dirname, off_t *ret_marked, double *ret_total)
if (strcmp (dirent->d_name, "..") == 0)
continue;
- fullname = mhl_str_dir_plus_file (dirname, dirent->d_name);
+ fullname = concat_dir_and_file (dirname, dirent->d_name);
res = mc_lstat (fullname, &s);
@@ -1578,7 +1578,7 @@ panel_compute_totals (WPanel *panel, off_t *ret_marked, double *ret_total)
double subdir_bytes = 0;
dir_name =
- mhl_str_dir_plus_file (panel->cwd, panel->dir.list[i].fname);
+ concat_dir_and_file (panel->cwd, panel->dir.list[i].fname);
compute_dir_size (dir_name, &subdir_count, &subdir_bytes);
*ret_marked += subdir_count;
@@ -1886,7 +1886,7 @@ panel_operate (void *source_panel, FileOperation operation,
/* The source and src_stat variables have been initialized before */
#ifdef WITH_FULL_PATHS
- source_with_path = mhl_str_dir_plus_file (panel->cwd, source);
+ source_with_path = concat_dir_and_file (panel->cwd, source);
#endif /* WITH_FULL_PATHS */
if (operation == OP_DELETE) {
@@ -1901,7 +1901,7 @@ panel_operate (void *source_panel, FileOperation operation,
if (temp == NULL) {
value = transform_error;
} else {
- char *temp2 = mhl_str_dir_plus_file (dest, temp);
+ char *temp2 = concat_dir_and_file (dest, temp);
g_free (dest);
dest = temp2;
temp = NULL;
@@ -1979,7 +1979,7 @@ panel_operate (void *source_panel, FileOperation operation,
#ifdef WITH_FULL_PATHS
g_free (source_with_path);
- source_with_path = mhl_str_dir_plus_file (panel->cwd, source);
+ source_with_path = concat_dir_and_file (panel->cwd, source);
#endif /* WITH_FULL_PATHS */
if (operation == OP_DELETE) {
@@ -1995,10 +1995,10 @@ panel_operate (void *source_panel, FileOperation operation,
if (temp == NULL)
value = transform_error;
else {
- char *temp2 = mhl_str_dir_plus_file (dest, temp);
+ char *temp2 = concat_dir_and_file (dest, temp);
- source_with_path = mhl_shell_unescape_buf(source_with_path);
- temp2 = mhl_shell_unescape_buf(temp2);
+ source_with_path = shell_unescape(source_with_path);
+ temp2 = shell_unescape(temp2);
switch (operation) {
case OP_COPY:
diff --git a/src/filenot.c b/src/filenot.c
index c1fcffa..c83c7d8 100644
--- a/src/filenot.c
+++ b/src/filenot.c
@@ -40,7 +40,7 @@ get_absolute_name (const char *file)
if (file[0] == PATH_SEP)
return g_strdup (file);
mc_get_current_wd (dir, MC_MAXPATHLEN);
- return mhl_str_dir_plus_file (dir, file);
+ return concat_dir_and_file (dir, file);
}
static int
@@ -63,7 +63,7 @@ my_mkdir_rec (char *s, mode_t mode)
return -1;
}
- p = mhl_str_dir_plus_file (s, "..");
+ p = concat_dir_and_file (s, "..");
q = vfs_canon (p);
g_free (p);
diff --git a/src/find.c b/src/find.c
index 517a219..48c73a2 100644
--- a/src/find.c
+++ b/src/find.c
@@ -357,7 +357,7 @@ push_directory (const char *dir)
dir_stack *new;
new = g_new (dir_stack, 1);
- new->name = mhl_str_dir_plus_file (dir, NULL);
+ new->name = concat_dir_and_file (dir, "");
new->prev = dir_stack_base;
dir_stack_base = new;
}
@@ -519,7 +519,7 @@ search_content (Dlg_head *h, const char *directory, const char *filename)
int file_fd;
int ret_val = 0;
- fname = mhl_str_dir_plus_file (directory, filename);
+ fname = concat_dir_and_file (directory, filename);
if (mc_stat (fname, &s) != 0 || !S_ISREG (s.st_mode)){
g_free (fname);
@@ -695,7 +695,7 @@ do_search (struct Dlg_head *h)
}
if (subdirs_left && find_recursively && directory) { /* Can directory be NULL ? */
- char *tmp_name = mhl_str_dir_plus_file (directory, dp->d_name);
+ char *tmp_name = concat_dir_and_file (directory, dp->d_name);
if (!mc_lstat (tmp_name, &tmp_stat)
&& S_ISDIR (tmp_stat.st_mode)) {
push_directory (tmp_name);
@@ -755,8 +755,8 @@ make_fullname (const char *dirname, const char *filename)
if (strcmp(dirname, ".") == 0 || strcmp(dirname, "."PATH_SEP_STR) == 0)
return g_strdup (filename);
if (strncmp(dirname, "."PATH_SEP_STR, 2) == 0)
- return mhl_str_dir_plus_file (dirname + 2, filename);
- return mhl_str_dir_plus_file (dirname, filename);
+ return concat_dir_and_file (dirname + 2, filename);
+ return concat_dir_and_file (dirname, filename);
}
static void
diff --git a/src/hotlist.c b/src/hotlist.c
index ee8f3bd..28b94cf 100644
--- a/src/hotlist.c
+++ b/src/hotlist.c
@@ -1449,7 +1449,7 @@ load_hotlist (void)
}
if (!hotlist_file_name)
- hotlist_file_name = mhl_str_dir_plus_file (home_dir, HOTLIST_FILENAME);
+ hotlist_file_name = concat_dir_and_file (home_dir, HOTLIST_FILENAME);
hotlist = new_hotlist ();
hotlist->type = HL_TYPE_GROUP;
diff --git a/src/main.c b/src/main.c
index 367663a..5bdc7e9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1138,7 +1138,7 @@ copy_readlink (WPanel *panel)
if (S_ISLNK (selection (panel)->st.st_mode)) {
char buffer[MC_MAXPATHLEN];
char *p =
- mhl_str_dir_plus_file (panel->cwd, selection (panel)->fname);
+ concat_dir_and_file (panel->cwd, selection (panel)->fname);
int i;
i = mc_readlink (p, buffer, MC_MAXPATHLEN - 1);
diff --git a/src/screen.c b/src/screen.c
index 9810287..6321720 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -711,7 +711,7 @@ display_mini_info (WPanel *panel)
char *link, link_target [MC_MAXPATHLEN];
int len;
- link = mhl_str_dir_plus_file (panel->cwd, panel->dir.list [panel->selected].fname);
+ link = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname);
len = mc_readlink (link, link_target, MC_MAXPATHLEN - 1);
g_free (link);
if (len > 0){
@@ -1976,7 +1976,7 @@ do_enter_on_file_entry (file_entry *fe)
return 1;
/* Check if the file is executable */
- full_name = mhl_str_dir_plus_file (current_panel->cwd, fe->fname);
+ full_name = concat_dir_and_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;
@@ -1995,7 +1995,7 @@ do_enter_on_file_entry (file_entry *fe)
char *tmp;
int ret;
- tmp = mhl_str_dir_plus_file (vfs_get_current_dir (), fe->fname);
+ tmp = concat_dir_and_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
@@ -2032,10 +2032,10 @@ chdir_other_panel (WPanel *panel)
}
if (!S_ISDIR (panel->dir.list [panel->selected].st.st_mode)) {
- new_dir = mhl_str_dir_plus_file (panel->cwd, "..");
+ new_dir = concat_dir_and_file (panel->cwd, "..");
sel_entry = strrchr(panel->cwd, PATH_SEP);
} else
- new_dir = mhl_str_dir_plus_file (panel->cwd, panel->dir.list [panel->selected].fname);
+ new_dir = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname);
change_panel ();
do_cd (new_dir, cd_exact);
@@ -2101,7 +2101,7 @@ chdir_to_readlink (WPanel *panel)
if (*buffer == PATH_SEP)
new_dir = g_strdup (buffer);
else
- new_dir = mhl_str_dir_plus_file (panel->cwd, buffer);
+ new_dir = concat_dir_and_file (panel->cwd, buffer);
change_panel ();
do_cd (new_dir, cd_exact);
diff --git a/src/setup.c b/src/setup.c
index 8e6ae1d..d434996 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -286,7 +286,7 @@ save_layout (void)
int i;
char buffer [BUF_TINY];
- profile = mhl_str_dir_plus_file (home_dir, PROFILE_NAME);
+ profile = concat_dir_and_file (home_dir, PROFILE_NAME);
/* Save integer options */
for (i = 0; layout [i].opt_name; i++){
@@ -303,7 +303,7 @@ save_configure (void)
char *profile;
int i;
- profile = mhl_str_dir_plus_file (home_dir, PROFILE_NAME);
+ profile = concat_dir_and_file (home_dir, PROFILE_NAME);
/* Save integer options */
for (i = 0; int_options[i].opt_name; i++)
@@ -351,7 +351,7 @@ save_setup (void)
char *profile;
saving_setup = 1;
- profile = mhl_str_dir_plus_file (home_dir, PROFILE_NAME);
+ profile = concat_dir_and_file (home_dir, PROFILE_NAME);
save_configure ();
@@ -486,9 +486,9 @@ setup_init (void)
if (profile_name)
return profile_name;
- profile = mhl_str_dir_plus_file (home_dir, PROFILE_NAME);
+ profile = concat_dir_and_file (home_dir, PROFILE_NAME);
if (!exist_file (profile)){
- inifile = mhl_str_dir_plus_file (mc_home, "mc.ini");
+ inifile = concat_dir_and_file (mc_home, "mc.ini");
if (exist_file (inifile)){
g_free (profile);
profile = inifile;
@@ -511,7 +511,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 = mhl_str_dir_plus_file (mc_home, "mc.lib");
+ global_profile_name = concat_dir_and_file (mc_home, "mc.lib");
/* Load integer boolean options */
for (i = 0; int_options[i].opt_name; i++)
diff --git a/src/treestore.c b/src/treestore.c
index 91cfb1e..f492d9f 100644
--- a/src/treestore.c
+++ b/src/treestore.c
@@ -268,7 +268,7 @@ tree_store_load(void)
char *name;
int retval;
- name = mhl_str_dir_plus_file(home_dir, MC_TREE);
+ name = concat_dir_and_file(home_dir, MC_TREE);
retval = tree_store_load_from(name);
g_free(name);
@@ -374,7 +374,7 @@ tree_store_save(void)
char *name;
int retval;
- tmp = mhl_str_dir_plus_file(home_dir, MC_TREE_TMP);
+ tmp = concat_dir_and_file(home_dir, MC_TREE_TMP);
retval = tree_store_save_to(tmp);
if (retval) {
@@ -382,7 +382,7 @@ tree_store_save(void)
return retval;
}
- name = mhl_str_dir_plus_file(home_dir, MC_TREE);
+ name = concat_dir_and_file(home_dir, MC_TREE);
retval = rename(tmp, name);
g_free(tmp);
@@ -608,7 +608,7 @@ tree_store_mark_checked(const char *subname)
if (ts.check_name[0] == PATH_SEP && ts.check_name[1] == 0)
name = g_strconcat(PATH_SEP_STR, subname, (char *) NULL);
else
- name = mhl_str_dir_plus_file(ts.check_name, subname);
+ name = concat_dir_and_file(ts.check_name, subname);
/* Search for the subdirectory */
current = ts.check_start;
@@ -798,7 +798,7 @@ tree_store_rescan(const char *dir)
continue;
}
- full_name = mhl_str_dir_plus_file(dir, dp->d_name);
+ full_name = concat_dir_and_file(dir, dp->d_name);
if (mc_lstat(full_name, &buf) != -1) {
if (S_ISDIR(buf.st_mode))
tree_store_mark_checked(dp->d_name);
diff --git a/src/user.c b/src/user.c
index 14e3d69..f3881cd 100644
--- a/src/user.c
+++ b/src/user.c
@@ -724,11 +724,11 @@ user_menu_cmd (struct WEdit *edit_widget)
menu = g_strdup (edit_widget ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU);
if (!exist_file (menu) || !menu_file_own (menu)){
g_free (menu);
- menu = mhl_str_dir_plus_file \
+ menu = concat_dir_and_file \
(home_dir, edit_widget ? CEDIT_HOME_MENU : MC_HOME_MENU);
if (!exist_file (menu)){
g_free (menu);
- menu = mhl_str_dir_plus_file \
+ menu = concat_dir_and_file \
(mc_home, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
}
}
diff --git a/src/util.c b/src/util.c
index 3b8d934..22c172a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -694,7 +694,7 @@ load_mc_home_file (const char *filename, char **allocated_filename)
char *lang;
char *data;
- hintfile_base = mhl_str_dir_plus_file (mc_home, filename);
+ hintfile_base = concat_dir_and_file (mc_home, filename);
lang = guess_message_value ();
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
@@ -1253,6 +1253,18 @@ diff_two_paths (const char *first, const char *second)
return buf;
}
+/* If filename is NULL, then we just append PATH_SEP to the dir */
+char *
+concat_dir_and_file (const char *dir, const char *file)
+{
+ int i = strlen (dir);
+
+ if (dir [i-1] == PATH_SEP)
+ return g_strconcat (dir, file, (char *) NULL);
+ else
+ return g_strconcat (dir, PATH_SEP_STR, file, (char *) NULL);
+}
+
/* Append text to GList, remove all entries with the same text */
GList *
list_append_unique (GList *list, char *text)
@@ -1313,7 +1325,7 @@ mc_mkstemps (char **pname, const char *prefix, const char *suffix)
if (strchr (prefix, PATH_SEP) == NULL) {
/* Add prefix first to find the position of XXXXXX */
- tmpbase = mhl_str_dir_plus_file (mc_tmpdir (), prefix);
+ tmpbase = concat_dir_and_file (mc_tmpdir (), prefix);
} else {
tmpbase = g_strdup (prefix);
}
@@ -1381,7 +1393,7 @@ load_file_position (const char *filename, long *line, long *column)
*column = 0;
/* open file with positions */
- fn = mhl_str_dir_plus_file (home_dir, MC_FILEPOS);
+ fn = concat_dir_and_file (home_dir, MC_FILEPOS);
f = fopen (fn, "r");
g_free (fn);
if (!f)
@@ -1428,8 +1440,8 @@ save_file_position (const char *filename, long line, long column)
len = strlen (filename);
- tmp = mhl_str_dir_plus_file (home_dir, MC_FILEPOS_TMP);
- fn = mhl_str_dir_plus_file (home_dir, MC_FILEPOS);
+ tmp = concat_dir_and_file (home_dir, MC_FILEPOS_TMP);
+ fn = concat_dir_and_file (home_dir, MC_FILEPOS);
/* open temporary file */
t = fopen (tmp, "w");
@@ -1522,3 +1534,179 @@ Q_ (const char *s)
sep = strchr(result, '|');
return (sep != NULL) ? sep + 1 : result;
}
+
+/*TODO: These three functions should use glib and should be fixed soon */
+
+#define shell_escape_toesc(x) \
+ (((x)==' ')||((x)=='!')||((x)=='#')||((x)=='$')||((x)=='%')|| \
+ ((x)=='(')||((x)==')')||((x)=='\'')||((x)=='&')||((x)=='~')|| \
+ ((x)=='{')||((x)=='}')||((x)=='[')||((x)==']')||((x)=='`')|| \
+ ((x)=='?')||((x)=='|')||((x)=='<')||((x)=='>')||((x)==';')|| \
+ ((x)=='*')||((x)=='\\')||((x)=='"'))
+
+#define shell_escape_nottoesc(x) \
+ (((x)!=0) && (!shell_escape_toesc((x))))
+
+/** To be compatible with the general posix command lines we have to escape
+ strings for the command line
+
+ /params const char * in
+ string for escaping
+ /returns
+ return escaped string (later need to free)
+ */
+static char* shell_escape(const char* src)
+{
+ if ((src==NULL)||(!(*src)))
+ return strdup("");
+
+ char* buffer = calloc(1, strlen(src)*2+2);
+ char* ptr = buffer;
+
+ /* look for the first char to escape */
+ while (1)
+ {
+ char c;
+ /* copy over all chars not to escape */
+ while ((c=(*src)) && shell_escape_nottoesc(c))
+ {
+ *ptr = c;
+ ptr++;
+ src++;
+ }
+
+ /* at this point we either have an \0 or an char to escape */
+ if (!c)
+ return buffer;
+
+ *ptr = '\\';
+ ptr++;
+ *ptr = c;
+ ptr++;
+ src++;
+ }
+}
+
+/** Unescape paths or other strings for e.g the internal cd
+ shell-unescape within a given buffer (writing to it!)
+
+ /params const char * src
+ string for unescaping
+ /returns
+ return unescaped string
+ */
+static char* shell_unescape(char* text)
+{
+ if (!text)
+ return NULL;
+
+ /* look for the first \ - that's quick skipover if there's nothing to escape */
+ char* readptr = text;
+ while ((*readptr) && ((*readptr)!='\\')) readptr++;
+ if (!(*readptr)) return text;
+
+ /* if we're here, we're standing on the first '\' */
+ char* writeptr = readptr;
+ char c;
+ while ((c = *readptr))
+ {
+ if (c=='\\')
+ {
+ readptr++;
+ switch ((c = *readptr))
+ {
+ case 'n': (*writeptr) = '\n'; writeptr++; break;
+ case 'r': (*writeptr) = '\r'; writeptr++; break;
+ case 't': (*writeptr) = '\t'; writeptr++; break;
+
+ case ' ':
+ case '\\':
+ case '#':
+ case '$':
+ case '%':
+ case '(':
+ case ')':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ case '<':
+ case '>':
+ case '!':
+ case '*':
+ case '?':
+ case '~':
+ case '`':
+ case '"':
+ case ';':
+ case '\0': /* end of string! malformed escape string */
+ goto out;
+ default:
+ (*writeptr) = c; writeptr++; break;
+ }
+ }
+ else /* got a normal character */
+ {
+ (*writeptr) = *readptr;
+ writeptr++;
+ }
+ readptr++;
+ }
+out:
+ *writeptr = 0;
+
+ return text;
+}
+
+/** Check if char in pointer contain escape'd chars
+
+ /params const char * in
+ string for checking
+ /returns
+ return TRUE if string contain escaped chars
+ otherwise return FALSE
+ */
+static gboolean
+ shell_is_char_escaped ( const char *in )
+{
+ if (in == NULL || !*in || in[0] != '\\')
+ return false;
+ if (shell_escape_toesc(in[1]))
+ return TRUE;
+ return FALSE;
+}
+
+/*FIXME: move back to concat_dir_and_file */
+static char* str_dir_plus_file(const char* dirname, const char* filename)
+{
+ /* make sure we have valid strings */
+ if (!dirname)
+ dirname="";
+
+ if (!filename)
+ filename="";
+
+ /* skip leading slashes on filename */
+ while (*filename == '/')
+ filename++;
+
+ /* skip trailing slashes on dirname */
+ size_t dnlen = strlen(dirname);
+ while ((dnlen != 0) && (dirname[dnlen-1]=='/'))
+ dnlen--;
+
+ size_t fnlen = strlen(filename);
+ /*TODO: was previously calloc(1,dnlen+fnlen+2) - please review*/
+ char* buffer = g_malloc(dnlen+fnlen+2); /* enough space for dirname, /, filename, zero */
+ char* ptr = buffer;
+
+ memcpy(ptr, dirname, dnlen);
+ ptr+=dnlen;
+ *ptr = '/';
+ ptr++;
+ memcpy(ptr, filename, fnlen);
+ ptr+=fnlen;
+ *ptr = 0;
+
+ return buffer;
+}
\ No newline at end of file
diff --git a/src/util.h b/src/util.h
index 86009f0..f681566 100644
--- a/src/util.h
+++ b/src/util.h
@@ -66,6 +66,7 @@ char *strip_password (char *path, int has_prefix);
const char *strip_home_and_password (const char *dir);
const char *extension (const char *);
+char *concat_dir_and_file (const char *dir, const char *file);
const char *unix_error_string (int error_num);
const char *skip_separators (const char *s);
const char *skip_numbers (const char *s);
diff --git a/src/widget.c b/src/widget.c
index 3b209ad..3896be2 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -868,7 +868,7 @@ history_get (const char *input_name)
return NULL;
if (!*input_name)
return NULL;
- profile = mhl_str_dir_plus_file (home_dir, HISTORY_FILE_NAME);
+ profile = concat_dir_and_file (home_dir, HISTORY_FILE_NAME);
for (i = 0;; i++) {
char key_name[BUF_TINY];
char this_entry[BUF_LARGE];
@@ -906,7 +906,7 @@ history_put (const char *input_name, GList *h)
if (!num_history_items_recorded) /* this is how to disable */
return;
- profile = mhl_str_dir_plus_file (home_dir, HISTORY_FILE_NAME);
+ profile = concat_dir_and_file (home_dir, HISTORY_FILE_NAME);
if ((i = open (profile, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) != -1)
close (i);
diff --git a/vfs/extfs.c b/vfs/extfs.c
index ded60e1..d0de1bd 100644
--- a/vfs/extfs.c
+++ b/vfs/extfs.c
@@ -250,7 +250,7 @@ extfs_open_archive (int fstype, const char *name, struct archive **pparc)
tmp = name_quote (name, 0);
}
- mc_extfsdir = mhl_str_dir_plus_file (mc_home, "extfs" PATH_SEP_STR);
+ mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR);
cmd =
g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ",
local_name ? local_name : tmp, (char *) NULL);
@@ -625,7 +625,7 @@ extfs_cmd (const char *extfs_cmd, struct archive *archive,
archive_name = name_quote (extfs_get_archive_name (archive), 0);
quoted_localname = name_quote (localname, 0);
- mc_extfsdir = mhl_str_dir_plus_file (mc_home, "extfs" PATH_SEP_STR);
+ mc_extfsdir = concat_dir_and_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);
@@ -654,7 +654,7 @@ extfs_run (struct vfs_class *me, const char *file)
g_free (p);
archive_name = name_quote (extfs_get_archive_name (archive), 0);
- mc_extfsdir = mhl_str_dir_plus_file (mc_home, "extfs" PATH_SEP_STR);
+ mc_extfsdir = concat_dir_and_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);
@@ -1299,7 +1299,7 @@ static int extfs_init (struct vfs_class *me)
(void) me;
- mc_extfsini = mhl_str_dir_plus_file (mc_home, "extfs" PATH_SEP_STR "extfs.ini");
+ mc_extfsini = concat_dir_and_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 --git a/vfs/fish.c b/vfs/fish.c
index 2e59c8b..0aa4e5b 100644
--- a/vfs/fish.c
+++ b/vfs/fish.c
@@ -386,7 +386,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
gettimeofday(&dir->timestamp, NULL);
dir->timestamp.tv_sec += fish_directory_timeout;
- quoted_path = mhl_shell_escape_dup (remote_path);
+ quoted_path = shell_escape (remote_path);
fish_command (me, super, NONE,
"#LIST /%s\n"
"if `perl -v > /dev/null 2>&1` ; then\n"
@@ -525,10 +525,10 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
}
ent->name = mhl_str_dup_range(filename, filename_bound);
- mhl_shell_unescape_buf(ent->name);
+ shell_unescape(ent->name);
ent->ino->linkname = mhl_str_dup_range(linkname, linkname_bound);
- mhl_shell_unescape_buf(ent->ino->linkname);
+ shell_unescape(ent->ino->linkname);
} else {
// we expect: "escaped-name"
if (filename_bound - filename > 2)
@@ -542,7 +542,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
}
ent->name = mhl_str_dup_range(filename, filename_bound);
- mhl_shell_unescape_buf(ent->name);
+ shell_unescape(ent->name);
}
break;
}
@@ -658,7 +658,7 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc
* algorithm for file appending case, therefore just "dd" is used for it.
*/
- quoted_name = mhl_shell_escape_dup(name);
+ quoted_name = shell_escape(name);
print_vfs_message(_("fish: store %s: sending command..."), quoted_name );
/* FIXME: File size is limited to ULONG_MAX */
@@ -756,7 +756,7 @@ fish_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset)
name = vfs_s_fullpath (me, fh->ino);
if (!name)
return 0;
- quoted_name = mhl_shell_escape_dup(name);
+ quoted_name = shell_escape(name);
fh->u.fish.append = 0;
/*
@@ -895,7 +895,7 @@ fish_send_command(struct vfs_class *me, struct vfs_s_super *super, const char *c
g_free (mpath); \
return -1; \
} \
- rpath = mhl_shell_escape_dup(crpath); \
+ rpath = shell_escape(crpath); \
g_free (mpath);
#define POSTFIX(flags) \
@@ -929,9 +929,9 @@ static int fish_##name (struct vfs_class *me, const char *path1, const char *pat
g_free (mpath1); \
g_free (mpath2); \
} \
- rpath1 = mhl_shell_escape_dup (crpath1); \
+ rpath1 = shell_escape (crpath1); \
g_free (mpath1); \
- rpath2 = mhl_shell_escape_dup (crpath2); \
+ rpath2 = shell_escape (crpath2); \
g_free (mpath2); \
g_snprintf(buf, sizeof(buf), string "\n", rpath1, rpath2, rpath1, rpath2); \
g_free (rpath1); \
@@ -950,7 +950,7 @@ static int fish_symlink (struct vfs_class *me, const char *setto, const char *pa
{
char *qsetto;
PREFIX
- qsetto = mhl_shell_escape_dup (setto);
+ qsetto = shell_escape (setto);
g_snprintf(buf, sizeof(buf),
"#SYMLINK %s /%s\n"
"ln -s %s /%s 2>/dev/null\n"
diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c
index f1d9f75..0c475fa 100644
--- a/vfs/ftpfs.c
+++ b/vfs/ftpfs.c
@@ -44,7 +44,7 @@ What to do with this?
int f = !strcmp( remote_path, "/~" );
if (f || !strncmp( remote_path, "/~/", 3 )) {
char *s;
- s = mhl_str_dir_plus_file( qhome (*bucket), remote_path +3-f );
+ s = concat_dir_and_file( qhome (*bucket), remote_path +3-f );
g_free (remote_path);
remote_path = s;
}
@@ -558,7 +558,7 @@ ftpfs_load_no_proxy_list (void)
if (mc_file)
return;
- mc_file = mhl_str_dir_plus_file (mc_home, "mc.no_proxy");
+ mc_file = concat_dir_and_file (mc_home, "mc.no_proxy");
if (exist_file (mc_file) &&
(npf = fopen (mc_file, "r"))) {
while (fgets (s, sizeof (s), npf)) {
@@ -1233,7 +1233,7 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
ftpfs_open_data_connection (me, super, "LIST -la", 0, TYPE_ASCII, 0);
else {
/* Trailing "/." is necessary if remote_path is a symlink */
- char *path = mhl_str_dir_plus_file (remote_path, ".");
+ char *path = concat_dir_and_file (remote_path, ".");
sock =
ftpfs_open_data_connection (me, super, "LIST -la", path, TYPE_ASCII,
0);
@@ -1889,7 +1889,7 @@ static int ftpfs_netrc_lookup (const char *host, char **login, char **pass)
}
/* Load current .netrc */
- netrcname = mhl_str_dir_plus_file (home_dir, ".netrc");
+ netrcname = concat_dir_and_file (home_dir, ".netrc");
netrcp = netrc = load_file (netrcname);
if (netrc == NULL) {
g_free (netrcname);
diff --git a/vfs/gc.c b/vfs/gc.c
index 961d7f8..aff2390 100644
--- a/vfs/gc.c
+++ b/vfs/gc.c
@@ -125,7 +125,7 @@ vfs_getid (struct vfs_class *vclass, const char *dir)
vfsid id = NULL;
/* append slash if needed */
- dir1 = mhl_str_dir_plus_file (dir, "");
+ dir1 = concat_dir_and_file (dir, "");
if (vclass->getid)
id = (*vclass->getid) (vclass, dir1);
diff --git a/vfs/mcfs.c b/vfs/mcfs.c
index 884c523..9f5ace2 100644
--- a/vfs/mcfs.c
+++ b/vfs/mcfs.c
@@ -406,7 +406,7 @@ mcfs_get_path (mcfs_connection **mc, const char *path)
int f = !strcmp (remote_path, "/~");
if (f || !strncmp (remote_path, "/~/", 3)) {
char *s;
- s = mhl_str_dir_plus_file (mcfs_gethome (*mc),
+ s = concat_dir_and_file (mcfs_gethome (*mc),
remote_path + 3 - f);
g_free (remote_path);
remote_path = s;
diff --git a/vfs/sfs.c b/vfs/sfs.c
index 234dca0..8c30b29 100644
--- a/vfs/sfs.c
+++ b/vfs/sfs.c
@@ -339,7 +339,7 @@ static int sfs_init (struct vfs_class *me)
(void) me;
- mc_sfsini = mhl_str_dir_plus_file (mc_home, "extfs" PATH_SEP_STR "sfs.ini");
+ mc_sfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "sfs.ini");
cfg = fopen (mc_sfsini, "r");
if (!cfg){
diff --git a/vfs/smbfs.c b/vfs/smbfs.c
index ea30ed2..2001a7d 100644
--- a/vfs/smbfs.c
+++ b/vfs/smbfs.c
@@ -1217,7 +1217,7 @@ smbfs_get_path (smbfs_connection ** sc, const char *path)
int f = !strcmp (remote_path, "/~");
if (f || !strncmp (remote_path, "/~/", 3)) {
char *s;
- s = mhl_str_dir_plus_file ((*sc)->home, remote_path + 3 - f);
+ s = concat_dir_and_file ((*sc)->home, remote_path + 3 - f);
g_free (remote_path);
return s;
}
diff --git a/vfs/vfs.c b/vfs/vfs.c
index f13d217..8ea71f7 100644
--- a/vfs/vfs.c
+++ b/vfs/vfs.c
@@ -38,8 +38,6 @@
#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() */
@@ -658,7 +656,7 @@ vfs_canon (const char *path)
if (*path != PATH_SEP){
char *local, *result;
- local = mhl_str_dir_plus_file (current_dir, path);
+ local = concat_dir_and_file (current_dir, path);
result = vfs_canon (local);
g_free (local);
--
Midnight Commander Development
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]