1
1

Merge branch 'mc-4.6' into 147_escaping

* mc-4.6:
  replaced buggy concat_dir_and_file() by mhl_str_dir_plus_file()
  fixed out-of-tree-builds
  Updated the NEWS file for 4.6.2 and added the bugnumbers behind the items in the list.
  Update for OpenOffice and StarOffice viewer.
  changelog: added entry for python syntax
  syntax: python: keywords update (patch by NNemec) fixes #216
  AC_USE_SYSTEM_EXTENSIONS macro requires autoconf >= 2.60
  po/ru.po: In russian translation, there are some hotkey conficts in menu.
  ChangeLog/NEWS: added entry for #181 ticket (copy to deleted dir)
  Now a trailing slash will only be added in copy & move dialogs if the path itselfs
  copy/move dialog: add trailing '/' to default destination path (fix #181)
  fixed comments to /* ... */
  Not only comment it out but removing it
  Removed unneeded var to make build process a bit cleaner
  Add code snipplet by il.smind which should fix issues with putty and

Conflicts:
	ChangeLog
	mhl/string.h
	src/command.c
	src/complete.c
	src/file.c
	src/util.c
Этот коммит содержится в:
Sergei Trofimovich 2009-01-31 22:18:19 +02:00
родитель 6c84e0c6dd 54d6ec88dc
Коммит ff4de3d66f
43 изменённых файлов: 327 добавлений и 225 удалений

Просмотреть файл

@ -6,11 +6,39 @@
* src/widget.c, src/widget.h, src/wtools.c, vfs/fish.c: * src/widget.c, src/widget.h, src/wtools.c, vfs/fish.c:
fixed shell escaping issues in commandline completion engine 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)
2009-01-30 Enrico Weigelt, metux ITS <weigelt@metux.de>
* src/Makefile.am, edit/Makefile.am vfs/Makefile.am: fixed #208
(out-of-tree builds)
2009-01-29 Mikhail S. Pobolovets <styx.mp@gmail.com>
* lib/mc.ext.in: update for OpenOffice and StarOffice viewer.
odt2txt is now used
2009-01-29 Patrick Winnertz <winnie@debian.org> & Sergei Trofimovich <slyfox@inbox.ru>
* src/file.c: Added trailing dir separator for default path in copy/move dialogs.
This solves "strange" rename cases, when copying/moving is performed into
deleted directory.
2009-01-27 Enrico Weigelt, metux ITS <weigelt@metux.de> 2009-01-27 Enrico Weigelt, metux ITS <weigelt@metux.de>
* mhl/escape.h, src/complete.c, vfs/fish.c: introduced new type * mhl/escape.h, src/complete.c, vfs/fish.c: introduced new type
SHELL_ESCAPED_STR for more type safety 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 /* ... */
2009-01-27 Sergei Trofimovich <slyfox@inbox.ru>
* syntax/python.syntax: Added syntax highlighting for
pytnoh-2.6+ keywords (patch sent by NNemec)
2009-01-25 Ilia Maslakov <il.smind@gmail.com> 2009-01-25 Ilia Maslakov <il.smind@gmail.com>
* src/boxes.c, src/boxes.h, src/dir.c, src/dir.h: * src/boxes.c, src/boxes.h, src/dir.c, src/dir.h:

49
NEWS
Просмотреть файл

@ -2,41 +2,46 @@ Version 4.6.2
- MC Core - MC Core
- Changed HQ url to point to new website - Changed HQ url to point to new website
www.midnight-commander.org www.midnight-commander.org (Closes: #137, #138)
- Added a micro helper library in order to go slowly - Added a micro helper library in order to go slowly
avay from glib avay from glib (Closes: #157)
- Use static strings as section entries in ~/.mc/history - Use static strings as section entries in ~/.mc/history
WARNING!: This will break old files WARNING!: This will break old files (Closes: #50)
- Fixed a repaint issue when clicking on the "View" Button instead - Fixed a repaint issue when clicking on the "View" Button instead
of using F3 of using F3 (Closes: #35)
- Removed obsolete autoconf macros - Removed obsolete autoconf macros (Closes: #133)
- Fix escaping for command line completion - Fix escaping for command line completion (Closes: #147)
- prevend mc from segfaulting when getting invalid timestamps on files - prevent mc from segfaulting when getting invalid timestamps on files (Closes: #96)
- Fixed a keybord issue when running mc via a putty console - Fixed a keybord issue when running mc via a putty console (Closes: #203)
- setted pty fd to closeonexec (on subshell) - setted pty fd to closeonexec (on subshell) (Closes: #174)
- Fixed file renames, when copying/moving is performed
into deleted directories. (Closes: #181)
- Add an option to show executables first in the panels (Closes: #173)
- Editor - Editor
- Syntax highlighting for: - Syntax highlighting for:
+ debian files (debian/changelog, debian/control, debian/copyright, ..) + debian files (debian/changelog, debian/control, debian/copyright, ..) (Closes: #142)
+ updated sh syntax highlighting + updated sh syntax highlighting (Closes: #143)
+ updated pascal syntax highlighting + updated pascal syntax highlighting (Closes: #65)
+ differentiate between c and cpp files for highlighting + differentiate between c and cpp files for highlighting (Closes: #16)
- Removed some unneeded variables + updated python highlighting to support python 2.6 (Closes: #216)
- Do use a ro test if a file exists - Removed some unneeded variables (Closes: #168, #151)
- Fixes some missbehaviour in regex matching - Do use a ro test if a file exists (Closes: #206)
- Fixes some missbehaviour in regex matching (Closes: #207, #211 )
+ start at front of line and not on cursor position + start at front of line and not on cursor position
+ . shouldn't match a newline + . shouldn't match a newline
- VFS - VFS
- Fix some bashisms in some extfs scripts - Fix some bashisms in some extfs scripts (Closes: #146)
- Fixed various problems with symlinks and files with chars which needs - Fixed various problems with symlinks and files with chars which needs
escaping over fish escaping over fish (Closes: #10, #87, #149)
- Added 7zip extfs descriptor - Added 7zip extfs descriptor (Closes: #92)
- Switched from o3totxt to odf2txt as o3totxt is outdated (Closes: #218)
- Locale - Locale
- Updated german translation - Updated german translation (Closes: #167)
- New Belarussian translation - New Belarussian translation (Closes: #170)
- Updated russian translation - Updated russian translation (Closes: #159)
Version 4.6.2-pre1. Version 4.6.2-pre1.

Просмотреть файл

@ -3,7 +3,7 @@ dnl Configure.in file for the Midnight Commander
dnl dnl
AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org]) AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
AC_PREREQ(2.54) AC_PREREQ(2.60)
m4_pattern_forbid(MC_) m4_pattern_forbid(MC_)
AC_CONFIG_SRCDIR(src/main.c) AC_CONFIG_SRCDIR(src/main.c)
AC_CONFIG_AUX_DIR(config) AC_CONFIG_AUX_DIR(config)

Просмотреть файл

@ -1,4 +1,4 @@
AM_CFLAGS = $(GLIB_CFLAGS) AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
if USE_EDIT if USE_EDIT
noinst_LIBRARIES = libedit.a noinst_LIBRARIES = libedit.a

Просмотреть файл

@ -30,9 +30,10 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h> #include <stdlib.h>
#include <mhl/string.h>
#include "../src/global.h" #include "../src/global.h"
#include "edit.h" #include "edit.h"
@ -2665,7 +2666,7 @@ user_menu (WEdit * edit)
int nomark; int nomark;
struct stat status; struct stat status;
long start_mark, end_mark; long start_mark, end_mark;
char *block_file = concat_dir_and_file (home_dir, BLOCK_FILE); char *block_file = mhl_str_dir_plus_file (home_dir, BLOCK_FILE);
int rc = 0; int rc = 0;
nomark = eval_marks (edit, &start_mark, &end_mark); nomark = eval_marks (edit, &start_mark, &end_mark);

Просмотреть файл

@ -28,7 +28,6 @@
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <sys/types.h> #include <sys/types.h>
@ -36,9 +35,10 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h> #include <stdlib.h>
#include <mhl/string.h>
#include "../src/global.h" #include "../src/global.h"
#include "../src/history.h" #include "../src/history.h"
@ -235,7 +235,7 @@ edit_save_file (WEdit *edit, const char *filename)
return 0; return 0;
if (*filename != PATH_SEP && edit->dir) { 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); filename = catstrs (savename, (char *) NULL);
g_free (savename); g_free (savename);
} }
@ -301,7 +301,7 @@ edit_save_file (WEdit *edit, const char *filename)
savedir[slashpos - filename + 1] = '\0'; savedir[slashpos - filename + 1] = '\0';
} else } else
savedir = g_strdup ("."); savedir = g_strdup (".");
saveprefix = concat_dir_and_file (savedir, "cooledit"); saveprefix = mhl_str_dir_plus_file (savedir, "cooledit");
g_free (savedir); g_free (savedir);
fd = mc_mkstemps (&savename, saveprefix, NULL); fd = mc_mkstemps (&savename, saveprefix, NULL);
g_free (saveprefix); g_free (saveprefix);

Просмотреть файл

@ -33,9 +33,10 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h> #include <stdlib.h>
#include <mhl/string.h>
#include "../src/global.h" #include "../src/global.h"
#include "edit.h" #include "edit.h"
@ -174,7 +175,7 @@ edit_file (const char *_file, int line)
WButtonBar *edit_bar; WButtonBar *edit_bar;
if (!made_directory) { if (!made_directory) {
char *dir = concat_dir_and_file (home_dir, EDIT_DIR); char *dir = mhl_str_dir_plus_file (home_dir, EDIT_DIR);
made_directory = (mkdir (dir, 0700) != -1 || errno == EEXIST); made_directory = (mkdir (dir, 0700) != -1 || errno == EEXIST);
g_free (dir); g_free (dir);
} }

Просмотреть файл

@ -30,9 +30,10 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h> #include <stdlib.h>
#include <mhl/string.h>
#include "../src/global.h" #include "../src/global.h"
#include "edit.h" #include "edit.h"
@ -1026,7 +1027,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
f = fopen (syntax_file, "r"); f = fopen (syntax_file, "r");
if (!f){ if (!f){
lib_file = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax"); lib_file = mhl_str_dir_plus_file (mc_home, "syntax" PATH_SEP_STR "Syntax");
f = fopen (lib_file, "r"); f = fopen (lib_file, "r");
g_free (lib_file); g_free (lib_file);
if (!f) if (!f)
@ -1188,7 +1189,7 @@ edit_load_syntax (WEdit *edit, char ***pnames, const char *type)
if (!*edit->filename && !type) if (!*edit->filename && !type)
return; return;
} }
f = concat_dir_and_file (home_dir, SYNTAX_FILE); f = mhl_str_dir_plus_file (home_dir, SYNTAX_FILE);
r = edit_read_syntax_file (edit, pnames, f, edit ? edit->filename : 0, r = edit_read_syntax_file (edit, pnames, f, edit ? edit->filename : 0,
get_first_editor_line (edit), type); get_first_editor_line (edit), type);
if (r == -1) { if (r == -1) {

Просмотреть файл

@ -26,11 +26,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <mhl/string.h>
#include "../src/global.h" #include "../src/global.h"
#include "edit.h" #include "edit.h"
@ -596,7 +597,7 @@ edit_load_user_map(WEdit *edit)
if (edit_key_emulation != EDIT_KEY_EMULATION_USER) if (edit_key_emulation != EDIT_KEY_EMULATION_USER)
return TRUE; return TRUE;
file = concat_dir_and_file(home_dir, MC_USERMAP); file = mhl_str_dir_plus_file(home_dir, MC_USERMAP);
if (stat(file, &s) < 0) { if (stat(file, &s) < 0) {
char *msg = g_strdup_printf(_("%s not found!"), file); char *msg = g_strdup_printf(_("%s not found!"), file);

Просмотреть файл

@ -445,7 +445,7 @@ shell/.sdw
# StarOffice 6 and OpenOffice.org formats # StarOffice 6 and OpenOffice.org formats
regex/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$ regex/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
Open=(ooffice %f &) Open=(ooffice %f &)
View=%view{ascii} unzip -p %f content.xml | o3totxt View=%view{ascii} odt2txt %f
# AbiWord # AbiWord
shell/.abw shell/.abw

Просмотреть файл

@ -74,12 +74,12 @@ static inline char* mhl_shell_unescape_buf(char* text)
if (!text) if (!text)
return NULL; return NULL;
// look for the first \ - that's quick skipover if there's nothing to escape /* look for the first \ - that's quick skipover if there's nothing to escape */
char* readptr = text; char* readptr = text;
while ((*readptr) && ((*readptr)!='\\')) readptr++; while ((*readptr) && ((*readptr)!='\\')) readptr++;
if (!(*readptr)) return text; if (!(*readptr)) return text;
// if we're here, we're standing on the first '\' /* if we're here, we're standing on the first '\' */
char* writeptr = readptr; char* writeptr = readptr;
char c; char c;
while ((c = *readptr)) while ((c = *readptr))
@ -117,7 +117,7 @@ static inline char* mhl_shell_unescape_buf(char* text)
(*writeptr) = c; writeptr++; break; (*writeptr) = c; writeptr++; break;
} }
} }
else // got a normal character else /* got a normal character */
{ {
(*writeptr) = *readptr; (*writeptr) = *readptr;
writeptr++; writeptr++;

Просмотреть файл

@ -17,30 +17,29 @@ static inline char * mhl_str_dup_range(const char * s_start, const char * s_boun
static inline char* mhl_str_trim(char* str) static inline char* mhl_str_trim(char* str)
{ {
if (!str) return NULL; // NULL string ?! bail out. if (!str) return NULL; /* NULL string ?! bail out. */
// find the first non-space /* find the first non-space */
char* start; for (start=str; ((*str) && (!isspace(*str))); str++); char* start; for (start=str; ((*str) && (!isspace(*str))); str++);
// only spaces ? /* only spaces ? */
if (!(*str)) { *str = 0; return str; } if (!(*str)) { *str = 0; return str; }
// get the size (cannot be empty - catched above) /* get the size (cannot be empty - catched above) */
size_t _sz = strlen(str); size_t _sz = strlen(str);
// find the proper end /* find the proper end */
char* end; char* end;
for (end=(str+_sz-1); ((end>str) && (isspace(*end))); end--); for (end=(str+_sz-1); ((end>str) && (isspace(*end))); end--);
end[1] = 0; // terminate, just to be sure end[1] = 0; /* terminate, just to be sure */
// if we have no leading spaces, just trucate /* if we have no leading spaces, just trucate */
if (start==str) { end++; *end = 0; return str; } if (start==str) { end++; *end = 0; return str; }
/* if it' only one char, dont need memmove for that */
// if it' only one char, dont need memmove for that
if (start==end) { str[0]=*start; str[1]=0; return str; } if (start==end) { str[0]=*start; str[1]=0; return str; }
// by here we have a (non-empty) region between start end end /* by here we have a (non-empty) region between start end end */
memmove(str,start,(end-start+1)); memmove(str,start,(end-start+1));
return str; return str;
} }
@ -71,10 +70,9 @@ static inline char* __mhl_str_concat_hlp(const char* base, ...)
va_list args; va_list args;
va_start(args,base); va_start(args,base);
char* a; char* a;
// note: we use ((char*)(1)) as terminator - NULL is a valid argument ! /* note: we use ((char*)(1)) as terminator - NULL is a valid argument ! */
while ((a = va_arg(args, char*))!=(char*)1) while ((a = va_arg(args, char*))!=(char*)1)
{ {
// printf("a=%u\n", a);
if (a) if (a)
{ {
arg_ptr[count] = a; arg_ptr[count] = a;
@ -87,7 +85,7 @@ static inline char* __mhl_str_concat_hlp(const char* base, ...)
if (!count) if (!count)
return mhl_str_dup(""); return mhl_str_dup("");
// now as we know how much to copy, allocate the buffer /* now as we know how much to copy, allocate the buffer */
char* buffer = (char*)mhl_mem_alloc_u(totalsize+2); char* buffer = (char*)mhl_mem_alloc_u(totalsize+2);
char* current = buffer; char* current = buffer;
int x=0; int x=0;
@ -105,8 +103,8 @@ static inline char* __mhl_str_concat_hlp(const char* base, ...)
static inline char* mhl_str_reverse(char* ptr) static inline char* mhl_str_reverse(char* ptr)
{ {
if (!ptr) return NULL; // missing string if (!ptr) return NULL; /* missing string */
if (!(ptr[0] && ptr[1])) return ptr; // empty or 1-ch string if (!(ptr[0] && ptr[1])) return ptr; /* empty or 1-ch string */
size_t _sz = strlen(ptr); size_t _sz = strlen(ptr);
char* start = ptr; char* start = ptr;
@ -136,4 +134,38 @@ static inline char * mhl_strmove(char * dest, const char * src)
return memmove(dest, src, n); return memmove(dest, src, n);
} }
static inline char* mhl_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 */
int dnlen = strlen(dirname);
while (dnlen && (dirname[dnlen-1]=='/'))
dnlen--;
int fnlen = strlen(filename);
char* buffer = mhl_mem_alloc_z(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;
}
#endif /* __MHL_STRING_H */ #endif /* __MHL_STRING_H */

Просмотреть файл

@ -1,3 +1,7 @@
2009-01-10 Andrew Borodin <aborodin@vmail.ru>
* ru.po: Fix conflicting shortcuts in the russian translation.
2008-06-30 David Martin <dmartina@excite.com> 2008-06-30 David Martin <dmartina@excite.com>
* es.po: Updated Spanish translation. Converted to UTF-8. * es.po: Updated Spanish translation. Converted to UTF-8.

Просмотреть файл

@ -423,7 +423,7 @@ msgid "&Insert file... F15"
msgstr "&ў╙╘┴╫╔╘╪ ╞┴╩╠... F15" msgstr "&ў╙╘┴╫╔╘╪ ╞┴╩╠... F15"
msgid "Copy to &file... C-f" msgid "Copy to &file... C-f"
msgstr "&ы╧╨╔╥╧╫┴╘╪ ╫ ╞┴╩╠... C-f" msgstr "ы╧&╨╔╥╧╫┴╘╪ ╫ ╞┴╩╠... C-f"
msgid "&User menu... F11" msgid "&User menu... F11"
msgstr "&э┼╬└ ╨╧╠╪┌╧╫┴╘┼╠╤... F11" msgstr "&э┼╬└ ╨╧╠╪┌╧╫┴╘┼╠╤... F11"
@ -513,7 +513,7 @@ msgid "Sor&t... M-t"
msgstr "&є╧╥╘╔╥╧╫╦┴... M-t" msgstr "&є╧╥╘╔╥╧╫╦┴... M-t"
msgid "Paste o&utput of... M-u" msgid "Paste o&utput of... M-u"
msgstr "ў╙╘┴╫╔╘╪ ╫┘╫╧─ &╦╧═┴╬─┘... M-u" msgstr "ў╙╘┴╫╔╘╪ ╫&┘╫╧─ ╦╧═┴╬─┘... M-u"
msgid "E&xternal Formatter F19" msgid "E&xternal Formatter F19"
msgstr "&ц╧╥═┴╘╔╥╧╫┴╬╔┼ F19" msgstr "&ц╧╥═┴╘╔╥╧╫┴╬╔┼ F19"
@ -540,7 +540,7 @@ msgid "Syntax &Highlighting..."
msgstr "&у╫┼╘╧╫┘─┼╠┼╬╔┼ ╙╔╬╘┴╦╙╔╙┴..." msgstr "&у╫┼╘╧╫┘─┼╠┼╬╔┼ ╙╔╬╘┴╦╙╔╙┴..."
msgid "Save setu&p..." msgid "Save setu&p..."
msgstr "&є╧╚╥┴╬╔╘╪ ╬┴╙╘╥╧╩╦╔" msgstr "є╧&╚╥┴╬╔╘╪ ╬┴╙╘╥╧╩╦╔"
msgid " File " msgid " File "
msgstr " ц┴╩╠ " msgstr " ц┴╩╠ "
@ -2165,7 +2165,7 @@ msgid "Vie&w file... "
msgstr "&Ё╥╧╙═╧╘╥ ╞┴╩╠┴..." msgstr "&Ё╥╧╙═╧╘╥ ╞┴╩╠┴..."
msgid "&Filtered view M-!" msgid "&Filtered view M-!"
msgstr "&Ё╥╧╙═╧╘╥ ╦╧═┴╬─┘ M-!" msgstr "Ё╥╧╙═╧╘╥ ╦╧═┴╬─&┘ M-!"
msgid "&Edit F4" msgid "&Edit F4"
msgstr "&Є┼─┴╦╘╔╥╧╫┴╬╔┼ F4" msgstr "&Є┼─┴╦╘╔╥╧╫┴╬╔┼ F4"
@ -2264,7 +2264,7 @@ msgid "Edit edi&tor menu file"
msgstr "Ё╥┴╫╦┴ ═┼╬└ ╥&┼─┴╦╘╧╥┴" msgstr "Ё╥┴╫╦┴ ═┼╬└ ╥&┼─┴╦╘╧╥┴"
msgid "Edit &syntax file" msgid "Edit &syntax file"
msgstr "ц┴╩╠ ╙╔╬╘┴╦╙╔╙┴" msgstr "ц┴&╩╠ ╙╔╬╘┴╦╙╔╙┴"
msgid "&Configuration..." msgid "&Configuration..."
msgstr "&ы╧╬╞╔╟╒╥┴├╔╤..." msgstr "&ы╧╬╞╔╟╒╥┴├╔╤..."

Просмотреть файл

@ -1,4 +1,4 @@
AM_CFLAGS = $(GLIB_CFLAGS) AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
localedir = $(datadir)/locale localedir = $(datadir)/locale
pkglibexecdir = $(libexecdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@

Просмотреть файл

@ -48,7 +48,7 @@ load_codepages_list (void)
extern int display_codepage; extern int display_codepage;
char *default_codepage = NULL; char *default_codepage = NULL;
fname = concat_dir_and_file (mc_home, CHARSETS_INDEX); fname = mhl_str_dir_plus_file (mc_home, CHARSETS_INDEX);
if (!(f = fopen (fname, "r"))) { if (!(f = fopen (fname, "r"))) {
fprintf (stderr, _("Warning: file %s not found\n"), fname); fprintf (stderr, _("Warning: file %s not found\n"), fname);
g_free (fname); g_free (fname);

Просмотреть файл

@ -34,6 +34,8 @@
#endif #endif
#include <unistd.h> #include <unistd.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "cmd.h" /* Our definitions */ #include "cmd.h" /* Our definitions */
#include "fileopctx.h" /* file_op_context_new() */ #include "fileopctx.h" /* file_op_context_new() */
@ -362,7 +364,7 @@ mkdir_cmd (void)
if (dir[0] == '/' || dir[0] == '~') if (dir[0] == '/' || dir[0] == '~')
absdir = g_strdup (dir); absdir = g_strdup (dir);
else else
absdir = concat_dir_and_file (current_panel->cwd, dir); absdir = mhl_str_dir_plus_file (current_panel->cwd, dir);
save_cwds_stat (); save_cwds_stat ();
if (my_mkdir (absdir, 0777) == 0) { if (my_mkdir (absdir, 0777) == 0) {
@ -568,10 +570,10 @@ void ext_cmd (void)
_(" Which extension file you want to edit? "), 0, 2, _(" Which extension file you want to edit? "), 0, 2,
_("&User"), _("&System Wide")); _("&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){ 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); check_for_default (extdir, buffer);
do_edit (buffer); do_edit (buffer);
g_free (buffer); g_free (buffer);
@ -598,7 +600,7 @@ menu_edit_cmd (int where)
_("&Local"), _("&User"), _("&System Wide") _("&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) { switch (dir) {
case 0: case 0:
@ -607,12 +609,12 @@ menu_edit_cmd (int where)
break; break;
case 1: 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); check_for_default (menufile, buffer);
break; break;
case 2: 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; break;
default: default:
@ -671,10 +673,10 @@ edit_syntax_cmd (void)
_(" Which syntax file you want to edit? "), 0, 2, _(" Which syntax file you want to edit? "), 0, 2,
_("&User"), _("&System Wide")); _("&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) { 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); check_for_default (extdir, buffer);
do_edit (buffer); do_edit (buffer);
g_free (buffer); g_free (buffer);
@ -805,8 +807,8 @@ compare_dir (WPanel *panel, WPanel *other, enum CompareMode mode)
} }
/* Thorough compare on, do byte-by-byte comparison */ /* Thorough compare on, do byte-by-byte comparison */
src_name = concat_dir_and_file (panel->cwd, source->fname); src_name = mhl_str_dir_plus_file (panel->cwd, source->fname);
dst_name = concat_dir_and_file (other->cwd, target->fname); dst_name = mhl_str_dir_plus_file (other->cwd, target->fname);
if (compare_files (src_name, dst_name, source->st.st_size)) if (compare_files (src_name, dst_name, source->st.st_size))
do_file_mark (panel, i, 1); do_file_mark (panel, i, 1);
g_free (src_name); g_free (src_name);
@ -920,10 +922,10 @@ do_link (int symbolic_link, const char *fname)
char *d; char *d;
/* suggest the full path for symlink */ /* 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) { 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 { } else {
d = g_strdup (fname); d = g_strdup (fname);
} }

Просмотреть файл

@ -27,8 +27,9 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include "mhl/memory.h" #include <mhl/memory.h>
#include "mhl/escape.h" #include <mhl/escape.h>
#include <mhl/string.h>
#include "global.h" /* home_dir */ #include "global.h" /* home_dir */
#include "tty.h" #include "tty.h"
@ -127,7 +128,7 @@ examine_cd (char *path)
c = *s; c = *s;
*s = 0; *s = 0;
if (*p) { if (*p) {
r = concat_dir_and_file (p, q); r = mhl_str_dir_plus_file (p, q);
result = do_cd (r, cd_parse_command); result = do_cd (r, cd_parse_command);
g_free (r); g_free (r);
} }
@ -180,7 +181,7 @@ void do_cd_command (char *cmd)
} else { } else {
char *old = current_panel->cwd; char *old = current_panel->cwd;
char *new; char *new;
new = concat_dir_and_file (old, cmd+3); new = mhl_str_dir_plus_file (old, cmd+3);
sync_tree (new); sync_tree (new);
g_free (new); g_free (new);
} }

Просмотреть файл

@ -26,13 +26,13 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include "mhl/memory.h" #include <mhl/memory.h>
#include "mhl/escape.h" #include <mhl/escape.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" #include "tty.h"
@ -512,7 +512,7 @@ command_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
if (cur_path >= path_end) if (cur_path >= path_end)
break; break;
expanded = tilde_expand (*cur_path ? cur_path : "."); expanded = tilde_expand (*cur_path ? cur_path : ".");
cur_word = concat_dir_and_file (expanded, text); cur_word = mhl_str_dir_plus_file (expanded, text);
g_free (expanded); g_free (expanded);
canonicalize_pathname (cur_word); canonicalize_pathname (cur_word);
cur_path = strchr (cur_path, 0) + 1; cur_path = strchr (cur_path, 0) + 1;
@ -807,7 +807,7 @@ try_complete (char *text, int *start, int *end, INPUT_COMPLETE_FLAGS flags)
c = *s; c = *s;
*s = 0; *s = 0;
if (*cdpath){ if (*cdpath){
r = concat_dir_and_file (cdpath, word); r = mhl_str_dir_plus_file (cdpath, word);
SHOW_C_CTX("try_complete:filename_subst_2"); SHOW_C_CTX("try_complete:filename_subst_2");
matches = completion_matches (r, filename_completion_function, flags); matches = completion_matches (r, filename_completion_function, flags);
g_free (r); g_free (r);

Просмотреть файл

@ -28,6 +28,8 @@
#endif #endif
#include <unistd.h> #include <unistd.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" #include "tty.h"
#include "cons.saver.h" #include "cons.saver.h"
@ -143,7 +145,7 @@ handle_console_linux (unsigned char action)
open ("/dev/null", O_WRONLY); open ("/dev/null", O_WRONLY);
if (tty_name) { if (tty_name) {
/* Exec the console save/restore handler */ /* Exec the console save/restore handler */
mc_conssaver = concat_dir_and_file (SAVERDIR, "cons.saver"); mc_conssaver = mhl_str_dir_plus_file (SAVERDIR, "cons.saver");
execl (mc_conssaver, "cons.saver", tty_name, (char *) NULL); execl (mc_conssaver, "cons.saver", tty_name, (char *) NULL);
} }
/* Console is not a tty or execl() failed */ /* Console is not a tty or execl() failed */

Просмотреть файл

@ -53,6 +53,8 @@
#endif #endif
#include <unistd.h> #include <unistd.h>
#include <mhl/string.h>
#define LINUX_CONS_SAVER_C #define LINUX_CONS_SAVER_C
#include "cons.saver.h" #include "cons.saver.h"

Просмотреть файл

@ -25,9 +25,10 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" #include "tty.h"
#include "user.h" #include "user.h"
@ -440,11 +441,11 @@ regex_command (const char *filename, const char *action, int *move_dir)
int mc_user_ext = 1; int mc_user_ext = 1;
int home_error = 0; 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)) { if (!exist_file (extension_file)) {
g_free (extension_file); g_free (extension_file);
check_stock_mc_ext: 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; mc_user_ext = 0;
} }
data = load_file (extension_file); data = load_file (extension_file);

Просмотреть файл

@ -50,8 +50,9 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include "mhl/memory.h" #include <mhl/memory.h>
#include "mhl/escape.h" #include <mhl/escape.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" #include "tty.h"
@ -921,7 +922,7 @@ copy_dir_dir (FileOpContext *ctx, const char *s, const char *d, int toplevel,
} }
/* Dive into subdir if exists */ /* Dive into subdir if exists */
if (toplevel && ctx->dive_into_subdirs) { 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 { } else {
dest_dir = g_strdup (d); dest_dir = g_strdup (d);
goto dont_mkdir; goto dont_mkdir;
@ -967,11 +968,11 @@ copy_dir_dir (FileOpContext *ctx, const char *s, const char *d, int toplevel,
continue; continue;
/* get the filename and add it to the src directory */ /* 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); (*ctx->stat_func) (path, &buf);
if (S_ISDIR (buf.st_mode)) { 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 * From here, we just intend to recursively copy subdirs, not
* the double functionality of copying different when the target * the double functionality of copying different when the target
@ -982,7 +983,7 @@ copy_dir_dir (FileOpContext *ctx, const char *s, const char *d, int toplevel,
parent_dirs, progress_count, progress_bytes); parent_dirs, progress_count, progress_bytes);
g_free (mdpath); g_free (mdpath);
} else { } 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, return_status = copy_file_file (ctx, path, dest_file, 1,
progress_count, progress_bytes, 0); progress_count, progress_bytes, 0);
g_free (dest_file); g_free (dest_file);
@ -1172,7 +1173,7 @@ move_dir_dir (FileOpContext *ctx, const char *s, const char *d,
destdir = g_strdup (d); destdir = g_strdup (d);
move_over = 1; move_over = 1;
} else } 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) { if (sbuf.st_dev == dbuf.st_dev && sbuf.st_ino == dbuf.st_ino) {
int msize = COLS - 36; int msize = COLS - 36;
@ -1329,7 +1330,7 @@ recursive_erase (FileOpContext *ctx, const char *s, off_t *progress_count,
continue; continue;
if (!strcmp (next->d_name, "..")) if (!strcmp (next->d_name, ".."))
continue; 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)) { if (mc_lstat (path, &buf)) {
g_free (path); g_free (path);
mc_closedir (reading); mc_closedir (reading);
@ -1520,7 +1521,7 @@ compute_dir_size (const char *dirname, off_t *ret_marked, double *ret_total)
if (strcmp (dirent->d_name, "..") == 0) if (strcmp (dirent->d_name, "..") == 0)
continue; 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); res = mc_lstat (fullname, &s);
@ -1577,7 +1578,7 @@ panel_compute_totals (WPanel *panel, off_t *ret_marked, double *ret_total)
double subdir_bytes = 0; double subdir_bytes = 0;
dir_name = 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); compute_dir_size (dir_name, &subdir_count, &subdir_bytes);
*ret_marked += subdir_count; *ret_marked += subdir_count;
@ -1787,6 +1788,7 @@ panel_operate (void *source_panel, FileOperation operation,
} }
} else if (operation != OP_DELETE) { } else if (operation != OP_DELETE) {
char *dest_dir; char *dest_dir;
char *dest_dir_;
/* Forced single operations default to the original name */ /* Forced single operations default to the original name */
if (force_single) if (force_single)
@ -1796,9 +1798,31 @@ panel_operate (void *source_panel, FileOperation operation,
else else
dest_dir = panel->cwd; dest_dir = panel->cwd;
/*
* Add trailing backslash only when do non-locally ops.
* It saves user from occasional file renames (when destination
* dir is deleted)
*/
if (force_single)
/* just copy */
dest_dir_ = mhl_str_dup (dest_dir);
else
/* add trailing separator */
if (*dest_dir && strcmp(&dest_dir[strlen(dest_dir)-1], PATH_SEP_STR)) {
dest_dir_ = mhl_str_concat (dest_dir, PATH_SEP_STR);
} else {
dest_dir_ = mhl_str_dup (dest_dir);
}
if (!dest_dir_) {
file_op_context_destroy (ctx);
return 0;
}
dest = dest =
file_mask_dialog (ctx, operation, cmd_buf, dest_dir, file_mask_dialog (ctx, operation, cmd_buf, dest_dir_,
single_entry, &do_bg); single_entry, &do_bg);
mhl_mem_free(dest_dir_);
if (!dest) { if (!dest) {
file_op_context_destroy (ctx); file_op_context_destroy (ctx);
return 0; return 0;
@ -1862,7 +1886,7 @@ panel_operate (void *source_panel, FileOperation operation,
/* The source and src_stat variables have been initialized before */ /* The source and src_stat variables have been initialized before */
#ifdef WITH_FULL_PATHS #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 */ #endif /* WITH_FULL_PATHS */
if (operation == OP_DELETE) { if (operation == OP_DELETE) {
@ -1877,7 +1901,7 @@ panel_operate (void *source_panel, FileOperation operation,
if (temp == NULL) { if (temp == NULL) {
value = transform_error; value = transform_error;
} else { } else {
char *temp2 = concat_dir_and_file (dest, temp); char *temp2 = mhl_str_dir_plus_file (dest, temp);
g_free (dest); g_free (dest);
dest = temp2; dest = temp2;
temp = NULL; temp = NULL;
@ -1955,7 +1979,7 @@ panel_operate (void *source_panel, FileOperation operation,
#ifdef WITH_FULL_PATHS #ifdef WITH_FULL_PATHS
g_free (source_with_path); 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 */ #endif /* WITH_FULL_PATHS */
if (operation == OP_DELETE) { if (operation == OP_DELETE) {
@ -1971,7 +1995,7 @@ panel_operate (void *source_panel, FileOperation operation,
if (temp == NULL) if (temp == NULL)
value = transform_error; value = transform_error;
else { else {
char *temp2 = concat_dir_and_file (dest, temp); char *temp2 = mhl_str_dir_plus_file (dest, temp);
source_with_path = mhl_shell_unescape_buf(source_with_path); source_with_path = mhl_shell_unescape_buf(source_with_path);
temp2 = mhl_shell_unescape_buf(temp2); temp2 = mhl_shell_unescape_buf(temp2);

Просмотреть файл

@ -27,6 +27,8 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
static char * static char *
@ -37,7 +39,7 @@ get_absolute_name (const char *file)
if (file[0] == PATH_SEP) if (file[0] == PATH_SEP)
return g_strdup (file); return g_strdup (file);
mc_get_current_wd (dir, MC_MAXPATHLEN); mc_get_current_wd (dir, MC_MAXPATHLEN);
return concat_dir_and_file (dir, file); return mhl_str_dir_plus_file (dir, file);
} }
static int static int
@ -60,7 +62,7 @@ my_mkdir_rec (char *s, mode_t mode)
return -1; return -1;
} }
p = concat_dir_and_file (s, ".."); p = mhl_str_dir_plus_file (s, "..");
q = vfs_canon (p); q = vfs_canon (p);
g_free (p); g_free (p);

Просмотреть файл

@ -25,9 +25,10 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" #include "tty.h"
#include "win.h" #include "win.h"
@ -354,7 +355,7 @@ push_directory (const char *dir)
dir_stack *new; dir_stack *new;
new = g_new (dir_stack, 1); 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; new->prev = dir_stack_base;
dir_stack_base = new; dir_stack_base = new;
} }
@ -516,7 +517,7 @@ search_content (Dlg_head *h, const char *directory, const char *filename)
int file_fd; int file_fd;
int ret_val = 0; 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)){ if (mc_stat (fname, &s) != 0 || !S_ISREG (s.st_mode)){
g_free (fname); g_free (fname);
@ -692,7 +693,7 @@ do_search (struct Dlg_head *h)
} }
if (subdirs_left && find_recursively && directory) { /* Can directory be NULL ? */ 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) if (!mc_lstat (tmp_name, &tmp_stat)
&& S_ISDIR (tmp_stat.st_mode)) { && S_ISDIR (tmp_stat.st_mode)) {
push_directory (tmp_name); push_directory (tmp_name);
@ -752,8 +753,8 @@ make_fullname (const char *dirname, const char *filename)
if (strcmp(dirname, ".") == 0 || strcmp(dirname, "."PATH_SEP_STR) == 0) if (strcmp(dirname, ".") == 0 || strcmp(dirname, "."PATH_SEP_STR) == 0)
return g_strdup (filename); return g_strdup (filename);
if (strncmp(dirname, "."PATH_SEP_STR, 2) == 0) if (strncmp(dirname, "."PATH_SEP_STR, 2) == 0)
return concat_dir_and_file (dirname + 2, filename); return mhl_str_dir_plus_file (dirname + 2, filename);
return concat_dir_and_file (dirname, filename); return mhl_str_dir_plus_file (dirname, filename);
} }
static void static void

Просмотреть файл

@ -32,11 +32,12 @@
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" /* COLS */ #include "tty.h" /* COLS */
#include "color.h" /* dialog_colors */ #include "color.h" /* dialog_colors */
@ -1447,7 +1448,7 @@ load_hotlist (void)
} }
if (!hotlist_file_name) if (!hotlist_file_name)
hotlist_file_name = concat_dir_and_file (home_dir, HOTLIST_FILENAME); hotlist_file_name = mhl_str_dir_plus_file (home_dir, HOTLIST_FILENAME);
hotlist = new_hotlist (); hotlist = new_hotlist ();
hotlist->type = HL_TYPE_GROUP; hotlist->type = HL_TYPE_GROUP;

Просмотреть файл

@ -29,11 +29,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" #include "tty.h"
#include "dir.h" #include "dir.h"
@ -1136,7 +1137,7 @@ copy_readlink (WPanel *panel)
if (S_ISLNK (selection (panel)->st.st_mode)) { if (S_ISLNK (selection (panel)->st.st_mode)) {
char buffer[MC_MAXPATHLEN]; char buffer[MC_MAXPATHLEN];
char *p = char *p =
concat_dir_and_file (panel->cwd, selection (panel)->fname); mhl_str_dir_plus_file (panel->cwd, selection (panel)->fname);
int i; int i;
i = mc_readlink (p, buffer, MC_MAXPATHLEN - 1); i = mc_readlink (p, buffer, MC_MAXPATHLEN - 1);
@ -1616,6 +1617,8 @@ update_xterm_title_path (void)
if (!is_printable ((unsigned char) *s)) if (!is_printable ((unsigned char) *s))
*s = '?'; *s = '?';
} while (*++s); } while (*++s);
if (!alternate_plus_minus)
numeric_keypad_mode ();
fprintf (stdout, "\33]0;mc - %s\7", p); fprintf (stdout, "\33]0;mc - %s\7", p);
fflush (stdout); fflush (stdout);
g_free (p); g_free (p);

Просмотреть файл

@ -25,9 +25,10 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" #include "tty.h"
#include "dir.h" #include "dir.h"
@ -709,7 +710,7 @@ display_mini_info (WPanel *panel)
char *link, link_target [MC_MAXPATHLEN]; char *link, link_target [MC_MAXPATHLEN];
int len; 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); len = mc_readlink (link, link_target, MC_MAXPATHLEN - 1);
g_free (link); g_free (link);
if (len > 0){ if (len > 0){
@ -1974,7 +1975,7 @@ do_enter_on_file_entry (file_entry *fe)
return 1; return 1;
/* Check if the file is executable */ /* 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)) { if (!is_exe (fe->st.st_mode) || !if_link_is_exe (full_name, fe)) {
g_free (full_name); g_free (full_name);
return 0; return 0;
@ -1993,7 +1994,7 @@ do_enter_on_file_entry (file_entry *fe)
char *tmp; char *tmp;
int ret; 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); ret = mc_setctl (tmp, VFS_SETCTL_RUN, NULL);
g_free (tmp); g_free (tmp);
/* We took action only if the dialog was shown or the execution /* We took action only if the dialog was shown or the execution
@ -2030,10 +2031,10 @@ chdir_other_panel (WPanel *panel)
} }
if (!S_ISDIR (panel->dir.list [panel->selected].st.st_mode)) { 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); sel_entry = strrchr(panel->cwd, PATH_SEP);
} else } 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 (); change_panel ();
do_cd (new_dir, cd_exact); do_cd (new_dir, cd_exact);
@ -2099,7 +2100,7 @@ chdir_to_readlink (WPanel *panel)
if (*buffer == PATH_SEP) if (*buffer == PATH_SEP)
new_dir = g_strdup (buffer); new_dir = g_strdup (buffer);
else else
new_dir = concat_dir_and_file (panel->cwd, buffer); new_dir = mhl_str_dir_plus_file (panel->cwd, buffer);
change_panel (); change_panel ();
do_cd (new_dir, cd_exact); do_cd (new_dir, cd_exact);

Просмотреть файл

@ -20,10 +20,11 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" #include "tty.h"
#include "dir.h" #include "dir.h"
@ -281,7 +282,7 @@ save_layout (void)
int i; int i;
char buffer [BUF_TINY]; 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 */ /* Save integer options */
for (i = 0; layout [i].opt_name; i++){ for (i = 0; layout [i].opt_name; i++){
@ -298,7 +299,7 @@ save_configure (void)
char *profile; char *profile;
int i; int i;
profile = concat_dir_and_file (home_dir, PROFILE_NAME); profile = mhl_str_dir_plus_file (home_dir, PROFILE_NAME);
/* Save integer options */ /* Save integer options */
for (i = 0; int_options[i].opt_name; i++) for (i = 0; int_options[i].opt_name; i++)
@ -346,7 +347,7 @@ save_setup (void)
char *profile; char *profile;
saving_setup = 1; saving_setup = 1;
profile = concat_dir_and_file (home_dir, PROFILE_NAME); profile = mhl_str_dir_plus_file (home_dir, PROFILE_NAME);
save_configure (); save_configure ();
@ -481,9 +482,9 @@ setup_init (void)
if (profile_name) if (profile_name)
return 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)){ 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)){ if (exist_file (inifile)){
g_free (profile); g_free (profile);
profile = inifile; profile = inifile;
@ -506,7 +507,7 @@ load_setup (void)
/* mc.lib is common for all users, but has priority lower than /* mc.lib is common for all users, but has priority lower than
~/.mc/ini. FIXME: it's only used for keys and treestore now */ ~/.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 */ /* Load integer boolean options */
for (i = 0; int_options[i].opt_name; i++) for (i = 0; int_options[i].opt_name; i++)

Просмотреть файл

@ -37,11 +37,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "treestore.h" #include "treestore.h"
#include "profile.h" #include "profile.h"
@ -265,7 +266,7 @@ tree_store_load(void)
char *name; char *name;
int retval; int retval;
name = concat_dir_and_file(home_dir, MC_TREE); name = mhl_str_dir_plus_file(home_dir, MC_TREE);
retval = tree_store_load_from(name); retval = tree_store_load_from(name);
g_free(name); g_free(name);
@ -371,7 +372,7 @@ tree_store_save(void)
char *name; char *name;
int retval; int retval;
tmp = concat_dir_and_file(home_dir, MC_TREE_TMP); tmp = mhl_str_dir_plus_file(home_dir, MC_TREE_TMP);
retval = tree_store_save_to(tmp); retval = tree_store_save_to(tmp);
if (retval) { if (retval) {
@ -379,7 +380,7 @@ tree_store_save(void)
return retval; return retval;
} }
name = concat_dir_and_file(home_dir, MC_TREE); name = mhl_str_dir_plus_file(home_dir, MC_TREE);
retval = rename(tmp, name); retval = rename(tmp, name);
g_free(tmp); g_free(tmp);
@ -605,7 +606,7 @@ tree_store_mark_checked(const char *subname)
if (ts.check_name[0] == PATH_SEP && ts.check_name[1] == 0) if (ts.check_name[0] == PATH_SEP && ts.check_name[1] == 0)
name = g_strconcat(PATH_SEP_STR, subname, (char *) NULL); name = g_strconcat(PATH_SEP_STR, subname, (char *) NULL);
else else
name = concat_dir_and_file(ts.check_name, subname); name = mhl_str_dir_plus_file(ts.check_name, subname);
/* Search for the subdirectory */ /* Search for the subdirectory */
current = ts.check_start; current = ts.check_start;
@ -795,7 +796,7 @@ tree_store_rescan(const char *dir)
continue; continue;
} }
full_name = concat_dir_and_file(dir, dp->d_name); full_name = mhl_str_dir_plus_file(dir, dp->d_name);
if (mc_lstat(full_name, &buf) != -1) { if (mc_lstat(full_name, &buf) != -1) {
if (S_ISDIR(buf.st_mode)) if (S_ISDIR(buf.st_mode))
tree_store_mark_checked(dp->d_name); tree_store_mark_checked(dp->d_name);

Просмотреть файл

@ -23,6 +23,8 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" #include "tty.h"
#include "color.h" #include "color.h"
@ -721,11 +723,11 @@ user_menu_cmd (struct WEdit *edit_widget)
menu = g_strdup (edit_widget ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU); menu = g_strdup (edit_widget ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU);
if (!exist_file (menu) || !menu_file_own (menu)){ if (!exist_file (menu) || !menu_file_own (menu)){
g_free (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); (home_dir, edit_widget ? CEDIT_HOME_MENU : MC_HOME_MENU);
if (!exist_file (menu)){ if (!exist_file (menu)){
g_free (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); (mc_home, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
} }
} }

Просмотреть файл

@ -35,7 +35,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include "mhl/escape.h" #include <mhl/escape.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "profile.h" #include "profile.h"
@ -688,7 +689,7 @@ load_mc_home_file (const char *filename, char **allocated_filename)
char *lang; char *lang;
char *data; char *data;
hintfile_base = concat_dir_and_file (mc_home, filename); hintfile_base = mhl_str_dir_plus_file (mc_home, filename);
lang = guess_message_value (); lang = guess_message_value ();
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL); hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
@ -1247,18 +1248,6 @@ diff_two_paths (const char *first, const char *second)
return buf; 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 */ /* Append text to GList, remove all entries with the same text */
GList * GList *
list_append_unique (GList *list, char *text) list_append_unique (GList *list, char *text)
@ -1319,7 +1308,7 @@ mc_mkstemps (char **pname, const char *prefix, const char *suffix)
if (strchr (prefix, PATH_SEP) == NULL) { if (strchr (prefix, PATH_SEP) == NULL) {
/* Add prefix first to find the position of XXXXXX */ /* Add prefix first to find the position of XXXXXX */
tmpbase = concat_dir_and_file (mc_tmpdir (), prefix); tmpbase = mhl_str_dir_plus_file (mc_tmpdir (), prefix);
} else { } else {
tmpbase = g_strdup (prefix); tmpbase = g_strdup (prefix);
} }
@ -1387,7 +1376,7 @@ load_file_position (const char *filename, long *line, long *column)
*column = 0; *column = 0;
/* open file with positions */ /* open file with positions */
fn = concat_dir_and_file (home_dir, MC_FILEPOS); fn = mhl_str_dir_plus_file (home_dir, MC_FILEPOS);
f = fopen (fn, "r"); f = fopen (fn, "r");
g_free (fn); g_free (fn);
if (!f) if (!f)
@ -1434,8 +1423,8 @@ save_file_position (const char *filename, long line, long column)
len = strlen (filename); len = strlen (filename);
tmp = concat_dir_and_file (home_dir, MC_FILEPOS_TMP); tmp = mhl_str_dir_plus_file (home_dir, MC_FILEPOS_TMP);
fn = concat_dir_and_file (home_dir, MC_FILEPOS); fn = mhl_str_dir_plus_file (home_dir, MC_FILEPOS);
/* open temporary file */ /* open temporary file */
t = fopen (tmp, "w"); t = fopen (tmp, "w");

Просмотреть файл

@ -66,7 +66,6 @@ char *strip_password (char *path, int has_prefix);
const char *strip_home_and_password (const char *dir); const char *strip_home_and_password (const char *dir);
const char *extension (const char *); 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 *unix_error_string (int error_num);
const char *skip_separators (const char *s); const char *skip_separators (const char *s);
const char *skip_numbers (const char *s); const char *skip_numbers (const char *s);

Просмотреть файл

@ -32,9 +32,10 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <mhl/string.h>
#include "global.h" #include "global.h"
#include "tty.h" #include "tty.h"
#include "color.h" #include "color.h"
@ -865,7 +866,7 @@ history_get (const char *input_name)
return NULL; return NULL;
if (!*input_name) if (!*input_name)
return NULL; return NULL;
profile = concat_dir_and_file (home_dir, HISTORY_FILE_NAME); profile = mhl_str_dir_plus_file (home_dir, HISTORY_FILE_NAME);
for (i = 0;; i++) { for (i = 0;; i++) {
char key_name[BUF_TINY]; char key_name[BUF_TINY];
char this_entry[BUF_LARGE]; char this_entry[BUF_LARGE];
@ -903,7 +904,7 @@ history_put (const char *input_name, GList *h)
if (!num_history_items_recorded) /* this is how to disable */ if (!num_history_items_recorded) /* this is how to disable */
return; return;
profile = concat_dir_and_file (home_dir, HISTORY_FILE_NAME); profile = mhl_str_dir_plus_file (home_dir, HISTORY_FILE_NAME);
if ((i = open (profile, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) != -1) if ((i = open (profile, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) != -1)
close (i); close (i);

Просмотреть файл

@ -20,8 +20,9 @@ context default
keyword , brightcyan keyword , brightcyan
keyword ; brightmagenta keyword ; brightmagenta
keyword whole self brightred keyword whole self brightred
keyword whole access yellow
keyword whole and yellow keyword whole and yellow
keyword whole as yellow
keyword whole assert yellow
keyword whole break yellow keyword whole break yellow
keyword whole class yellow keyword whole class yellow
keyword whole continue yellow keyword whole continue yellow
@ -48,52 +49,81 @@ context default
keyword whole return yellow keyword whole return yellow
keyword whole try yellow keyword whole try yellow
keyword whole while yellow keyword whole while yellow
keyword whole with yellow
keyword whole yield yellow
keyword whole abs brightcyan keyword whole abs brightcyan
keyword whole apply brightcyan keyword whole all brightcyan
keyword whole any brightcyan
keyword whole basestring brightcyan
keyword whole bin brightcyan
keyword whole bool brightcyan
keyword whole callable brightcyan keyword whole callable brightcyan
keyword whole chr brightcyan keyword whole chr brightcyan
keyword whole classmethod brightcyan
keyword whole cmp brightcyan keyword whole cmp brightcyan
keyword whole coerce brightcyan keyword whole coerce brightcyan
keyword whole compile brightcyan keyword whole compile brightcyan
keyword whole complex brightcyan
keyword whole delattr brightcyan keyword whole delattr brightcyan
keyword whole dict brightcyan
keyword whole dir brightcyan keyword whole dir brightcyan
keyword whole divmod brightcyan keyword whole divmod brightcyan
keyword whole enumerate brightcyan
keyword whole eval brightcyan keyword whole eval brightcyan
keyword whole exec brightcyan
keyword whole execfile brightcyan keyword whole execfile brightcyan
keyword whole file brightcyan
keyword whole filter brightcyan keyword whole filter brightcyan
keyword whole float brightcyan keyword whole float brightcyan
keyword whole frozenset brightcyan
keyword whole getattr brightcyan keyword whole getattr brightcyan
keyword whole globals brightcyan keyword whole globals brightcyan
keyword whole hasattr brightcyan keyword whole hasattr brightcyan
keyword whole hash brightcyan keyword whole hash brightcyan
keyword whole help brightcyan
keyword whole hex brightcyan keyword whole hex brightcyan
keyword whole id brightcyan keyword whole id brightcyan
keyword whole input brightcyan keyword whole input brightcyan
keyword whole int brightcyan keyword whole int brightcyan
keyword whole isinstance brightcyan
keyword whole issubclass brightcyan
keyword whole iter brightcyan
keyword whole len brightcyan keyword whole len brightcyan
keyword whole list brightcyan
keyword whole locals brightcyan keyword whole locals brightcyan
keyword whole long brightcyan keyword whole long brightcyan
keyword whole map brightcyan keyword whole map brightcyan
keyword whole max brightcyan keyword whole max brightcyan
keyword whole min brightcyan keyword whole min brightcyan
keyword whole next brightcyan
keyword whole object brightcyan
keyword whole oct brightcyan keyword whole oct brightcyan
keyword whole open brightcyan keyword whole open brightcyan
keyword whole ord brightcyan keyword whole ord brightcyan
keyword whole pow brightcyan keyword whole pow brightcyan
keyword whole print brightcyan
keyword whole property brightcyan
keyword whole range brightcyan keyword whole range brightcyan
keyword whole raw_input brightcyan keyword whole raw_input brightcyan
keyword whole reduce brightcyan keyword whole reduce brightcyan
keyword whole reload brightcyan keyword whole reload brightcyan
keyword whole repr brightcyan keyword whole repr brightcyan
keyword whole reversed brightcyan
keyword whole round brightcyan keyword whole round brightcyan
keyword whole setattr brightcyan keyword whole setattr brightcyan
keyword whole slice brightcyan
keyword whole sorted brightcyan
keyword whole staticmethod brightcyan
keyword whole str brightcyan keyword whole str brightcyan
keyword whole sum brightcyan
keyword whole super brightcyan
keyword whole tuple brightcyan keyword whole tuple brightcyan
keyword whole type brightcyan keyword whole type brightcyan
keyword whole unichr brightcyan
keyword whole unicode brightcyan
keyword whole vars brightcyan keyword whole vars brightcyan
keyword whole xrange brightcyan keyword whole xrange brightcyan
keyword whole zip brightcyan
keyword whole atof magenta keyword whole atof magenta
keyword whole atoi magenta keyword whole atoi magenta
@ -160,47 +190,6 @@ context default
keyword whole __oct__ lightgray keyword whole __oct__ lightgray
keyword whole __hex__ lightgray keyword whole __hex__ lightgray
keyword whole __init__ lightgray
keyword whole __del__ lightgray
keyword whole __repr__ lightgray
keyword whole __str__ lightgray
keyword whole __cmp__ lightgray
keyword whole __hash__ lightgray
keyword whole __call__ lightgray
keyword whole __getattr__ lightgray
keyword whole __setattr__ lightgray
keyword whole __delattr__ lightgray
keyword whole __len__ lightgray
keyword whole __getitem__ lightgray
keyword whole __setitem__ lightgray
keyword whole __delitem__ lightgray
keyword whole __getslice__ lightgray
keyword whole __setslice__ lightgray
keyword whole __delslice__ lightgray
keyword whole __add__ lightgray
keyword whole __sub__ lightgray
keyword whole __mul__ lightgray
keyword whole __div__ lightgray
keyword whole __mod__ lightgray
keyword whole __divmod__ lightgray
keyword whole __pow__ lightgray
keyword whole __lshift__ lightgray
keyword whole __rshift__ lightgray
keyword whole __and__ lightgray
keyword whole __xor__ lightgray
keyword whole __or__ lightgray
keyword whole __neg__ lightgray
keyword whole __pos__ lightgray
keyword whole __abs__ lightgray
keyword whole __invert__ lightgray
keyword whole __nonzero__ lightgray
keyword whole __coerce__ lightgray
keyword whole __int__ lightgray
keyword whole __long__ lightgray
keyword whole __float__ lightgray
keyword whole __oct__ lightgray
keyword whole __hex__ lightgray
keyword whole __radd__ lightgray keyword whole __radd__ lightgray
keyword whole __rsub__ lightgray keyword whole __rsub__ lightgray
keyword whole __rmul__ lightgray keyword whole __rmul__ lightgray
@ -232,7 +221,7 @@ context """ """ green
keyword \\\\ brightgreen keyword \\\\ brightgreen
keyword \\' brightgreen keyword \\' brightgreen
keyword \\\{abtnvfr\} brightgreen keyword \\\{abtnvfr\} brightgreen
context # \n brown context # \n brown
spellcheck spellcheck
context " " green context " " green

Просмотреть файл

@ -1,16 +1,12 @@
if USE_SAMBA_FS if USE_SAMBA_FS
SUBDIRS = samba extfs SAMBA_CFLAGS = -DCONFIGDIR=\""@configdir@"\"
else SAMBA_SUBDIRS = samba
SUBDIRS = extfs
endif endif
DIST_SUBDIRS = extfs DIST_SUBDIRS = extfs
if USE_SAMBA_FS SUBDIRS = extfs $(SAMBA_SUBDIRS)
AM_CFLAGS = $(GLIB_CFLAGS) -DCONFIGDIR=\""@configdir@"\" AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(SAMBA_CFLAGS)
else
AM_CFLAGS = $(GLIB_CFLAGS)
endif
BASICFILES = \ BASICFILES = \
cpio.c \ cpio.c \

Просмотреть файл

@ -35,6 +35,9 @@
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
#include <errno.h> #include <errno.h>
#include <mhl/string.h>
#include "../src/global.h" #include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */ #include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */ #include "../src/wtools.h" /* message() */
@ -246,7 +249,7 @@ extfs_open_archive (int fstype, const char *name, struct archive **pparc)
tmp = name_quote (name, 0); 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 = cmd =
g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ", g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ",
local_name ? local_name : tmp, (char *) NULL); local_name ? local_name : tmp, (char *) NULL);
@ -621,7 +624,7 @@ extfs_cmd (const char *extfs_cmd, struct archive *archive,
archive_name = name_quote (extfs_get_archive_name (archive), 0); archive_name = name_quote (extfs_get_archive_name (archive), 0);
quoted_localname = name_quote (localname, 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], cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype],
extfs_cmd, archive_name, " ", quoted_file, " ", extfs_cmd, archive_name, " ", quoted_file, " ",
quoted_localname, (char *) NULL); quoted_localname, (char *) NULL);
@ -650,7 +653,7 @@ extfs_run (struct vfs_class *me, const char *file)
g_free (p); g_free (p);
archive_name = name_quote (extfs_get_archive_name (archive), 0); 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], cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype],
" run ", archive_name, " ", q, (char *) NULL); " run ", archive_name, " ", q, (char *) NULL);
g_free (mc_extfsdir); g_free (mc_extfsdir);
@ -1295,7 +1298,7 @@ static int extfs_init (struct vfs_class *me)
(void) me; (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"); cfg = fopen (mc_extfsini, "r");
/* We may not use vfs_die() message or message or similar, /* We may not use vfs_die() message or message or similar,

Просмотреть файл

@ -44,7 +44,7 @@ What to do with this?
int f = !strcmp( remote_path, "/~" ); int f = !strcmp( remote_path, "/~" );
if (f || !strncmp( remote_path, "/~/", 3 )) { if (f || !strncmp( remote_path, "/~/", 3 )) {
char *s; 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); g_free (remote_path);
remote_path = s; remote_path = s;
} }
@ -69,6 +69,8 @@ What to do with this?
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#include <mhl/string.h>
#include "../src/global.h" #include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */ #include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */ #include "../src/wtools.h" /* message() */
@ -555,7 +557,7 @@ ftpfs_load_no_proxy_list (void)
if (mc_file) if (mc_file)
return; 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) && if (exist_file (mc_file) &&
(npf = fopen (mc_file, "r"))) { (npf = fopen (mc_file, "r"))) {
while (fgets (s, sizeof (s), npf)) { while (fgets (s, sizeof (s), npf)) {
@ -1230,7 +1232,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); ftpfs_open_data_connection (me, super, "LIST -la", 0, TYPE_ASCII, 0);
else { else {
/* Trailing "/." is necessary if remote_path is a symlink */ /* 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 = sock =
ftpfs_open_data_connection (me, super, "LIST -la", path, TYPE_ASCII, ftpfs_open_data_connection (me, super, "LIST -la", path, TYPE_ASCII,
0); 0);
@ -1886,7 +1888,7 @@ static int ftpfs_netrc_lookup (const char *host, char **login, char **pass)
} }
/* Load current .netrc */ /* 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); netrcp = netrc = load_file (netrcname);
if (netrc == NULL) { if (netrc == NULL) {
g_free (netrcname); g_free (netrcname);

Просмотреть файл

@ -31,6 +31,8 @@
#include <signal.h> #include <signal.h>
#include <ctype.h> /* is_digit() */ #include <ctype.h> /* is_digit() */
#include <mhl/string.h>
#include "../src/global.h" #include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */ #include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */ #include "../src/wtools.h" /* message() */
@ -122,7 +124,7 @@ vfs_getid (struct vfs_class *vclass, const char *dir)
vfsid id = NULL; vfsid id = NULL;
/* append slash if needed */ /* append slash if needed */
dir1 = concat_dir_and_file (dir, ""); dir1 = mhl_str_dir_plus_file (dir, "");
if (vclass->getid) if (vclass->getid)
id = (*vclass->getid) (vclass, dir1); id = (*vclass->getid) (vclass, dir1);

Просмотреть файл

@ -406,7 +406,7 @@ mcfs_get_path (mcfs_connection **mc, const char *path)
int f = !strcmp (remote_path, "/~"); int f = !strcmp (remote_path, "/~");
if (f || !strncmp (remote_path, "/~/", 3)) { if (f || !strncmp (remote_path, "/~/", 3)) {
char *s; char *s;
s = concat_dir_and_file (mcfs_gethome (*mc), s = mhl_str_dir_plus_file (mcfs_gethome (*mc),
remote_path + 3 - f); remote_path + 3 - f);
g_free (remote_path); g_free (remote_path);
remote_path = s; remote_path = s;

Просмотреть файл

@ -34,6 +34,8 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <mhl/string.h>
#include "../src/global.h" #include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */ #include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */ #include "../src/wtools.h" /* message() */
@ -336,7 +338,7 @@ static int sfs_init (struct vfs_class *me)
(void) me; (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"); cfg = fopen (mc_sfsini, "r");
if (!cfg){ if (!cfg){

Просмотреть файл

@ -1211,7 +1211,7 @@ smbfs_get_path (smbfs_connection ** sc, const char *path)
int f = !strcmp (remote_path, "/~"); int f = !strcmp (remote_path, "/~");
if (f || !strncmp (remote_path, "/~/", 3)) { if (f || !strncmp (remote_path, "/~/", 3)) {
char *s; 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); g_free (remote_path);
return s; return s;
} }

Просмотреть файл

@ -38,6 +38,8 @@
#include <signal.h> #include <signal.h>
#include <ctype.h> /* is_digit() */ #include <ctype.h> /* is_digit() */
#include <mhl/string.h>
#include "../src/global.h" #include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */ #include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */ #include "../src/wtools.h" /* message() */
@ -656,7 +658,7 @@ vfs_canon (const char *path)
if (*path != PATH_SEP){ if (*path != PATH_SEP){
char *local, *result; char *local, *result;
local = concat_dir_and_file (current_dir, path); local = mhl_str_dir_plus_file (current_dir, path);
result = vfs_canon (local); result = vfs_canon (local);
g_free (local); g_free (local);