updated: [df41295] Merge branch 'mc-4.6'
- From: "Sergei Trofimovich" <slyfox inbox ru>
- To: mc-devel gnome org
- Subject: updated: [df41295] Merge branch 'mc-4.6'
- Date: Sun, 1 Feb 2009 13:27:41 +0100 (CET)
The following commit has been merged in the master branch:
commit df4129517b53d2851368dc5ed5fbcc2b5eec9ee8
Merge: a1b47185c952e9d31607d59420a0cb86e9f492ab 7a51b50d5ce442970eb3909cddae236b53025877
Author: Sergei Trofimovich <slyfox inbox ru>
Date: Sun Feb 1 14:26:54 2009 +0200
Merge branch 'mc-4.6'
* mc-4.6: (38 commits)
mhl: mhl_shell_unescape_buf(): fixed memory array OOB.
completion: fixed complete already escaped secuences.
completion: added changelog entry for solved #147
completion: fixed completion of escaped commands in commandline
Removed unused char*.
mhl: added mhl_strmove() function (memmove semantics)
completion: added escapes in command line on completion
complete: cleanup: #define to enum INPUT_COMPLETION_FLAGS
added a new parameter for completion flags to input_new
fish: cleanup: unboxed quoted strings when generate shell commands
introduced new type SHELL_ESCAPED_STR for more type safety
added mhl/types.h which defines bool enum, escape.h now using this type
Removed unused variable
Changes for use MHL.
Fixed bug with renamig/copying files with backshashes in names
Remove some testing stuff
Temporarry commit. Fixed completion in browse by directoryes.
Fixed some memory leaks.
Add $ and ` for escaping and reorder it according to the ascii values
Rewrite it to use g_string_append_c instead of some homebrew stuff
...
diff --combined ChangeLog
index cc5b4da,6e4f378..a63a22d
--- a/ChangeLog
+++ b/ChangeLog
@@@ -1,3 -1,11 +1,11 @@@
+ 2009-01-31 Enrico Weigelt, metux ITS <weigelt metux de>, Patrick Winnertz <winnie debian org>, Slava Zanko <slavazanko gmail com>, Sergei Trofimovich <slyfox inbox ru>
+
+ * edit/editcmd.c, mhl/escape.h, mhl/string.h, mhl/types.h, src/Makefile.am,
+ * src/boxes.c, src/command.c, src/complete.c, src/complete.h, src/file.c,
+ * src/find.c, src/main.c, src/panelize.c, src/util.c, src/utilunix.c,
+ * src/widget.c, src/widget.h, src/wtools.c, vfs/fish.c:
+ fixed shell escaping issues in commandline completion engine
+
2009-01-31 Enrico Weigelt, metux ITS <weigelt metux de>
* replaced buggy concat_dir_and_file() by mhl_str_dir_plus_file() (in mhl/string.h)
@@@ -17,6 -25,11 +25,11 @@@
This solves "strange" rename cases, when copying/moving is performed into
deleted directory.
+ 2009-01-27 Enrico Weigelt, metux ITS <weigelt metux de>
+
+ * mhl/escape.h, src/complete.c, vfs/fish.c: introduced new type
+ SHELL_ESCAPED_STR for more type safety
+
2009-01-27 Enrico Weigelt, metux IT service <weigelt metux de>
* mhl/escape.h, mhl/string.h: fixed comments to use /* ... */
@@@ -26,11 -39,6 +39,11 @@@
* syntax/python.syntax: Added syntax highlighting for
pytnoh-2.6+ keywords (patch sent by NNemec)
+2009-01-26 Mikhail S. Pobolovets <styx mp gmail com>
+
+ * vfs/fish.c: Iterpret SUP.flags as port number if SUP.flags is not in
+ 0, FISH_FLAG_COMPRESSED and FISH_FLAG_RSH. Weakness: port number
+
2009-01-25 Ilia Maslakov <il smind gmail com>
* src/boxes.c, src/boxes.h, src/dir.c, src/dir.h:
@@@ -42,10 -50,6 +55,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 mp 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 <weigelt metux de>
* edit/editcmd.c, src/cmd.c, src/ext.c, src/history.h:
@@@ -65,19 -69,10 +78,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 <weigelt metux de>
+
+ * syntax/Syntax, syntax/nemerle.syntax: Added syntax rules
+ for Nemerle source files
+
+2009-01-19 Patrick Winnertz <winnie debian org>
+
+ * edit/edit.h: Add two more ints
+ * src/setup.c: Add keybinding to disable tab highlighting
+
2009-01-18 Patrick Winnertz <winnie 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
@@@ -115,29 -110,7 +128,29 @@@
2009-01-11 Patrick Winnertz <winnie debian org>
* syntax/pascal.syntax: Added syntax highlighting for
- some delphi keywords
+ some delphi keywords
+
+2009-01-10 Enrico Weigelt, metux ITS <weigelt 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 <weigelt 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 illig gmx de>
@@@ -315,7 -288,7 +328,7 @@@
* doc/mc.1.in: Document `fish_directory_timeout'.
-2006-02-18 David Martin <<dmartina excite com>
+2006-02-18 David Martin <dmartina excite com>
* doc/es/mc.1.in: Cleanup. Fix key naming.
diff --combined edit/editcmd.c
index 9910f5c,d223c35..07286b6
--- a/edit/editcmd.c
+++ b/edit/editcmd.c
@@@ -626,7 -626,7 +626,7 @@@ edit_raw_key_query (const char *heading
NULL, heading,
DLG_CENTER | DLG_TRYUP | DLG_WANT_TAB);
add_widget (raw_dlg,
- input_new (3 - cancel, w - 5, INPUT_COLOR, 2, "", 0));
+ input_new (3 - cancel, w - 5, INPUT_COLOR, 2, "", 0, INPUT_COMPLETE_DEFAULT));
add_widget (raw_dlg, label_new (3 - cancel, 2, query));
if (cancel)
add_widget (raw_dlg,
@@@ -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/boxes.c
index 5c66f3d,0ff72d4..48ac3a9
--- a/src/boxes.c
+++ b/src/boxes.c
@@@ -197,7 -197,7 +197,7 @@@ display_init (int radio_sel, char *init
status =
input_new (10, 9, INPUT_COLOR, DISPLAY_X - 14, _status[radio_sel],
- "mini-input");
+ "mini-input", INPUT_COMPLETE_DEFAULT);
add_widget (dd, status);
input_set_point (status, 0);
@@@ -207,7 -207,7 +207,7 @@@
user =
input_new (7, 9, INPUT_COLOR, DISPLAY_X - 14, init_text,
- "user-fmt-input");
+ "user-fmt-input", INPUT_COMPLETE_DEFAULT);
add_widget (dd, user);
input_set_point (user, 0);
@@@ -633,7 -633,7 +633,7 @@@ display_bits_box (void
errmsg =
init_translation_table (source_codepage, display_codepage);
if (errmsg)
- message (1, MSG_ERROR, "%s", errmsg);
+ message (D_ERROR, MSG_ERROR, "%s", errmsg);
#ifndef HAVE_SLANG
meta (stdscr, display_codepage != 0);
#else
@@@ -1085,17 -1085,17 +1085,17 @@@ vfs_smb_get_authinfo (const char *host
g_free (title);
- in_user = input_new (5, istart, INPUT_COLOR, ilen, user, "auth_name");
+ in_user = input_new (5, istart, INPUT_COLOR, ilen, user, "auth_name", INPUT_COMPLETE_DEFAULT);
add_widget (auth_dlg, in_user);
- in_domain = input_new (3, istart, INPUT_COLOR, ilen, domain, "auth_domain");
+ in_domain = input_new (3, istart, INPUT_COLOR, ilen, domain, "auth_domain", INPUT_COMPLETE_DEFAULT);
add_widget (auth_dlg, in_domain);
add_widget (auth_dlg, button_new (9, b2, B_CANCEL, NORMAL_BUTTON,
buts[1], 0));
add_widget (auth_dlg, button_new (9, b0, B_ENTER, DEFPUSH_BUTTON,
buts[0], 0));
- in_password = input_new (7, istart, INPUT_COLOR, ilen, "", "auth_password");
+ in_password = input_new (7, istart, INPUT_COLOR, ilen, "", "auth_password", INPUT_COMPLETE_DEFAULT);
in_password->completion_flags = 0;
in_password->is_password = 1;
add_widget (auth_dlg, in_password);
diff --combined src/command.c
index 35fa5ec,e608bf0..7b7b7c9
--- a/src/command.c
+++ b/src/command.c
@@@ -27,13 -27,14 +27,14 @@@
#include <errno.h>
#include <string.h>
+ #include <mhl/memory.h>
+ #include <mhl/escape.h>
#include <mhl/string.h>
#include "global.h" /* home_dir */
#include "tty.h"
#include "widget.h" /* WInput */
#include "command.h"
- #include "complete.h" /* completion constants */
#include "wtools.h" /* message () */
#include "panel.h" /* view_tree enum. Also, needed by main.h */
#include "main.h" /* do_cd */
@@@ -66,6 -67,7 +67,7 @@@ examine_cd (char *path
const char *t;
/* Tilde expansion */
+ path = mhl_shell_unescape_buf(path);
path_tilde = tilde_expand (path);
/* Leave space for further expansion */
@@@ -137,6 -139,7 +139,7 @@@
}
g_free (q);
g_free (path_tilde);
+ // mhl_mem_free(path);
return result;
}
@@@ -185,7 -188,7 +188,7 @@@ void do_cd_command (char *cmd
} 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;
@@@ -217,7 -220,7 +220,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"));
@@@ -227,7 -230,7 +230,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;
}
@@@ -292,7 -295,8 +295,8 @@@ command_new (int y, int x, int cols
{
WInput *cmd;
- cmd = input_new (y, x, DEFAULT_COLOR, cols, "", "cmdline");
+ cmd = input_new (y, x, DEFAULT_COLOR, cols, "", "cmdline",
+ INPUT_COMPLETE_DEFAULT | INPUT_COMPLETE_CD | INPUT_COMPLETE_COMMANDS | INPUT_COMPLETE_SHELL_ESC);
/* Add our hooks */
cmd->widget.callback = command_callback;
diff --combined src/file.c
index dff29de,6400e3e..cb61307
--- a/src/file.c
+++ b/src/file.c
@@@ -50,6 -50,8 +50,8 @@@
#include <sys/stat.h>
#include <unistd.h>
+ #include <mhl/memory.h>
+ #include <mhl/escape.h>
#include <mhl/string.h>
#include "global.h"
@@@ -65,6 -67,7 +67,7 @@@
#include "widget.h"
#include "wtools.h"
#include "background.h" /* we_are_background */
+ #include "util.h"
/* Needed for current_panel, other_panel and WTree */
#include "dir.h"
@@@ -178,43 -181,49 +181,49 @@@ do_transform_source (FileOpContext *ctx
for (next_reg = 1, j = 0, k = 0; j < strlen (ctx->dest_mask); j++) {
switch (ctx->dest_mask[j]) {
case '\\':
- j++;
- if (!isdigit ((unsigned char) ctx->dest_mask[j])) {
- /* Backslash followed by non-digit */
- switch (ctx->dest_mask[j]) {
- case 'U':
- case_conv |= UP_SECT;
- case_conv &= ~LOW_SECT;
- break;
- case 'u':
- case_conv |= UP_CHAR;
- break;
- case 'L':
- case_conv |= LOW_SECT;
- case_conv &= ~UP_SECT;
- break;
- case 'l':
- case_conv |= LOW_CHAR;
- break;
- case 'E':
- case_conv = NO_CONV;
- break;
- default:
- /* Backslash as quote mark */
- fntarget[k++] =
- convert_case (ctx->dest_mask[j], &case_conv);
- }
+ if (mhl_shell_is_char_escaped (&ctx->dest_mask[j])){
+ fntarget[k++] = ctx->dest_mask[j++];
+ fntarget[k++] = ctx->dest_mask[j];
break;
} else {
- /* Backslash followed by digit */
- next_reg = ctx->dest_mask[j] - '0';
- /* Fall through */
+ j++;
+ if (!isdigit ((unsigned char) ctx->dest_mask[j])) {
+ /* Backslash followed by non-digit */
+ switch (ctx->dest_mask[j]) {
+ case 'U':
+ case_conv |= UP_SECT;
+ case_conv &= ~LOW_SECT;
+ break;
+ case 'u':
+ case_conv |= UP_CHAR;
+ break;
+ case 'L':
+ case_conv |= LOW_SECT;
+ case_conv &= ~UP_SECT;
+ break;
+ case 'l':
+ case_conv |= LOW_CHAR;
+ break;
+ case 'E':
+ case_conv = NO_CONV;
+ break;
+ default:
+ /* Backslash as quote mark */
+ fntarget[k++] =
+ convert_case (ctx->dest_mask[j], &case_conv);
+ }
+ break;
+ } else {
+ /* Backslash followed by digit */
+ next_reg = ctx->dest_mask[j] - '0';
+ /* Fall through */
+ }
}
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 -323,7 +323,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 -377,7 +377,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 -521,7 +521,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 -597,7 +597,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;
}
@@@ -793,7 -802,7 +802,7 @@@
}
}
- if (!appending) {
+ if (!appending && ctx->preserve) {
while (mc_chmod (dst_path, (src_mode & ctx->umask_kill))) {
temp_status = file_error (
_(" Cannot chmod target file \"%s\" \n %s "), dst_path);
@@@ -870,7 -879,7 +879,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;
}
@@@ -1054,14 -1063,14 +1063,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;
@@@ -1177,7 -1186,7 +1186,7 @@@ move_dir_dir (FileOpContext *ctx, cons
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;
@@@ -1755,7 -1764,7 +1764,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 -1842,7 +1842,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 "));
}
@@@ -1896,7 -1905,7 +1905,7 @@@
g_free (dest);
dest = temp2;
temp = NULL;
-
+
switch (operation) {
case OP_COPY:
/*
@@@ -1988,6 -1997,9 +1997,9 @@@
else {
char *temp2 = mhl_str_dir_plus_file (dest, temp);
+ source_with_path = mhl_shell_unescape_buf(source_with_path);
+ temp2 = mhl_shell_unescape_buf(temp2);
+
switch (operation) {
case OP_COPY:
/*
diff --combined src/find.c
index 7590811,9ff1ef7..ca06df9
--- a/src/find.c
+++ b/src/find.c
@@@ -167,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 */
}
@@@ -276,16 -276,16 +276,16 @@@ find_parameters (char **start_dir, cha
add_widget (find_dlg, case_sense);
in_with =
- input_new (8, istart, INPUT_COLOR, ilen, in_contents, "content");
+ input_new (8, istart, INPUT_COLOR, ilen, in_contents, "content", INPUT_COMPLETE_DEFAULT);
add_widget (find_dlg, in_with);
add_widget (find_dlg, recursively_cbox);
in_name =
- input_new (5, istart, INPUT_COLOR, ilen, in_start_name, "name");
+ input_new (5, istart, INPUT_COLOR, ilen, in_start_name, "name", INPUT_COMPLETE_DEFAULT);
add_widget (find_dlg, in_name);
in_start =
- input_new (3, istart, INPUT_COLOR, ilen, in_start_dir, "start");
+ input_new (3, istart, INPUT_COLOR, ilen, in_start_dir, "start", INPUT_COMPLETE_DEFAULT);
add_widget (find_dlg, in_start);
add_widget (find_dlg, label_new (8, 3, labs[2]));
diff --combined src/main.c
index 8be5841,db26945..89fd0fd
--- a/src/main.c
+++ b/src/main.c
@@@ -67,7 -67,6 +67,6 @@@
#include "widget.h"
#include "command.h"
#include "wtools.h"
- #include "complete.h" /* For the free_completion */
#include "chmod.h"
#include "chown.h"
@@@ -426,7 -425,7 +425,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"
@@@ -472,7 -471,7 +471,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;
}
@@@ -687,7 -686,7 +686,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);
}
@@@ -994,7 -993,7 +993,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"
diff --combined src/panelize.c
index f102812,ef80619..d15f093
--- a/src/panelize.c
+++ b/src/panelize.c
@@@ -165,7 -165,7 +165,7 @@@ init_panelize (void
pname =
input_new (UY + 14, UX, INPUT_COLOR, panelize_dlg->cols - 10, "",
- "in");
+ "in", INPUT_COMPLETE_DEFAULT);
add_widget (panelize_dlg, pname);
add_widget (panelize_dlg, label_new (UY + 13, UX, _("Command")));
@@@ -266,7 -266,7 +266,7 @@@ external_panelize (void
char *target = NULL;
if (!vfs_current_is_local ()){
- message (1, MSG_ERROR,
+ message (D_ERROR, MSG_ERROR,
_(" Cannot run external panelize in a non-local directory "));
return;
}
@@@ -369,7 -369,7 +369,7 @@@ static void do_external_panelize (char
open_error_pipe ();
external = popen (command, "r");
if (!external){
- close_error_pipe (1, _("Cannot invoke command."));
+ close_error_pipe (D_ERROR, _("Cannot invoke command."));
return;
}
/* Clear the counters and the directory list */
@@@ -420,8 -420,8 +420,8 @@@
current_panel->count = set_zero_dir (list);
}
if (pclose (external) < 0)
- message (0, _("External panelize"), _("Pipe close failed"));
- close_error_pipe (0, 0);
+ message (D_NORMAL, _("External panelize"), _("Pipe close failed"));
+ close_error_pipe (D_NORMAL, NULL);
try_to_select (current_panel, NULL);
panel_re_sort (current_panel);
}
diff --combined src/utilunix.c
index cd3c7cc,1b72b2e..4b088e5
--- a/src/utilunix.c
+++ b/src/utilunix.c
@@@ -41,6 -41,8 +41,8 @@@
#endif
#include <unistd.h>
+ #include <mhl/string.h>
+
#include "global.h"
#include "execute.h"
#include "wtools.h" /* message() */
@@@ -339,11 -341,11 +341,11 @@@ static int old_error; /* File descript
void open_error_pipe (void)
{
if (pipe (error_pipe) < 0){
- message (0, _("Warning"), _(" Pipe failed "));
+ message (D_NORMAL, _("Warning"), _(" Pipe failed "));
}
old_error = dup (2);
if(old_error < 0 || close(2) || dup (error_pipe[1]) != 2){
- message (0, _("Warning"), _(" Dup failed "));
+ message (D_NORMAL, _("Warning"), _(" Dup failed "));
close (error_pipe[0]);
close (error_pipe[1]);
}
@@@ -426,7 -428,7 +428,7 @@@ canonicalize_pathname (char *path
if (p[0] == PATH_SEP && p[1] == PATH_SEP) {
s = p + 1;
while (*(++s) == PATH_SEP);
- strcpy (p + 1, s);
+ mhl_strmove (p + 1, s);
}
p++;
}
@@@ -435,7 -437,7 +437,7 @@@
p = lpath;
while (*p) {
if (p[0] == PATH_SEP && p[1] == '.' && p[2] == PATH_SEP)
- strcpy (p, p + 2);
+ mhl_strmove (p, p + 2);
else
p++;
}
@@@ -451,7 -453,7 +453,7 @@@
lpath[1] = 0;
return;
} else {
- strcpy (lpath, lpath + 2);
+ mhl_strmove (lpath, lpath + 2);
}
}
@@@ -497,10 -499,10 +499,10 @@@
if (p[3] != 0) {
if (s == lpath && *s == PATH_SEP) {
/* "/../foo" -> "/foo" */
- strcpy (s + 1, p + 4);
+ mhl_strmove (s + 1, p + 4);
} else {
/* "token/../foo" -> "foo" */
- strcpy (s, p + 4);
+ mhl_strmove (s, p + 4);
}
p = (s > lpath) ? s - 1 : s;
continue;
diff --combined vfs/fish.c
index 5d24d52,7df2e1e..6d45387
--- a/vfs/fish.c
+++ b/vfs/fish.c
@@@ -144,7 -144,7 +144,7 @@@ fish_command (struct vfs_class *me, str
enable_interrupt_key ();
status = write (SUP.sockw, str, strlen (str));
- g_free (str);
+ mhl_mem_free (str);
disable_interrupt_key ();
if (status < 0)
@@@ -168,10 -168,10 +168,10 @@@ fish_free_archive (struct vfs_class *me
close (SUP.sockr);
SUP.sockw = SUP.sockr = -1;
}
- g_free (SUP.host);
- g_free (SUP.user);
- g_free (SUP.cwdir);
- g_free (SUP.password);
+ mhl_mem_free (SUP.host);
+ mhl_mem_free (SUP.user);
+ mhl_mem_free (SUP.cwdir);
+ mhl_mem_free (SUP.password);
}
static void
@@@ -216,22 -216,13 +216,22 @@@ static in
fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
{
{
- const char *argv[10];
+ char gbuf[10];
+ const char *argv[10]; /* All of 10 is used now */
const char *xsh = (SUP.flags == FISH_FLAG_RSH ? "rsh" : "ssh");
int i = 0;
argv[i++] = xsh;
if (SUP.flags == FISH_FLAG_COMPRESSED)
argv[i++] = "-C";
+
+ if (SUP.flags > FISH_FLAG_RSH)
+ {
+ argv[i++] = "-p";
+ g_snprintf (gbuf, sizeof (gbuf), "%d", SUP.flags);
+ argv[i++] = gbuf;
+ }
+
argv[i++] = "-l";
argv[i++] = SUP.user;
argv[i++] = SUP.host;
@@@ -251,7 -242,7 +251,7 @@@
/* Currently, this does not work. ssh reads passwords from
/dev/tty, not from stdin :-(. */
- message (1, MSG_ERROR,
+ message (D_ERROR, MSG_ERROR,
_
("Sorry, we cannot do password authenticated connections for now."));
ERRNOR (EPERM, -1);
@@@ -260,7 -251,7 +260,7 @@@
p = g_strconcat (_(" fish: Password required for "),
SUP.user, " ", (char *) NULL);
op = vfs_get_password (p);
- g_free (p);
+ mhl_mem_free (p);
if (op == NULL)
ERRNOR (EPERM, -1);
SUP.password = op;
@@@ -323,13 -314,13 +323,13 @@@ fish_open_archive (struct vfs_class *me
p = vfs_split_url (strchr (op, ':') + 1, &host, &user, &flags,
&password, 0, URL_NOSLASH);
- g_free (p);
+ mhl_mem_free (p);
SUP.host = host;
SUP.user = user;
SUP.flags = flags;
if (!strncmp (op, "rsh:", 4))
- SUP.flags |= FISH_FLAG_RSH;
+ SUP.flags = FISH_FLAG_RSH;
SUP.cwdir = NULL;
if (password)
SUP.password = password;
@@@ -350,12 -341,12 +350,12 @@@ fish_archive_same (struct vfs_class *me
op = vfs_split_url (strchr (op, ':') + 1, &host, &user, &flags, 0, 0,
URL_NOSLASH);
- g_free (op);
+ mhl_mem_free (op);
flags = ((strcmp (host, SUP.host) == 0)
&& (strcmp (user, SUP.user) == 0) && (flags == SUP.flags));
- g_free (host);
- g_free (user);
+ mhl_mem_free (host);
+ mhl_mem_free (user);
return flags;
}
@@@ -367,7 -358,7 +367,7 @@@ fish_dir_load(struct vfs_class *me, str
char buffer[8192];
struct vfs_s_entry *ent = NULL;
FILE *logfile;
- char *quoted_path;
+ SHELL_ESCAPED_STR quoted_path;
int reply_code;
#if 0
@@@ -462,8 -453,8 +462,8 @@@
"else\n"
"echo '### 500'\n"
"fi\n",
- quoted_path, quoted_path, quoted_path, quoted_path, quoted_path, quoted_path);
- mhl_mem_free (quoted_path);
+ quoted_path.s, quoted_path.s, quoted_path.s, quoted_path.s, quoted_path.s, quoted_path.s);
+ mhl_mem_free (quoted_path.s);
ent = vfs_s_generate_entry(me, NULL, dir, 0);
while (1) {
int res = vfs_s_get_line_interruptible (me, buffer, sizeof (buffer), SUP.sockr);
@@@ -594,7 -585,7 +594,7 @@@
vfs_s_free_entry (me, ent);
reply_code = fish_decode_reply(buffer + 4, 0);
if (reply_code == COMPLETE) {
- g_free (SUP.cwdir);
+ mhl_mem_free (SUP.cwdir);
SUP.cwdir = g_strdup (remote_path);
print_vfs_message (_("%s: done."), me->name);
return 0;
@@@ -618,7 -609,7 +618,7 @@@ fish_file_store(struct vfs_class *me, s
struct stat s;
int was_error = 0;
int h;
- char *quoted_name;
+ SHELL_ESCAPED_STR quoted_name;
h = open (localname, O_RDONLY);
@@@ -659,7 -650,7 +659,7 @@@
*/
quoted_name = mhl_shell_escape_dup(name);
- print_vfs_message(_("fish: store %s: sending command..."), quoted_name );
+ print_vfs_message(_("fish: store %s: sending command..."), quoted_name.s );
/* FIXME: File size is limited to ULONG_MAX */
if (!fh->u.fish.append)
@@@ -683,8 -674,8 +683,8 @@@
" rest=`expr $rest - $n`\n"
"done\n"
"}; echo '### 200'\n",
- (unsigned long) s.st_size, quoted_name,
- quoted_name, (unsigned long) s.st_size,
+ (unsigned long) s.st_size, quoted_name.s,
+ quoted_name.s, (unsigned long) s.st_size,
(unsigned long) s.st_size);
else
n = fish_command (me, super, WAIT_REPLY,
@@@ -700,8 -691,8 +700,8 @@@
" rest=`expr $rest - $n`\n"
"done\n"
"}; echo '### 200'\n",
- (unsigned long) s.st_size, quoted_name,
- quoted_name, (unsigned long) s.st_size);
+ (unsigned long) s.st_size, quoted_name.s,
+ quoted_name.s, (unsigned long) s.st_size);
if (n != PRELIM) {
close (h);
@@@ -735,14 -726,14 +735,14 @@@
(unsigned long) s.st_size);
}
close(h);
- mhl_mem_free(quoted_name);
+ mhl_mem_free(quoted_name.s);
if ((fish_get_reply (me, SUP.sockr, NULL, 0) != COMPLETE) || was_error)
ERRNOR (E_REMOTE, -1);
return 0;
error_return:
close(h);
fish_get_reply(me, SUP.sockr, NULL, 0);
- mhl_mem_free(quoted_name);
+ mhl_mem_free(quoted_name.s);
return -1;
}
@@@ -750,7 -741,7 +750,7 @@@ static in
fish_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset)
{
char *name;
- char *quoted_name;
+ SHELL_ESCAPED_STR quoted_name;
if (offset)
ERRNOR (E_NOTSUPP, 0);
name = vfs_s_fullpath (me, fh->ino);
@@@ -779,8 -770,8 +779,8 @@@
"else\n"
"echo '### 500'\n"
"fi\n",
- quoted_name, quoted_name, quoted_name, quoted_name );
- g_free (quoted_name);
+ quoted_name.s, quoted_name.s, quoted_name.s, quoted_name.s );
+ mhl_mem_free (quoted_name.s);
if (offset != PRELIM) ERRNOR (E_REMOTE, 0);
fh->linear = LS_LINEAR_OPEN;
fh->u.fish.got = 0;
@@@ -889,17 -880,18 +889,18 @@@ fish_send_command(struct vfs_class *me
#define PREFIX \
char buf[BUF_LARGE]; \
const char *crpath; \
- char *rpath, *mpath = g_strdup (path); \
+ char *mpath = mhl_str_dup (path); \
+ SHELL_ESCAPED_STR rpath; \
struct vfs_s_super *super; \
if (!(crpath = vfs_s_get_path_mangle (me, mpath, &super, 0))) { \
- g_free (mpath); \
+ mhl_mem_free (mpath); \
return -1; \
} \
rpath = mhl_shell_escape_dup(crpath); \
- g_free (mpath);
+ mhl_mem_free (mpath);
#define POSTFIX(flags) \
- g_free (rpath); \
+ mhl_mem_free (rpath.s); \
return fish_send_command(me, super, buf, flags);
static int
@@@ -909,8 -901,8 +910,8 @@@ fish_chmod (struct vfs_class *me, cons
g_snprintf(buf, sizeof(buf), "#CHMOD %4.4o /%s\n"
"chmod %4.4o /%s 2>/dev/null\n"
"echo '### 000'\n",
- mode & 07777, rpath,
- mode & 07777, rpath);
+ mode & 07777, rpath.s,
+ mode & 07777, rpath.s);
POSTFIX(OPT_FLUSH);
}
@@@ -919,24 -911,24 +920,24 @@@ static int fish_##name (struct vfs_clas
{ \
char buf[BUF_LARGE]; \
const char *crpath1, *crpath2; \
- char *rpath1, *rpath2, *mpath1, *mpath2; \
+ char *mpath1, *mpath2; \
struct vfs_s_super *super1, *super2; \
if (!(crpath1 = vfs_s_get_path_mangle (me, mpath1 = g_strdup(path1), &super1, 0))) { \
- g_free (mpath1); \
+ mhl_mem_free (mpath1); \
return -1; \
} \
if (!(crpath2 = vfs_s_get_path_mangle (me, mpath2 = g_strdup(path2), &super2, 0))) { \
- g_free (mpath1); \
- g_free (mpath2); \
+ mhl_mem_free (mpath1); \
+ mhl_mem_free (mpath2); \
return -1; \
} \
- rpath1 = mhl_shell_escape_dup (crpath1); \
- g_free (mpath1); \
- rpath2 = mhl_shell_escape_dup (crpath2); \
- g_free (mpath2); \
- g_snprintf(buf, sizeof(buf), string "\n", rpath1, rpath2, rpath1, rpath2); \
- mhl_mem_free (rpath1); \
- mhl_mem_free (rpath2); \
+ SHELL_ESCAPED_STR rpath1 = mhl_shell_escape_dup (crpath1); \
+ mhl_mem_free (mpath1); \
+ SHELL_ESCAPED_STR rpath2 = mhl_shell_escape_dup (crpath2); \
+ mhl_mem_free (mpath2); \
+ g_snprintf(buf, sizeof(buf), string "\n", rpath1.s, rpath2.s, rpath1.s, rpath2.s); \
+ mhl_mem_free (rpath1.s); \
+ mhl_mem_free (rpath2.s); \
return fish_send_command(me, super2, buf, OPT_FLUSH); \
}
@@@ -949,15 -941,15 +950,15 @@@ FISH_OP(link, "#LINK /%s /%s\n
static int fish_symlink (struct vfs_class *me, const char *setto, const char *path)
{
- char *qsetto;
+ SHELL_ESCAPED_STR qsetto;
PREFIX
qsetto = mhl_shell_escape_dup (setto);
g_snprintf(buf, sizeof(buf),
"#SYMLINK %s /%s\n"
"ln -s %s /%s 2>/dev/null\n"
"echo '### 000'\n",
- qsetto, rpath, qsetto, rpath);
- mhl_mem_free (qsetto);
+ qsetto.s, rpath.s, qsetto.s, rpath.s);
+ mhl_mem_free (qsetto.s);
POSTFIX(OPT_FLUSH);
}
@@@ -982,16 -974,16 +983,16 @@@ fish_chown (struct vfs_class *me, cons
"#CHOWN %s /%s\n"
"chown %s /%s 2>/dev/null\n"
"echo '### 000'\n",
- sowner, rpath,
- sowner, rpath);
+ sowner, rpath.s,
+ sowner, rpath.s);
fish_send_command (me, super, buf, OPT_FLUSH);
/* FIXME: what should we report if chgrp succeeds but chown fails? */
g_snprintf (buf, sizeof(buf),
"#CHGRP /%s \"/%s\"\n"
"chgrp %s \"/%s\" 2>/dev/null\n"
"echo '### 000'\n",
- sgroup, rpath,
- sgroup, rpath);
+ sgroup, rpath.s,
+ sgroup, rpath.s);
/* fish_send_command(me, super, buf, OPT_FLUSH); */
POSTFIX (OPT_FLUSH)
}
@@@ -1004,7 -996,7 +1005,7 @@@ static int fish_unlink (struct vfs_clas
"#DELE /%s\n"
"rm -f /%s 2>/dev/null\n"
"echo '### 000'\n",
- rpath, rpath);
+ rpath.s, rpath.s);
POSTFIX(OPT_FLUSH);
}
@@@ -1018,7 -1010,7 +1019,7 @@@ static int fish_mkdir (struct vfs_clas
"#MKD /%s\n"
"mkdir /%s 2>/dev/null\n"
"echo '### 000'\n",
- rpath, rpath);
+ rpath.s, rpath.s);
POSTFIX(OPT_FLUSH);
}
@@@ -1029,7 -1021,7 +1030,7 @@@ static int fish_rmdir (struct vfs_clas
"#RMD /%s\n"
"rmdir /%s 2>/dev/null\n"
"echo '### 000'\n",
- rpath, rpath);
+ rpath.s, rpath.s);
POSTFIX(OPT_FLUSH);
}
@@@ -1065,35 -1057,29 +1066,35 @@@ static voi
fish_fill_names (struct vfs_class *me, fill_names_f func)
{
struct vfs_s_super *super = MEDATA->supers;
- const char *flags;
char *name;
-
- while (super){
- switch (SUP.flags & (FISH_FLAG_RSH | FISH_FLAG_COMPRESSED)) {
- case FISH_FLAG_RSH:
+
+ char gbuf[10];
+
+ while (super)
+ {
+ const char *flags = "";
+ switch (SUP.flags)
+ {
+ case FISH_FLAG_RSH:
flags = ":r";
break;
- case FISH_FLAG_COMPRESSED:
+ case FISH_FLAG_COMPRESSED:
flags = ":C";
break;
- case FISH_FLAG_RSH | FISH_FLAG_COMPRESSED:
- flags = "";
- break;
- default:
- flags = "";
+ default:
+ if (SUP.flags > FISH_FLAG_RSH)
+ {
+ break;
+ g_snprintf (gbuf, sizeof (gbuf), ":%d", SUP.flags);
+ flags = gbuf;
+ }
break;
}
name = g_strconcat ("/#sh:", SUP.user, "@", SUP.host, flags,
"/", SUP.cwdir, (char *) NULL);
(*func)(name);
- g_free (name);
+ mhl_mem_free (name);
super = super->next;
}
}
--
Midnight Commander Development
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]