Browse Source

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>
Patrick Winnertz 16 years ago
parent
commit
3b8f37b99e
10 changed files with 31 additions and 33 deletions
  1. 1 1
      edit/edit.c
  2. 2 2
      edit/editcmd.c
  3. 1 1
      edit/editwidget.c
  4. 2 2
      edit/syntax.c
  5. 1 1
      edit/usermap.c
  6. 1 1
      src/charsets.c
  7. 12 12
      src/cmd.c
  8. 3 3
      src/command.c
  9. 7 7
      src/complete.c
  10. 1 3
      src/cons.handler.c

+ 1 - 1
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);

+ 2 - 2
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);

+ 1 - 1
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);
     }

+ 2 - 2
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) {

+ 1 - 1
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);

+ 1 - 1
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);

+ 12 - 12
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);
 	}

+ 3 - 3
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);
 	}

+ 7 - 7
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);

+ 1 - 3
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 */

Some files were not shown because too many files changed in this diff