Merge branch '3265_cleanup'

* 3265_cleanup: (22 commits)
  Update po/*.po files.
  tests/lib/search/Makefile.am: fix name of variable.
  Remove code required for GLib < 2.14.0.
  Minimal version of GLib is 2.14.0
  Ticket #3405: mcview: use VIEW_SELECTED_COLOR in plain mode.
  Hints: capitalize Lynx since it is the proper noun.
  (dirsize_status_update_cb): use local variables instead of type casting.
  doc/NEWS: cosmetics.
  (input_execute_cmd): refactoring.
  * background.c (background_attention): Fix memory leak.
  g_utf8_next_char() never returns NULL. Remove redundant checks.
  diffviewer: clarify support of UTF-8 codeset.
  Ticket #3246: misc/mcedit.menu.in: better grammar.
  Ticket #3262: rename variables.
  Add IS_PATH_SEP macro and use it.
  (edit_get_match_keyword_cmd): use PATH_SEP_STR instead of G_DIR_SEPARATOR_S.
  Update copyright years.
  (mc_search_regex_prepare_replace_str): refactoring.
  lib/search/regex.c: use [] to get char in string.
  (mc_search_prepare_replace_str2): make replace_str const.
  ...
This commit is contained in:
Andrew Borodin 2015-02-26 09:57:46 +03:00
commit a03fe94170
307 changed files with 1372 additions and 1444 deletions

View File

@ -19,7 +19,7 @@ required:
Autoconf 2.52 and above (latest is recommended) Autoconf 2.52 and above (latest is recommended)
Automake 1.5 and above (latest is recommended) Automake 1.5 and above (latest is recommended)
Gettext 0.11.5 and above Gettext 0.11.5 and above
Glib 2.8 and above (2.14 and higher is recommended) Glib 2.14 and above
Full list of requirements you can see at: Full list of requirements you can see at:
http://www.midnight-commander.org/wiki/doc/buildAndInstall/req http://www.midnight-commander.org/wiki/doc/buildAndInstall/req

View File

@ -386,7 +386,7 @@ get glib from
ftp://ftp.gtk.org/pub/glib/ ftp://ftp.gtk.org/pub/glib/
Minimal version of glib: 2.8.x Minimal version of glib: 2.14.x
Recommended version: 2.14.x and higher. Recommended version: 2.14.x and higher.
Newer versions may work, but haven't been tested. Newer versions may work, but haven't been tested.

View File

@ -1,8 +1,7 @@
Read the INSTALL file for the complete instructions. Read the INSTALL file for the complete instructions.
GNU Midnight Commander requires glib. Currently the 1.2.x and 2.0.x GNU Midnight Commander requires glib2. You may already have glib
series are supported. You may already have glib installed, but if you installed, but if you don't, take it from ftp://ftp.gtk.org/pub/gtk/
don't, take it from ftp://ftp.gtk.org/pub/gtk/
GNU Midnight Commander uses the S-Lang screen library by default. It GNU Midnight Commander uses the S-Lang screen library by default. It
tries the S-Lang library installed on the system. If it's not found, tries the S-Lang library installed on the system. If it's not found,

View File

@ -1,24 +1,29 @@
Version 4.8.13 Version 4.8.13
-Core - Core
* New engine of user-friendly interruption of long-time operations (#2136) * New engine of user-friendly interruption of long-time operations (#2136)
- Editor - Editor
* Improvements of syntax highlighting: * Improvements of syntax highlighting:
* CMake (#3216) * CMake (#3216)
* PHP (#3230) * PHP (#3230)
* Translate language names in the spelling assistant dialogue (#3233) * Translate language names in the spelling assistant dialogue (#3233)
-Viewer - Viewer
* Add separate normal(default) colour pair for viewer (#3204) * Add separate normal(default) colour pair for viewer (#3204)
* Dealing with utf-8 man pages in view/open (#1539) * Dealing with utf-8 man pages in view/open (#1539)
* "Goto line" is 1-based now (#3245) * "Goto line" is 1-based now (#3245)
- Misc - Misc
* Code cleanup (#3189, #3223, #3242) * Code cleanup (#3189, #3223, #3242)
* Add new skins: gray-green-purple256 and gray-orange-blue256 (#3190) * Add new skins: gray-green-purple256 and gray-orange-blue256 (#3190)
- Fixes - Fixes
* First Backspace/Delete is ignored after mouse click in an input widget (#3225) * First Backspace/Delete is ignored after mouse click in an input widget (#3225)
* Recursive find file doesn't work on Samba share (#3097) * Recursive find file doesn't work on Samba share (#3097)
* Recursive find file doesn't work on Windows NFS share (#3202) * Recursive find file doesn't work on Windows NFS share (#3202)
@ -34,6 +39,7 @@ Version 4.8.13
* Incorrect enconding name for manual page (#3239) * Incorrect enconding name for manual page (#3239)
* "User menu -> View manual page" doesn't do coloring (#3243) * "User menu -> View manual page" doesn't do coloring (#3243)
Version 4.8.12 Version 4.8.12
- Core - Core

View File

@ -29,7 +29,7 @@ Dependencies
------------ ------------
To compile the GNU Midnight Commander, you need to have a copy of the To compile the GNU Midnight Commander, you need to have a copy of the
glib library version 2.8.x or newer, available at glib library version 2.14.x or newer, available at
ftp://ftp.gtk.org/pub/glib/ ftp://ftp.gtk.org/pub/glib/

View File

@ -29,7 +29,7 @@ http://www.midnight-commander.org/
Совет: У нас также имеется толковая страница руководства. Совет: У нас также имеется толковая страница руководства.
Совет: Вы хотите навигацию в стиле lynx? Установите это в диалоге Совет: Вы хотите навигацию в стиле Lynx? Установите это в диалоге
Конфигурация. Конфигурация.
Совет: Макросы % работают даже в командной строке. Совет: Макросы % работают даже в командной строке.

View File

@ -24,7 +24,7 @@ Hint: VFS coolness: tap enter on a tar file to examine its contents.
Hint: We also have a nice manual page. Hint: We also have a nice manual page.
Hint: Do you want lynx-style navigation? Set it in the Configuration dialog. Hint: Do you want Lynx-style navigation? Set it in the Configuration dialog.
Hint: % macros work even on the command line. Hint: % macros work even on the command line.

View File

@ -1,7 +1,7 @@
/* /*
Text conversion from one charset to another. Text conversion from one charset to another.
Copyright (C) 2001-2014 Copyright (C) 2001-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Handle events in application. Handle events in application.
Interface functions: init/deinit; start/stop Interface functions: init/deinit; start/stop
Copyright (C) 2011-2014 Copyright (C) 2011-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Handle any events in application. Handle any events in application.
Manage events: add, delete, destroy, search Manage events: add, delete, destroy, search
Copyright (C) 2011-2014 Copyright (C) 2011-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Handle any events in application. Handle any events in application.
Raise events. Raise events.
Copyright (C) 2011-2014 Copyright (C) 2011-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
File highlight plugin. File highlight plugin.
Interface functions Interface functions
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
File highlight plugin. File highlight plugin.
Interface functions. get color pair index for highlighted file. Interface functions. get color pair index for highlighted file.
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
File highlight plugin. File highlight plugin.
Reading and parse rules from ini-files Reading and parse rules from ini-files
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
GLIB - Library of useful routines for C programming GLIB - Library of useful routines for C programming
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:
@ -49,27 +49,6 @@
/*** public functions ****************************************************************************/ /*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
#if ! GLIB_CHECK_VERSION (2, 13, 0)
/*
This is incomplete copy of same glib-function.
For older glib (less than 2.13) functional is enought.
For full version of glib welcome to glib update.
*/
gboolean
g_unichar_iszerowidth (gunichar c)
{
if (G_UNLIKELY (c == 0x00AD))
return FALSE;
if (G_UNLIKELY ((c >= 0x1160 && c < 0x1200) || c == 0x200B))
return TRUE;
return FALSE;
}
#endif /* ! GLIB_CHECK_VERSION (2, 13, 0) */
/* --------------------------------------------------------------------------------------------- */
#if ! GLIB_CHECK_VERSION (2, 16, 0) #if ! GLIB_CHECK_VERSION (2, 16, 0)
/** /**
* g_strcmp0: * g_strcmp0:

View File

@ -15,10 +15,6 @@
/*** declarations of public functions ************************************************************/ /*** declarations of public functions ************************************************************/
#if ! GLIB_CHECK_VERSION (2, 13, 0)
gboolean g_unichar_iszerowidth (gunichar);
#endif /* ! GLIB_CHECK_VERSION (2, 13, 0) */
#if ! GLIB_CHECK_VERSION (2, 16, 0) #if ! GLIB_CHECK_VERSION (2, 16, 0)
int g_strcmp0 (const char *str1, const char *str2); int g_strcmp0 (const char *str1, const char *str2);
#endif /* ! GLIB_CHECK_VERSION (2, 16, 0) */ #endif /* ! GLIB_CHECK_VERSION (2, 16, 0) */

View File

@ -1,7 +1,7 @@
/* /*
Global structure for some library-related variables Global structure for some library-related variables
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -128,6 +128,7 @@
/* OS specific defines */ /* OS specific defines */
#define PATH_SEP '/' #define PATH_SEP '/'
#define PATH_SEP_STR "/" #define PATH_SEP_STR "/"
#define IS_PATH_SEP(c) ((c) == PATH_SEP)
#define PATH_ENV_SEP ':' #define PATH_ENV_SEP ':'
#define TMPDIR_DEFAULT "/tmp" #define TMPDIR_DEFAULT "/tmp"
#define SCRIPT_SUFFIX "" #define SCRIPT_SUFFIX ""

View File

@ -4,7 +4,7 @@
Slavaz: Warning! this file is deprecated and should be replaced Slavaz: Warning! this file is deprecated and should be replaced
by mcevents functional. by mcevents functional.
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Definitions of key bindings. Definitions of key bindings.
Copyright (C) 2005-2014 Copyright (C) 2005-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
File locking File locking
Copyright (C) 2003-2014 Copyright (C) 2003-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Provides a log file to ease tracing the program. Provides a log file to ease tracing the program.
Copyright (C) 2006-2014 Copyright (C) 2006-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Configure module for the Midnight Commander Configure module for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the Midnight Commander. This file is part of the Midnight Commander.

View File

@ -1,7 +1,7 @@
/* /*
Configure module for the Midnight Commander Configure module for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the Midnight Commander. This file is part of the Midnight Commander.

View File

@ -1,7 +1,7 @@
/* /*
paths to configuration files paths to configuration files
Copyright (C) 2010-2014 Copyright (C) 2010-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Configure module for the Midnight Commander Configure module for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the Midnight Commander. This file is part of the Midnight Commander.

View File

@ -144,7 +144,7 @@ gboolean mc_search_is_type_avail (mc_search_type_t);
const mc_search_type_str_t *mc_search_types_list_get (size_t * num); const mc_search_type_str_t *mc_search_types_list_get (size_t * num);
GString *mc_search_prepare_replace_str (mc_search_t * mc_search, GString * replace_str); GString *mc_search_prepare_replace_str (mc_search_t * mc_search, GString * replace_str);
char *mc_search_prepare_replace_str2 (mc_search_t *, char *); char *mc_search_prepare_replace_str2 (mc_search_t * lc_mc_search, const char *replace_str);
gboolean mc_search_is_fixed_search_str (mc_search_t *); gboolean mc_search_is_fixed_search_str (mc_search_t *);

View File

@ -2,7 +2,7 @@
Search text engine. Search text engine.
Glob-style pattern matching Glob-style pattern matching
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Search text engine. Search text engine.
HEX-style pattern matching HEX-style pattern matching
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Search text engine. Search text engine.
Common share code for module. Common share code for module.
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Search text engine. Search text engine.
Plain search Plain search
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,13 +2,13 @@
Search text engine. Search text engine.
Regex search Regex search
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:
Slava Zanko <slavazanko@gmail.com>, 2009, 2010, 2011, 2013 Slava Zanko <slavazanko@gmail.com>, 2009, 2010, 2011, 2013
Vitaliy Filippov <vitalif@yourcmc.ru>, 2011 Vitaliy Filippov <vitalif@yourcmc.ru>, 2011
Andrew Borodin <aborodin@vmail.ru>, 2013, 2014 Andrew Borodin <aborodin@vmail.ru>, 2013-2015
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -65,9 +65,6 @@ static gboolean
mc_search__regex_str_append_if_special (GString * copy_to, const GString * regex_str, mc_search__regex_str_append_if_special (GString * copy_to, const GString * regex_str,
gsize * offset) gsize * offset)
{ {
char *tmp_regex_str;
gsize spec_chr_len;
const char **spec_chr;
const char *special_chars[] = { const char *special_chars[] = {
"\\s", "\\S", "\\s", "\\S",
"\\d", "\\D", "\\d", "\\D",
@ -83,39 +80,41 @@ mc_search__regex_str_append_if_special (GString * copy_to, const GString * regex
"\\E", "\\Q", "\\E", "\\Q",
NULL NULL
}; };
spec_chr = special_chars;
char *tmp_regex_str;
const char **spec_chr;
tmp_regex_str = &(regex_str->str[*offset]); tmp_regex_str = &(regex_str->str[*offset]);
while (*spec_chr) for (spec_chr = special_chars; *spec_chr != NULL; spec_chr++)
{ {
spec_chr_len = strlen (*spec_chr); gsize spec_chr_len;
if (!strncmp (tmp_regex_str, *spec_chr, spec_chr_len))
{
if (!strutils_is_char_escaped (regex_str->str, tmp_regex_str))
{
if (!strncmp ("\\x", *spec_chr, spec_chr_len))
{
if (*(tmp_regex_str + spec_chr_len) == '{')
{
while ((spec_chr_len < regex_str->len - *offset)
&& *(tmp_regex_str + spec_chr_len) != '}')
spec_chr_len++;
if (*(tmp_regex_str + spec_chr_len) == '}')
spec_chr_len++;
}
else
spec_chr_len += 2;
}
g_string_append_len (copy_to, tmp_regex_str, spec_chr_len);
*offset += spec_chr_len;
return TRUE;
}
}
spec_chr++;
}
return FALSE;
spec_chr_len = strlen (*spec_chr);
if (strncmp (tmp_regex_str, *spec_chr, spec_chr_len) == 0
&& !strutils_is_char_escaped (regex_str->str, tmp_regex_str))
{
if (strncmp ("\\x", *spec_chr, spec_chr_len) == 0)
{
if (tmp_regex_str[spec_chr_len] != '{')
spec_chr_len += 2;
else
{
while ((spec_chr_len < regex_str->len - *offset)
&& tmp_regex_str[spec_chr_len] != '}')
spec_chr_len++;
if (tmp_regex_str[spec_chr_len] == '}')
spec_chr_len++;
}
}
g_string_append_len (copy_to, tmp_regex_str, spec_chr_len);
*offset += spec_chr_len;
return TRUE;
}
}
return FALSE;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
@ -382,17 +381,18 @@ mc_search_regex__replace_handle_esc_seq (const GString * replace_str, const gsiz
gsize * skip_len, int *ret) gsize * skip_len, int *ret)
{ {
char *curr_str = &(replace_str->str[current_pos]); char *curr_str = &(replace_str->str[current_pos]);
char c = *(curr_str + 1); char c = curr_str[1];
if (replace_str->len > current_pos + 2) if (replace_str->len > current_pos + 2)
{ {
if (c == '{') if (c == '{')
{ {
for (*skip_len = 2; /* \{ */ for (*skip_len = 2; /* \{ */
current_pos + *skip_len < replace_str->len current_pos + *skip_len < replace_str->len && curr_str[*skip_len] >= '0'
&& *(curr_str + *skip_len) >= '0' && curr_str[*skip_len] <= '7'; (*skip_len)++)
&& *(curr_str + *skip_len) <= '7'; (*skip_len)++); ;
if (current_pos + *skip_len < replace_str->len && *(curr_str + *skip_len) == '}')
if (current_pos + *skip_len < replace_str->len && curr_str[*skip_len] == '}')
{ {
(*skip_len)++; (*skip_len)++;
*ret = REPLACE_PREPARE_T_ESCAPE_SEQ; *ret = REPLACE_PREPARE_T_ESCAPE_SEQ;
@ -408,13 +408,15 @@ mc_search_regex__replace_handle_esc_seq (const GString * replace_str, const gsiz
if (c == 'x') if (c == 'x')
{ {
*skip_len = 2; /* \x */ *skip_len = 2; /* \x */
c = *(curr_str + 2); c = curr_str[2];
if (c == '{') if (c == '{')
{ {
for (*skip_len = 3; /* \x{ */ for (*skip_len = 3; /* \x{ */
current_pos + *skip_len < replace_str->len current_pos + *skip_len < replace_str->len
&& g_ascii_isxdigit ((guchar) * (curr_str + *skip_len)); (*skip_len)++); && g_ascii_isxdigit ((guchar) curr_str[*skip_len]); (*skip_len)++)
if (current_pos + *skip_len < replace_str->len && *(curr_str + *skip_len) == '}') ;
if (current_pos + *skip_len < replace_str->len && curr_str[*skip_len] == '}')
{ {
(*skip_len)++; (*skip_len)++;
*ret = REPLACE_PREPARE_T_ESCAPE_SEQ; *ret = REPLACE_PREPARE_T_ESCAPE_SEQ;
@ -434,7 +436,7 @@ mc_search_regex__replace_handle_esc_seq (const GString * replace_str, const gsiz
} }
else else
{ {
c = *(curr_str + 3); c = curr_str[3];
if (!g_ascii_isxdigit ((guchar) c)) if (!g_ascii_isxdigit ((guchar) c))
*skip_len = 3; /* \xH */ *skip_len = 3; /* \xH */
else else
@ -468,8 +470,8 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
*skip_len = 0; *skip_len = 0;
if ((*curr_str == '$') && (*(curr_str + 1) == '{') && ((*(curr_str + 2) & (char) 0xf0) == 0x30) if (replace_str->len > current_pos + 2 && curr_str[0] == '$' && curr_str[1] == '{'
&& (replace_str->len > current_pos + 2)) && (curr_str[2] & (char) 0xf0) == 0x30)
{ {
char *tmp_str; char *tmp_str;
@ -481,9 +483,10 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
for (*skip_len = 0; for (*skip_len = 0;
current_pos + *skip_len + 2 < replace_str->len current_pos + *skip_len + 2 < replace_str->len
&& (*(curr_str + 2 + *skip_len) & (char) 0xf0) == 0x30; (*skip_len)++); && (curr_str[2 + *skip_len] & (char) 0xf0) == 0x30; (*skip_len)++)
;
if (*(curr_str + 2 + *skip_len) != '}') if (curr_str[2 + *skip_len] != '}')
return REPLACE_PREPARE_T_NOTHING_SPECIAL; return REPLACE_PREPARE_T_NOTHING_SPECIAL;
tmp_str = g_strndup (curr_str + 2, *skip_len); tmp_str = g_strndup (curr_str + 2, *skip_len);
@ -497,7 +500,7 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
return ret; /* capture buffer index >= 0 */ return ret; /* capture buffer index >= 0 */
} }
if ((*curr_str == '\\') && (replace_str->len > current_pos + 1)) if (curr_str[0] == '\\' && replace_str->len > current_pos + 1)
{ {
if (strutils_is_char_escaped (replace_str->str, curr_str)) if (strutils_is_char_escaped (replace_str->str, curr_str))
{ {
@ -505,9 +508,9 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
return REPLACE_PREPARE_T_NOTHING_SPECIAL; return REPLACE_PREPARE_T_NOTHING_SPECIAL;
} }
if (g_ascii_isdigit (*(curr_str + 1))) if (g_ascii_isdigit (curr_str[1]))
{ {
ret = g_ascii_digit_value (*(curr_str + 1)); /* capture buffer index >= 0 */ ret = g_ascii_digit_value (curr_str[1]); /* capture buffer index >= 0 */
*skip_len = 2; /* \\ and one digit */ *skip_len = 2; /* \\ and one digit */
return ret; return ret;
} }
@ -517,7 +520,8 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
ret = REPLACE_PREPARE_T_REPLACE_FLAG; ret = REPLACE_PREPARE_T_REPLACE_FLAG;
*skip_len += 2; *skip_len += 2;
switch (*(curr_str + 1))
switch (curr_str[1])
{ {
case 'U': case 'U':
*replace_flags |= REPLACE_T_UPP_TRANSFORM; *replace_flags |= REPLACE_T_UPP_TRANSFORM;
@ -556,7 +560,7 @@ mc_search_regex__process_append_str (GString * dest_str, const char *from, gsize
if (len == (gsize) (-1)) if (len == (gsize) (-1))
len = strlen (from); len = strlen (from);
if ((*replace_flags == REPLACE_T_NO_TRANSFORM) != 0) if (*replace_flags == REPLACE_T_NO_TRANSFORM)
{ {
g_string_append_len (dest_str, from, len); g_string_append_len (dest_str, from, len);
return; return;
@ -616,6 +620,7 @@ mc_search_regex__process_escape_sequence (GString * dest_str, const char *from,
len = strlen (from); len = strlen (from);
if (len == 0) if (len == 0)
return; return;
if (from[i] == '{') if (from[i] == '{')
i++; i++;
if (i >= len) if (i >= len)
@ -935,8 +940,7 @@ mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * repla
int num_replace_tokens; int num_replace_tokens;
gsize loop; gsize loop;
gsize len = 0; gsize prev = 0;
gchar *prev_str;
replace_transform_type_t replace_flags = REPLACE_T_NO_TRANSFORM; replace_transform_type_t replace_flags = REPLACE_T_NO_TRANSFORM;
num_replace_tokens = num_replace_tokens =
@ -954,12 +958,12 @@ mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * repla
} }
ret = g_string_sized_new (64); ret = g_string_sized_new (64);
prev_str = replace_str->str;
for (loop = 0; loop < replace_str->len - 1; loop++) for (loop = 0; loop < replace_str->len - 1; loop++)
{ {
int lc_index; int lc_index;
gchar *tmp_str; gchar *tmp_str;
gsize len = 0;
lc_index = mc_search_regex__process_replace_str (replace_str, loop, &len, &replace_flags); lc_index = mc_search_regex__process_replace_str (replace_str, loop, &len, &replace_flags);
@ -967,39 +971,37 @@ mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * repla
{ {
if (len != 0) if (len != 0)
{ {
mc_search_regex__process_append_str (ret, prev_str, mc_search_regex__process_append_str (ret, replace_str->str + prev, loop - prev,
replace_str->str - prev_str + loop,
&replace_flags); &replace_flags);
mc_search_regex__process_append_str (ret, replace_str->str + loop + 1, len - 1, mc_search_regex__process_append_str (ret, replace_str->str + loop + 1, len - 1,
&replace_flags); &replace_flags);
prev_str = replace_str->str + loop + len; prev = loop + len;
loop += len - 1; loop = prev - 1; /* prepare to loop++ */
} }
continue; continue;
} }
if (lc_index == REPLACE_PREPARE_T_REPLACE_FLAG) if (lc_index == REPLACE_PREPARE_T_REPLACE_FLAG)
{ {
if (loop) if (loop != 0)
mc_search_regex__process_append_str (ret, prev_str, mc_search_regex__process_append_str (ret, replace_str->str + prev, loop - prev,
replace_str->str - prev_str + loop,
&replace_flags); &replace_flags);
prev_str = replace_str->str + loop + len; prev = loop + len;
loop += len - 1; loop = prev - 1; /* prepare to loop++ */
continue; continue;
} }
/* escape sequence */ /* escape sequence */
if (lc_index == REPLACE_PREPARE_T_ESCAPE_SEQ) if (lc_index == REPLACE_PREPARE_T_ESCAPE_SEQ)
{ {
mc_search_regex__process_append_str (ret, prev_str, mc_search_regex__process_append_str (ret, replace_str->str + prev, loop - prev,
replace_str->str + loop - prev_str,
&replace_flags); &replace_flags);
/* call process_escape_sequence without starting '\\' */ /* call process_escape_sequence without starting '\\' */
mc_search_regex__process_escape_sequence (ret, replace_str->str + loop + 1, len - 1, mc_search_regex__process_escape_sequence (ret, replace_str->str + loop + 1, len - 1,
&replace_flags, lc_mc_search->is_utf8); &replace_flags, lc_mc_search->is_utf8);
prev_str = replace_str->str + loop + len; prev = loop + len;
loop += len - 1; loop = prev - 1; /* prepare to loop++ */
continue; continue;
} }
@ -1014,17 +1016,18 @@ mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * repla
tmp_str = mc_search_regex__get_token_by_num (lc_mc_search, lc_index); tmp_str = mc_search_regex__get_token_by_num (lc_mc_search, lc_index);
if (loop) if (loop != 0)
mc_search_regex__process_append_str (ret, prev_str, replace_str->str - prev_str + loop, mc_search_regex__process_append_str (ret, replace_str->str + prev, loop - prev,
&replace_flags); &replace_flags);
prev_str = replace_str->str + loop + len;
mc_search_regex__process_append_str (ret, tmp_str, -1, &replace_flags); mc_search_regex__process_append_str (ret, tmp_str, -1, &replace_flags);
g_free (tmp_str); g_free (tmp_str);
loop += len - 1;
prev = loop + len;
loop = prev - 1; /* prepare to loop++ */
} }
mc_search_regex__process_append_str (ret, prev_str,
replace_str->str - prev_str + replace_str->len, mc_search_regex__process_append_str (ret, replace_str->str + prev, replace_str->len - prev,
&replace_flags); &replace_flags);
return ret; return ret;

View File

@ -2,7 +2,7 @@
Search text engine. Search text engine.
Interface functions Interface functions
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:
@ -366,7 +366,7 @@ mc_search_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
char * char *
mc_search_prepare_replace_str2 (mc_search_t * lc_mc_search, char *replace_str) mc_search_prepare_replace_str2 (mc_search_t * lc_mc_search, const char *replace_str)
{ {
GString *ret; GString *ret;
GString *replace_str2; GString *replace_str2;

View File

@ -1,7 +1,7 @@
/* /*
Provides a serialize/unserialize functionality for INI-like formats. Provides a serialize/unserialize functionality for INI-like formats.
Copyright (C) 2011-2014 Copyright (C) 2011-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Skins engine. Skins engine.
Work with colors - backward compatibility Work with colors - backward compatibility
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Skins engine. Skins engine.
Work with colors Work with colors
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Skins engine. Skins engine.
Interface functions Interface functions
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Skins engine. Skins engine.
Set of hardcoded skins Set of hardcoded skins
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Skins engine. Skins engine.
Reading and parse ini-files Reading and parse ini-files
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Skins engine. Skins engine.
Work with line draving chars. Work with line draving chars.
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Functions for replacing substrings in strings. Functions for replacing substrings in strings.
Copyright (C) 2013-2014 Copyright (C) 2013-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Functions for escaping and unescaping strings Functions for escaping and unescaping strings
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Common strings utilities Common strings utilities
Copyright (C) 2007-2014 Copyright (C) 2007-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:
@ -264,17 +264,7 @@ str_printf (GString * buffer, const char *format, ...)
va_list ap; va_list ap;
va_start (ap, format); va_start (ap, format);
#if GLIB_CHECK_VERSION (2, 14, 0)
g_string_append_vprintf (buffer, format, ap); g_string_append_vprintf (buffer, format, ap);
#else
{
gchar *tmp;
tmp = g_strdup_vprintf (format, ap);
g_string_append (buffer, tmp);
g_free (tmp);
}
#endif
va_end (ap); va_end (ap);
} }

View File

@ -1,7 +1,7 @@
/* /*
8bit strings utilities 8bit strings utilities
Copyright (C) 2007-2014 Copyright (C) 2007-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
ASCII strings utilities ASCII strings utilities
Copyright (C) 2007-2014 Copyright (C) 2007-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
UTF-8 strings utilities UTF-8 strings utilities
Copyright (C) 2007-2014 Copyright (C) 2007-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Compare strings while treating digits characters numerically. Compare strings while treating digits characters numerically.
Copyright (C) 1997-2014 Copyright (C) 1997-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.

View File

@ -1,6 +1,6 @@
/* A more useful interface to strtol. /* A more useful interface to strtol.
Copyright (C) 1995-2014 Copyright (C) 1995-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
/* /*
Time formatting functions Time formatting functions
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Simple timer for the Midnight Commander. Simple timer for the Midnight Commander.
Copyright (C) 2013-2014 Copyright (C) 2013-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Internal stuff of color setup Internal stuff of color setup
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Color setup for NCurses screen library Color setup for NCurses screen library
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Color setup for S_Lang screen library Color setup for S_Lang screen library
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Color setup. Color setup.
Interface functions. Interface functions.
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Keyboard support routines. Keyboard support routines.
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -3,7 +3,7 @@
/* /*
Additional keyboard support routines. Additional keyboard support routines.
Copyright (C) 1998-2014 Copyright (C) 1998-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Mouse managing Mouse managing
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Interface to the terminal controlling library. Interface to the terminal controlling library.
Ncurses wrapper. Ncurses wrapper.
Copyright (C) 2005-2014 Copyright (C) 2005-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -2,7 +2,7 @@
Interface to the terminal controlling library. Interface to the terminal controlling library.
Slang wrapper. Slang wrapper.
Copyright (C) 2005-2014 Copyright (C) 2005-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Interface to the terminal controlling library. Interface to the terminal controlling library.
Copyright (C) 2005-2014 Copyright (C) 2005-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Terminal management xterm and rxvt support Terminal management xterm and rxvt support
Copyright (C) 1995-2014 Copyright (C) 1995-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
X11 support for the Midnight Commander. X11 support for the Midnight Commander.
Copyright (C) 2005-2014 Copyright (C) 2005-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Various utilities Various utilities
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:
@ -152,28 +152,28 @@ resolve_symlinks (const vfs_path_t * vpath)
goto ret; goto ret;
} }
buf2[len] = 0; buf2[len] = 0;
if (*buf2 == PATH_SEP) if (IS_PATH_SEP (*buf2))
strcpy (buf, buf2); strcpy (buf, buf2);
else else
strcpy (r, buf2); strcpy (r, buf2);
} }
canonicalize_pathname (buf); canonicalize_pathname (buf);
r = strchr (buf, 0); r = strchr (buf, 0);
if (!*r || *(r - 1) != PATH_SEP) if (*r == '\0' || !IS_PATH_SEP (r[-1]))
/* FIXME: this condition is always true because r points to the EOL */ /* FIXME: this condition is always true because r points to the EOL */
{ {
*r++ = PATH_SEP; *r++ = PATH_SEP;
*r = 0; *r = '\0';
} }
*q = c; *q = c;
p = q; p = q;
} }
while (c != '\0'); while (c != '\0');
if (!*buf) if (*buf == '\0')
strcpy (buf, PATH_SEP_STR); strcpy (buf, PATH_SEP_STR);
else if (*(r - 1) == PATH_SEP && r != buf + 1) else if (IS_PATH_SEP (r[-1]) && r != buf + 1)
*(r - 1) = 0; r[-1] = '\0';
ret: ret:
g_free (buf2); g_free (buf2);
@ -653,17 +653,18 @@ x_basename (const char *s)
|| url_delim - s + strlen (VFS_PATH_URL_DELIMITER) < strlen (s)) || url_delim - s + strlen (VFS_PATH_URL_DELIMITER) < strlen (s))
{ {
/* avoid trailing PATH_SEP, if present */ /* avoid trailing PATH_SEP, if present */
if (s[strlen (s) - 1] == PATH_SEP) if (!IS_PATH_SEP (s[strlen (s) - 1]))
{
while (--path_sep > s && *path_sep != PATH_SEP);
return (path_sep != s) ? path_sep + 1 : s;
}
else
return (path_sep != NULL) ? path_sep + 1 : s; return (path_sep != NULL) ? path_sep + 1 : s;
while (--path_sep > s && !IS_PATH_SEP (*path_sep))
;
return (path_sep != s) ? path_sep + 1 : s;
} }
while (--url_delim > s && *url_delim != PATH_SEP); while (--url_delim > s && !IS_PATH_SEP (*url_delim))
while (--url_delim > s && *url_delim != PATH_SEP); ;
while (--url_delim > s && !IS_PATH_SEP (*url_delim))
;
return (url_delim == s) ? s : url_delim + 1; return (url_delim == s) ? s : url_delim + 1;
} }

View File

@ -1,7 +1,7 @@
/* /*
Various utilities - Unix variants Various utilities - Unix variants
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:
@ -684,10 +684,10 @@ tilde_expand (const char *directory)
p = directory + 1; p = directory + 1;
/* d = "~" or d = "~/" */ /* d = "~" or d = "~/" */
if (!(*p) || (*p == PATH_SEP)) if (*p == '\0' || IS_PATH_SEP (*p))
{ {
passwd = getpwuid (geteuid ()); passwd = getpwuid (geteuid ());
q = (*p == PATH_SEP) ? p + 1 : ""; q = IS_PATH_SEP (*p) ? p + 1 : "";
} }
else else
{ {
@ -843,12 +843,12 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
const size_t url_delim_len = strlen (VFS_PATH_URL_DELIMITER); const size_t url_delim_len = strlen (VFS_PATH_URL_DELIMITER);
/* Detect and preserve UNC paths: //server/... */ /* Detect and preserve UNC paths: //server/... */
if ((flags & CANON_PATH_GUARDUNC) && path[0] == PATH_SEP && path[1] == PATH_SEP) if ((flags & CANON_PATH_GUARDUNC) != 0 && IS_PATH_SEP (path[0]) && IS_PATH_SEP (path[1]))
{ {
p = path + 2; p = path + 2;
while (p[0] && p[0] != '/') while (p[0] != '\0' && !IS_PATH_SEP (p[0]))
p++; p++;
if (p[0] == '/' && p > path + 2) if (IS_PATH_SEP (p[0]) && p > path + 2)
lpath = p; lpath = p;
} }
@ -861,10 +861,11 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
p = lpath; p = lpath;
while (*p) while (*p)
{ {
if (p[0] == PATH_SEP && p[1] == PATH_SEP && (p == lpath || *(p - 1) != ':')) if (IS_PATH_SEP (p[0]) && IS_PATH_SEP (p[1]) && (p == lpath || *(p - 1) != ':'))
{ {
s = p + 1; s = p + 1;
while (*(++s) == PATH_SEP); while (IS_PATH_SEP (*(++s)))
;
str_move (p + 1, s); str_move (p + 1, s);
} }
p++; p++;
@ -877,7 +878,7 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
p = lpath; p = lpath;
while (*p) while (*p)
{ {
if (p[0] == PATH_SEP && p[1] == '.' && p[2] == PATH_SEP) if (IS_PATH_SEP (p[0]) && p[1] == '.' && IS_PATH_SEP (p[2]))
str_move (p, p + 2); str_move (p, p + 2);
else else
p++; p++;
@ -890,7 +891,7 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
/* Remove trailing slashes */ /* Remove trailing slashes */
p = lpath + strlen (lpath) - 1; p = lpath + strlen (lpath) - 1;
while (p > lpath && *p == PATH_SEP) while (p > lpath && IS_PATH_SEP (*p))
{ {
if (p >= lpath - (url_delim_len + 1) if (p >= lpath - (url_delim_len + 1)
&& strncmp (p - url_delim_len + 1, VFS_PATH_URL_DELIMITER, url_delim_len) == 0) && strncmp (p - url_delim_len + 1, VFS_PATH_URL_DELIMITER, url_delim_len) == 0)
@ -899,7 +900,7 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
} }
/* Remove leading "./" */ /* Remove leading "./" */
if (lpath[0] == '.' && lpath[1] == PATH_SEP) if (lpath[0] == '.' && IS_PATH_SEP (lpath[1]))
{ {
if (lpath[2] == 0) if (lpath[2] == 0)
{ {
@ -916,7 +917,7 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
len = strlen (lpath); len = strlen (lpath);
if (len < 2) if (len < 2)
return; return;
if (lpath[len - 1] == PATH_SEP if (IS_PATH_SEP (lpath[len - 1])
&& (len < url_delim_len && (len < url_delim_len
|| strncmp (lpath + len - url_delim_len, VFS_PATH_URL_DELIMITER, || strncmp (lpath + len - url_delim_len, VFS_PATH_URL_DELIMITER,
url_delim_len) != 0)) url_delim_len) != 0))
@ -925,7 +926,7 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
} }
else else
{ {
if (lpath[len - 1] == '.' && lpath[len - 2] == PATH_SEP) if (lpath[len - 1] == '.' && IS_PATH_SEP (lpath[len - 2]))
{ {
if (len == 2) if (len == 2)
{ {
@ -950,7 +951,8 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
p = lpath; p = lpath;
while (p[0] && p[1] && p[2]) while (p[0] && p[1] && p[2])
{ {
if ((p[0] != PATH_SEP || p[1] != '.' || p[2] != '.') || (p[3] != PATH_SEP && p[3] != 0)) if (!IS_PATH_SEP (p[0]) || p[1] != '.' || p[2] != '.'
|| (!IS_PATH_SEP (p[3]) && p[3] != '\0'))
{ {
p++; p++;
continue; continue;
@ -962,7 +964,8 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
&& strncmp (s - url_delim_len + 2, VFS_PATH_URL_DELIMITER, url_delim_len) == 0) && strncmp (s - url_delim_len + 2, VFS_PATH_URL_DELIMITER, url_delim_len) == 0)
{ {
s -= (url_delim_len - 2); s -= (url_delim_len - 2);
while (s >= lpath && *s-- != PATH_SEP); while (s >= lpath && !IS_PATH_SEP (*s--))
;
} }
while (s >= lpath) while (s >= lpath)
@ -973,8 +976,9 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
char *vfs_prefix = s - url_delim_len; char *vfs_prefix = s - url_delim_len;
struct vfs_class *vclass; struct vfs_class *vclass;
while (vfs_prefix > lpath && *--vfs_prefix != PATH_SEP); while (vfs_prefix > lpath && !IS_PATH_SEP (*--vfs_prefix))
if (*vfs_prefix == PATH_SEP) ;
if (IS_PATH_SEP (*vfs_prefix))
vfs_prefix++; vfs_prefix++;
*(s - url_delim_len) = '\0'; *(s - url_delim_len) = '\0';
@ -992,7 +996,7 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
} }
} }
if (*s == PATH_SEP) if (IS_PATH_SEP (*s))
break; break;
s--; s--;
@ -1009,7 +1013,7 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
if (p[3] != 0) if (p[3] != 0)
{ {
if (s == lpath && *s == PATH_SEP) if (s == lpath && IS_PATH_SEP (*s))
{ {
/* "/../foo" -> "/foo" */ /* "/../foo" -> "/foo" */
str_move (s + 1, p + 4); str_move (s + 1, p + 4);
@ -1034,17 +1038,15 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
if (s == lpath) if (s == lpath)
{ {
/* "token/.." -> "." */ /* "token/.." -> "." */
if (lpath[0] != PATH_SEP) if (!IS_PATH_SEP (lpath[0]))
{
lpath[0] = '.'; lpath[0] = '.';
} lpath[1] = '\0';
lpath[1] = 0;
} }
else else
{ {
/* "foo/token/.." -> "foo" */ /* "foo/token/.." -> "foo" */
if (s == lpath + 1) if (s == lpath + 1)
s[0] = 0; s[0] = '\0';
#ifdef HAVE_CHARSET #ifdef HAVE_CHARSET
else if ((strncmp (s, VFS_ENCODING_PREFIX, enc_prefix_len) == 0) else if ((strncmp (s, VFS_ENCODING_PREFIX, enc_prefix_len) == 0)
&& (is_supported_encoding (s + enc_prefix_len))) && (is_supported_encoding (s + enc_prefix_len)))
@ -1055,9 +1057,9 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
s[2] = '\0'; s[2] = '\0';
/* search for the previous token */ /* search for the previous token */
/* s[-1] == PATH_SEP */ /* IS_PATH_SEP (s[-1]) */
p = s - 1; p = s - 1;
while (p >= lpath && *p != PATH_SEP) while (p >= lpath && !IS_PATH_SEP (*p))
p--; p--;
if (p >= lpath) if (p >= lpath)
@ -1121,9 +1123,8 @@ mc_realpath (const char *path, char *resolved_path)
path = copy_path; path = copy_path;
max_path = copy_path + PATH_MAX - 2; max_path = copy_path + PATH_MAX - 2;
/* If it's a relative pathname use getwd for starters. */ /* If it's a relative pathname use getwd for starters. */
if (*path != '/') if (!IS_PATH_SEP (*path))
{ {
new_path = g_get_current_dir (); new_path = g_get_current_dir ();
if (new_path == NULL) if (new_path == NULL)
{ {
@ -1137,19 +1138,19 @@ mc_realpath (const char *path, char *resolved_path)
} }
new_path += strlen (got_path); new_path += strlen (got_path);
if (new_path[-1] != '/') if (!IS_PATH_SEP (new_path[-1]))
*new_path++ = '/'; *new_path++ = PATH_SEP;
} }
else else
{ {
*new_path++ = '/'; *new_path++ = PATH_SEP;
path++; path++;
} }
/* Expand each slash-separated pathname component. */ /* Expand each slash-separated pathname component. */
while (*path != '\0') while (*path != '\0')
{ {
/* Ignore stray "/". */ /* Ignore stray "/". */
if (*path == '/') if (IS_PATH_SEP (*path))
{ {
path++; path++;
continue; continue;
@ -1157,27 +1158,28 @@ mc_realpath (const char *path, char *resolved_path)
if (*path == '.') if (*path == '.')
{ {
/* Ignore ".". */ /* Ignore ".". */
if (path[1] == '\0' || path[1] == '/') if (path[1] == '\0' || IS_PATH_SEP (path[1]))
{ {
path++; path++;
continue; continue;
} }
if (path[1] == '.') if (path[1] == '.')
{ {
if (path[2] == '\0' || path[2] == '/') if (path[2] == '\0' || IS_PATH_SEP (path[2]))
{ {
path += 2; path += 2;
/* Ignore ".." at root. */ /* Ignore ".." at root. */
if (new_path == got_path + 1) if (new_path == got_path + 1)
continue; continue;
/* Handle ".." by backing up. */ /* Handle ".." by backing up. */
while ((--new_path)[-1] != '/'); while (!IS_PATH_SEP ((--new_path)[-1]))
;
continue; continue;
} }
} }
} }
/* Safely copy the next pathname component. */ /* Safely copy the next pathname component. */
while (*path != '\0' && *path != '/') while (*path != '\0' && !IS_PATH_SEP (*path))
{ {
if (path > max_path) if (path > max_path)
{ {
@ -1211,12 +1213,13 @@ mc_realpath (const char *path, char *resolved_path)
{ {
/* Note: readlink doesn't add the null byte. */ /* Note: readlink doesn't add the null byte. */
link_path[n] = '\0'; link_path[n] = '\0';
if (*link_path == '/') if (IS_PATH_SEP (*link_path))
/* Start over for an absolute symlink. */ /* Start over for an absolute symlink. */
new_path = got_path; new_path = got_path;
else else
/* Otherwise back up over this component. */ /* Otherwise back up over this component. */
while (*(--new_path) != '/'); while (!IS_PATH_SEP (*(--new_path)))
;
/* Safe sex check. */ /* Safe sex check. */
if (strlen (path) + n >= PATH_MAX - 2) if (strlen (path) + n >= PATH_MAX - 2)
{ {
@ -1229,10 +1232,10 @@ mc_realpath (const char *path, char *resolved_path)
path = copy_path; path = copy_path;
} }
#endif /* S_IFLNK */ #endif /* S_IFLNK */
*new_path++ = '/'; *new_path++ = PATH_SEP;
} }
/* Delete trailing slash but don't whomp a lone slash. */ /* Delete trailing slash but don't whomp a lone slash. */
if (new_path != got_path + 1 && new_path[-1] == '/') if (new_path != got_path + 1 && IS_PATH_SEP (new_path[-1]))
new_path--; new_path--;
/* Make sure it's null terminated. */ /* Make sure it's null terminated. */
*new_path = '\0'; *new_path = '\0';
@ -1313,7 +1316,7 @@ mc_build_filenamev (const char *first_element, va_list args)
path = g_string_new (""); path = g_string_new ("");
absolute = (*first_element != '\0' && *first_element == PATH_SEP); absolute = IS_PATH_SEP (*first_element);
do do
{ {
@ -1331,10 +1334,10 @@ mc_build_filenamev (const char *first_element, va_list args)
canonicalize_pathname (tmp_element); canonicalize_pathname (tmp_element);
len = strlen (tmp_element); len = strlen (tmp_element);
start = (tmp_element[0] == PATH_SEP) ? tmp_element + 1 : tmp_element; start = IS_PATH_SEP (tmp_element[0]) ? tmp_element + 1 : tmp_element;
g_string_append (path, start); g_string_append (path, start);
if (tmp_element[len - 1] != PATH_SEP && element != NULL) if (!IS_PATH_SEP (tmp_element[len - 1]) && element != NULL)
g_string_append_c (path, PATH_SEP); g_string_append_c (path, PATH_SEP);
g_free (tmp_element); g_free (tmp_element);

View File

@ -1,7 +1,7 @@
/* /*
Directory cache support Directory cache support
Copyright (C) 1998-2014 Copyright (C) 1998-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:
@ -155,12 +155,14 @@ vfs_s_resolve_symlink (struct vfs_class *me, struct vfs_s_entry *entry, int foll
ERRNOR (EFAULT, NULL); ERRNOR (EFAULT, NULL);
/* make full path from relative */ /* make full path from relative */
if (*linkname != PATH_SEP) if (!IS_PATH_SEP (*linkname))
{ {
char *fullpath = vfs_s_fullpath (me, entry->dir); char *fullpath;
if (fullpath)
fullpath = vfs_s_fullpath (me, entry->dir);
if (fullpath != NULL)
{ {
fullname = g_strconcat (fullpath, "/", linkname, (char *) NULL); fullname = g_strconcat (fullpath, PATH_SEP_STR, linkname, (char *) NULL);
linkname = fullname; linkname = fullname;
g_free (fullpath); g_free (fullpath);
} }
@ -193,7 +195,7 @@ vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
{ {
GList *iter; GList *iter;
while (*path == PATH_SEP) /* Strip leading '/' */ while (IS_PATH_SEP (*path)) /* Strip leading '/' */
path++; path++;
if (path[0] == '\0') if (path[0] == '\0')
@ -202,7 +204,7 @@ vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
return ent; return ent;
} }
for (pseg = 0; path[pseg] != '\0' && path[pseg] != PATH_SEP; pseg++) for (pseg = 0; path[pseg] != '\0' && !IS_PATH_SEP (path[pseg]); pseg++)
; ;
for (iter = root->subdir; iter != NULL; iter = g_list_next (iter)) for (iter = root->subdir; iter != NULL; iter = g_list_next (iter))
@ -726,7 +728,7 @@ vfs_s_fill_names (struct vfs_class *me, fill_names_f func)
const struct vfs_s_super *super = (const struct vfs_s_super *) iter->data; const struct vfs_s_super *super = (const struct vfs_s_super *) iter->data;
char *name; char *name;
name = g_strconcat (super->name, "/", me->prefix, VFS_PATH_URL_DELIMITER, name = g_strconcat (super->name, PATH_SEP_STR, me->prefix, VFS_PATH_URL_DELIMITER,
/* super->current_dir->name, */ (char *) NULL); /* super->current_dir->name, */ (char *) NULL);
func (name); func (name);
g_free (name); g_free (name);
@ -1196,7 +1198,7 @@ vfs_s_fullpath (struct vfs_class *me, struct vfs_s_inode *ino)
ino = ino->ent->dir; ino = ino->ent->dir;
if (ino == ino->super->root) if (ino == ino->super->root)
break; break;
newpath = g_strconcat (ino->ent->name, "/", path, (char *) NULL); newpath = g_strconcat (ino->ent->name, PATH_SEP_STR, path, (char *) NULL);
g_free (path); g_free (path);
path = newpath; path = newpath;
} }

View File

@ -1,7 +1,7 @@
/* /*
Virtual File System garbage collection code Virtual File System garbage collection code
Copyright (C) 2003-2014 Copyright (C) 2003-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Virtual File System: interface functions Virtual File System: interface functions
Copyright (C) 2011-2014 Copyright (C) 2011-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:
@ -710,7 +710,7 @@ mc_chdir (const vfs_path_t * vpath)
char *p; char *p;
p = strchr (path_element->path, 0) - 1; p = strchr (path_element->path, 0) - 1;
if (*p == PATH_SEP && p > path_element->path) if (IS_PATH_SEP (*p) && p > path_element->path)
*p = '\0'; *p = '\0';
} }
@ -826,10 +826,8 @@ mc_tmpdir (void)
return tmpdir; return tmpdir;
sys_tmp = getenv ("TMPDIR"); sys_tmp = getenv ("TMPDIR");
if (!sys_tmp || sys_tmp[0] != '/') if (sys_tmp == NULL || !IS_PATH_SEP (sys_tmp[0]))
{
sys_tmp = TMPDIR_DEFAULT; sys_tmp = TMPDIR_DEFAULT;
}
pwd = getpwuid (getuid ()); pwd = getpwuid (getuid ());

View File

@ -1,7 +1,7 @@
/* /*
Network utilities for the Midnight Commander Virtual File System. Network utilities for the Midnight Commander Virtual File System.
Copyright (C) 1995-2014 Copyright (C) 1995-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the Midnight Commander. This file is part of the Midnight Commander.

View File

@ -1,7 +1,7 @@
/* /*
Routines for parsing output from the 'ls' command. Routines for parsing output from the 'ls' command.
Copyright (C) 1988-2014 Copyright (C) 1988-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Copyright (C) 1995, 1996 Miguel de Icaza Copyright (C) 1995, 1996 Miguel de Icaza

View File

@ -1,7 +1,7 @@
/* /*
Virtual File System path handlers Virtual File System path handlers
Copyright (C) 2011-2014 Copyright (C) 2011-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:
@ -139,7 +139,7 @@ vfs_canon (const char *path)
vfs_die ("Cannot canonicalize NULL"); vfs_die ("Cannot canonicalize NULL");
/* Relative to current directory */ /* Relative to current directory */
if (*path != PATH_SEP) if (!IS_PATH_SEP (*path))
{ {
char *result, *local; char *result, *local;
@ -198,7 +198,7 @@ vfs_get_encoding (const char *path, ssize_t len)
if (semi == NULL) if (semi == NULL)
return NULL; return NULL;
if (semi == path || *(semi - 1) == PATH_SEP) if (semi == path || IS_PATH_SEP (semi[-1]))
{ {
char *slash; char *slash;
@ -448,11 +448,11 @@ vfs_path_from_str_uri_parser (char *path, vfs_path_flag_t flags)
char *real_vfs_prefix_start = url_delimiter; char *real_vfs_prefix_start = url_delimiter;
struct vfs_s_subclass *sub = NULL; struct vfs_s_subclass *sub = NULL;
while (real_vfs_prefix_start > path && *(real_vfs_prefix_start) != PATH_SEP) while (real_vfs_prefix_start > path && !IS_PATH_SEP (*real_vfs_prefix_start))
real_vfs_prefix_start--; real_vfs_prefix_start--;
vfs_prefix_start = real_vfs_prefix_start; vfs_prefix_start = real_vfs_prefix_start;
if (*(vfs_prefix_start) == PATH_SEP) if (IS_PATH_SEP (*vfs_prefix_start))
vfs_prefix_start += 1; vfs_prefix_start += 1;
*url_delimiter = '\0'; *url_delimiter = '\0';
@ -495,8 +495,8 @@ vfs_path_from_str_uri_parser (char *path, vfs_path_flag_t flags)
#endif #endif
g_array_prepend_val (vpath->path, element); g_array_prepend_val (vpath->path, element);
if ((real_vfs_prefix_start > path && *(real_vfs_prefix_start) == PATH_SEP) || if ((real_vfs_prefix_start > path && IS_PATH_SEP (*real_vfs_prefix_start)) ||
(real_vfs_prefix_start == path && *(real_vfs_prefix_start) != PATH_SEP)) (real_vfs_prefix_start == path && !IS_PATH_SEP (*real_vfs_prefix_start)))
*real_vfs_prefix_start = '\0'; *real_vfs_prefix_start = '\0';
else else
*(real_vfs_prefix_start + 1) = '\0'; *(real_vfs_prefix_start + 1) = '\0';
@ -537,7 +537,7 @@ vfs_path_tokens_add_class_info (const vfs_path_element_t * element, GString * re
{ {
char *url_str; char *url_str;
if (ret_tokens->len > 0 && ret_tokens->str[ret_tokens->len - 1] != PATH_SEP) if (ret_tokens->len > 0 && !IS_PATH_SEP (ret_tokens->str[ret_tokens->len - 1]))
g_string_append_c (ret_tokens, PATH_SEP); g_string_append_c (ret_tokens, PATH_SEP);
g_string_append (ret_tokens, element->vfs_prefix); g_string_append (ret_tokens, element->vfs_prefix);
@ -556,7 +556,7 @@ vfs_path_tokens_add_class_info (const vfs_path_element_t * element, GString * re
#ifdef HAVE_CHARSET #ifdef HAVE_CHARSET
if (element->encoding != NULL) if (element->encoding != NULL)
{ {
if (ret_tokens->len > 0 && ret_tokens->str[ret_tokens->len - 1] != PATH_SEP) if (ret_tokens->len > 0 && !IS_PATH_SEP (ret_tokens->str[ret_tokens->len - 1]))
g_string_append (ret_tokens, PATH_SEP_STR); g_string_append (ret_tokens, PATH_SEP_STR);
g_string_append (ret_tokens, VFS_ENCODING_PREFIX); g_string_append (ret_tokens, VFS_ENCODING_PREFIX);
g_string_append (ret_tokens, element->encoding); g_string_append (ret_tokens, element->encoding);
@ -584,7 +584,7 @@ vfs_path_strip_home (const char *dir)
len = strlen (home_dir); len = strlen (home_dir);
if (strncmp (dir, home_dir, len) == 0 && (dir[len] == PATH_SEP || dir[len] == '\0')) if (strncmp (dir, home_dir, len) == 0 && (IS_PATH_SEP (dir[len]) || dir[len] == '\0'))
return g_strdup_printf ("~%s", dir + len); return g_strdup_printf ("~%s", dir + len);
} }
@ -606,8 +606,8 @@ vfs_path_strip_home (const char *dir)
} \ } \
else \ else \
{ \ { \
if ((!is_relative) && (*appendfrom != PATH_SEP) && (*appendfrom != '\0') \ if (!is_relative && !IS_PATH_SEP (*appendfrom) && *appendfrom != '\0' \
&& (buffer->len == 0 || buffer->str[buffer->len - 1] != PATH_SEP)) \ && (buffer->len == 0 || !IS_PATH_SEP (buffer->str[buffer->len - 1]))) \
g_string_append_c (buffer, PATH_SEP); \ g_string_append_c (buffer, PATH_SEP); \
g_string_append (buffer, appendfrom); \ g_string_append (buffer, appendfrom); \
} \ } \
@ -651,7 +651,7 @@ vfs_path_to_str_flags (const vfs_path_t * vpath, int elements_count, vfs_path_fl
if (element->vfs_prefix != NULL) if (element->vfs_prefix != NULL)
{ {
char *url_str; char *url_str;
if ((!is_relative) && (buffer->len == 0 || buffer->str[buffer->len - 1] != PATH_SEP)) if (!is_relative && (buffer->len == 0 || !IS_PATH_SEP (buffer->str[buffer->len - 1])))
g_string_append_c (buffer, PATH_SEP); g_string_append_c (buffer, PATH_SEP);
g_string_append (buffer, element->vfs_prefix); g_string_append (buffer, element->vfs_prefix);
@ -674,7 +674,7 @@ vfs_path_to_str_flags (const vfs_path_t * vpath, int elements_count, vfs_path_fl
if ((flags & VPF_HIDE_CHARSET) == 0) if ((flags & VPF_HIDE_CHARSET) == 0)
{ {
if ((!is_relative) if ((!is_relative)
&& (buffer->len == 0 || buffer->str[buffer->len - 1] != PATH_SEP)) && (buffer->len == 0 || !IS_PATH_SEP (buffer->str[buffer->len - 1])))
g_string_append (buffer, PATH_SEP_STR); g_string_append (buffer, PATH_SEP_STR);
g_string_append (buffer, VFS_ENCODING_PREFIX); g_string_append (buffer, VFS_ENCODING_PREFIX);
g_string_append (buffer, element->encoding); g_string_append (buffer, element->encoding);
@ -1547,7 +1547,7 @@ vfs_path_element_build_pretty_path_str (const vfs_path_element_t * element)
g_string_append (pretty_path, url_params); g_string_append (pretty_path, url_params);
g_free (url_params); g_free (url_params);
if (*element->path != PATH_SEP) if (!IS_PATH_SEP (*element->path))
g_string_append_c (pretty_path, PATH_SEP); g_string_append_c (pretty_path, PATH_SEP);
g_string_append (pretty_path, element->path); g_string_append (pretty_path, element->path);

View File

@ -1,7 +1,7 @@
/* /*
Utilities for VFS modules. Utilities for VFS modules.
Copyright (C) 1988-2014 Copyright (C) 1988-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Copyright (C) 1995, 1996 Miguel de Icaza Copyright (C) 1995, 1996 Miguel de Icaza
@ -253,7 +253,7 @@ vfs_url_split (const char *path, int default_port, vfs_url_flags_t flags)
if ((flags & URL_NOSLASH) == 0) if ((flags & URL_NOSLASH) == 0)
{ {
/* locate path component */ /* locate path component */
while (*dir != PATH_SEP && *dir != '\0') while (!IS_PATH_SEP (*dir) && *dir != '\0')
dir++; dir++;
if (*dir == '\0') if (*dir == '\0')
path_element->path = g_strdup (PATH_SEP_STR); path_element->path = g_strdup (PATH_SEP_STR);

View File

@ -1,7 +1,7 @@
/* /*
Virtual File System switch code Virtual File System switch code
Copyright (C) 1995-2014 Copyright (C) 1995-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: 1995 Miguel de Icaza Written by: 1995 Miguel de Icaza
@ -76,7 +76,7 @@ struct vfs_class *current_vfs = NULL;
#define VFS_FIRST_HANDLE 100 #define VFS_FIRST_HANDLE 100
#define ISSLASH(a) (!a || (a == '/')) #define ISSLASH(a) (a == '\0' || IS_PATH_SEP (a))
/*** file scope type declarations ****************************************************************/ /*** file scope type declarations ****************************************************************/
@ -121,7 +121,7 @@ _vfs_translate_path (const char *path, int size, GIConv defcnv, GString * buffer
/* try found /#enc: */ /* try found /#enc: */
semi = g_strrstr_len (path, size, VFS_ENCODING_PREFIX); semi = g_strrstr_len (path, size, VFS_ENCODING_PREFIX);
if (semi != NULL && (semi == path || *(semi - 1) == PATH_SEP)) if (semi != NULL && (semi == path || IS_PATH_SEP (semi[-1])))
{ {
char encoding[16]; char encoding[16];
const char *slash; const char *slash;

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -3,7 +3,7 @@
Original idea and code: Oleg "Olegarch" Konovalov <olegarch@linuxinside.com> Original idea and code: Oleg "Olegarch" Konovalov <olegarch@linuxinside.com>
Copyright (C) 2009-2014 Copyright (C) 2009-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Dialog box features module for the Midnight Commander Dialog box features module for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the Midnight Commander. This file is part of the Midnight Commander.

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:
@ -684,26 +684,30 @@ input_execute_cmd (WInput * in, unsigned long command)
{ {
cb_ret_t res = MSG_HANDLED; cb_ret_t res = MSG_HANDLED;
/* a highlight command like shift-arrow */ switch (command)
if (command == CK_MarkLeft || command == CK_MarkRight ||
command == CK_MarkToWordBegin || command == CK_MarkToWordEnd ||
command == CK_MarkToHome || command == CK_MarkToEnd)
{ {
case CK_MarkLeft:
case CK_MarkRight:
case CK_MarkToWordBegin:
case CK_MarkToWordEnd:
case CK_MarkToHome:
case CK_MarkToEnd:
/* a highlight command like shift-arrow */
if (in->mark < 0) if (in->mark < 0)
{ {
input_mark_cmd (in, FALSE); /* clear */ input_mark_cmd (in, FALSE); /* clear */
input_mark_cmd (in, TRUE); /* marking on */ input_mark_cmd (in, TRUE); /* marking on */
} }
} break;
switch (command)
{
case CK_WordRight: case CK_WordRight:
case CK_WordLeft: case CK_WordLeft:
case CK_Right: case CK_Right:
case CK_Left: case CK_Left:
if (in->mark >= 0) if (in->mark >= 0)
input_mark_cmd (in, FALSE); input_mark_cmd (in, FALSE);
break;
default:
break;
} }
switch (command) switch (command)
@ -807,10 +811,20 @@ input_execute_cmd (WInput * in, unsigned long command)
res = MSG_NOT_HANDLED; res = MSG_NOT_HANDLED;
} }
if (command != CK_MarkLeft && command != CK_MarkRight && switch (command)
command != CK_MarkToWordBegin && command != CK_MarkToWordEnd && {
command != CK_MarkToHome && command != CK_MarkToEnd) case CK_MarkLeft:
case CK_MarkRight:
case CK_MarkToWordBegin:
case CK_MarkToWordEnd:
case CK_MarkToHome:
case CK_MarkToEnd:
/* do nothing */
break;
default:
in->mark = -1; in->mark = -1;
break;
}
return res; return res;
} }

View File

@ -2,7 +2,7 @@
Input line filename/username/hostname/variable/command completion. Input line filename/username/hostname/variable/command completion.
(Let mc type for you...) (Let mc type for you...)
Copyright (C) 1995-2014 Copyright (C) 1995-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:
@ -288,7 +288,7 @@ filename_completion_function (const char *text, int state, input_complete_t flag
g_string_append (temp, users_dirname); g_string_append (temp, users_dirname);
/* We need a '/' at the end. */ /* We need a '/' at the end. */
if (temp->str[temp->len - 1] != PATH_SEP) if (!IS_PATH_SEP (temp->str[temp->len - 1]))
g_string_append_c (temp, PATH_SEP); g_string_append_c (temp, PATH_SEP);
} }
g_string_append (temp, entry->d_name); g_string_append (temp, entry->d_name);
@ -909,7 +909,7 @@ try_complete_all_possible (try_complete_automation_state_t * state, char *text,
SHOW_C_CTX ("try_complete:filename_subst_1"); SHOW_C_CTX ("try_complete:filename_subst_1");
matches = completion_matches (state->word, filename_completion_function, state->flags); matches = completion_matches (state->word, filename_completion_function, state->flags);
if (matches == NULL && state->is_cd && *state->word != PATH_SEP && *state->word != '~') if (matches == NULL && state->is_cd && !IS_PATH_SEP (*state->word) && *state->word != '~')
{ {
state->q = text + *lc_start; state->q = text + *lc_start;
for (state->p = text; for (state->p = text;

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widget based utility functions. Widget based utility functions.
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Pulldown menu code Pulldown menu code
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by: Written by:

View File

@ -1,7 +1,7 @@
/* /*
Widget based utility functions. Widget based utility functions.
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -1,7 +1,7 @@
/* /*
Widget based utility functions. Widget based utility functions.
Copyright (C) 1994-2014 Copyright (C) 1994-2015
Free Software Foundation, Inc. Free Software Foundation, Inc.
Authors: Authors:

View File

@ -8,12 +8,12 @@ AC_DEFUN([AC_G_MODULE_SUPPORTED], [
g_module_supported="" g_module_supported=""
found_gmodule=no found_gmodule=no
PKG_CHECK_MODULES(GMODULE, [gmodule-no-export-2.0 >= 2.12], [found_gmodule=yes], [:]) PKG_CHECK_MODULES(GMODULE, [gmodule-no-export-2.0 >= 2.14], [found_gmodule=yes], [:])
if test x"$found_gmodule" = xyes; then if test x"$found_gmodule" = xyes; then
g_module_supported="gmodule-no-export-2.0" g_module_supported="gmodule-no-export-2.0"
else else
dnl try fallback to the generic gmodule dnl try fallback to the generic gmodule
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.12], [found_gmodule=yes], [:]) PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.14], [found_gmodule=yes], [:])
if test x"$found_gmodule" = xyes; then if test x"$found_gmodule" = xyes; then
g_module_supported="gmodule-2.0" g_module_supported="gmodule-2.0"
fi fi
@ -78,9 +78,9 @@ AC_DEFUN([AC_CHECK_GLIB], [
AS_HELP_STRING([--with-glib-static], [Link glib statically @<:@no@:>@])) AS_HELP_STRING([--with-glib-static], [Link glib statically @<:@no@:>@]))
glib_found=no glib_found=no
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.12], [glib_found=yes], [:]) PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.14], [glib_found=yes], [:])
if test x"$glib_found" = xno; then if test x"$glib_found" = xno; then
AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.12)]) AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.14)])
fi fi
]) ])

View File

@ -461,7 +461,7 @@ m view `man'
MAN=%{Enter name of man:} MAN=%{Enter name of man:}
%view{ascii,nroff} MANROFFOPT='@MAN_FLAGS@' MAN_KEEP_FORMATTING=1 man -P cat $MAN %view{ascii,nroff} MANROFFOPT='@MAN_FLAGS@' MAN_KEEP_FORMATTING=1 man -P cat $MAN
i Insert a out of command to cursor. i Insert output of command to cursor
CMD=%{ Enter command: } CMD=%{ Enter command: }
eval $CMD > %b eval $CMD > %b

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Midnight Commander\n" "Project-Id-Version: Midnight Commander\n"
"Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n"
"POT-Creation-Date: 2015-02-17 15:19+0300\n" "POT-Creation-Date: 2015-02-26 09:43+0300\n"
"PO-Revision-Date: 2014-09-04 10:10+0000\n" "PO-Revision-Date: 2014-09-04 10:10+0000\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n" "Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Azerbaijani (http://www.transifex.com/projects/p/mc/language/" "Language-Team: Azerbaijani (http://www.transifex.com/projects/p/mc/language/"
@ -712,6 +712,12 @@ msgstr ""
msgid "Two files are required to evoke the diffviewer." msgid "Two files are required to evoke the diffviewer."
msgstr "" msgstr ""
msgid "Background protocol error"
msgstr ""
msgid "Reading failed"
msgstr ""
msgid "Background process error" msgid "Background process error"
msgstr "" msgstr ""
@ -721,12 +727,6 @@ msgstr ""
msgid "Child died unexpectedly" msgid "Child died unexpectedly"
msgstr "" msgstr ""
msgid "Background protocol error"
msgstr ""
msgid "Reading failed"
msgstr ""
msgid "" msgid ""
"Background process sent us a request for more arguments\n" "Background process sent us a request for more arguments\n"
"than we can handle." "than we can handle."
@ -1498,7 +1498,7 @@ msgid ""
"written for the Midnight Commander." "written for the Midnight Commander."
msgstr "" msgstr ""
msgid "Copyright (C) 1996-2014 the Free Software Foundation" msgid "Copyright (C) 1996-2015 the Free Software Foundation"
msgstr "" msgstr ""
msgid "About" msgid "About"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Midnight Commander\n" "Project-Id-Version: Midnight Commander\n"
"Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n"
"POT-Creation-Date: 2015-02-17 15:19+0300\n" "POT-Creation-Date: 2015-02-26 09:43+0300\n"
"PO-Revision-Date: 2014-09-04 10:10+0000\n" "PO-Revision-Date: 2014-09-04 10:10+0000\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n" "Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Belarusian (http://www.transifex.com/projects/p/mc/language/" "Language-Team: Belarusian (http://www.transifex.com/projects/p/mc/language/"
@ -744,6 +744,12 @@ msgstr "Праглядніку не перадалі довадаў."
msgid "Two files are required to evoke the diffviewer." msgid "Two files are required to evoke the diffviewer."
msgstr "Каб выклікаць праґраму параўнаньня, трэба два файлы." msgstr "Каб выклікаць праґраму параўнаньня, трэба два файлы."
msgid "Background protocol error"
msgstr "Даў хібу пратакол на тле"
msgid "Reading failed"
msgstr "Не ўдалося прачытаць"
msgid "Background process error" msgid "Background process error"
msgstr "Даў хібу працэс на тле" msgstr "Даў хібу працэс на тле"
@ -753,12 +759,6 @@ msgstr "Невядомая памылка ў даччыным працэсе"
msgid "Child died unexpectedly" msgid "Child died unexpectedly"
msgstr "Даччыны працэс неспадзявана памёр" msgstr "Даччыны працэс неспадзявана памёр"
msgid "Background protocol error"
msgstr "Даў хібу пратакол на тле"
msgid "Reading failed"
msgstr "Не ўдалося прачытаць"
msgid "" msgid ""
"Background process sent us a request for more arguments\n" "Background process sent us a request for more arguments\n"
"than we can handle." "than we can handle."
@ -1551,7 +1551,7 @@ msgid ""
"written for the Midnight Commander." "written for the Midnight Commander."
msgstr "" msgstr ""
msgid "Copyright (C) 1996-2014 the Free Software Foundation" msgid "Copyright (C) 1996-2015 the Free Software Foundation"
msgstr "" msgstr ""
msgid "About" msgid "About"

View File

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Midnight Commander\n" "Project-Id-Version: Midnight Commander\n"
"Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n"
"POT-Creation-Date: 2015-02-17 15:19+0300\n" "POT-Creation-Date: 2015-02-26 09:43+0300\n"
"PO-Revision-Date: 2014-09-04 10:10+0000\n" "PO-Revision-Date: 2014-09-04 10:10+0000\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n" "Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Bulgarian (http://www.transifex.com/projects/p/mc/language/" "Language-Team: Bulgarian (http://www.transifex.com/projects/p/mc/language/"
@ -713,6 +713,12 @@ msgstr ""
msgid "Two files are required to evoke the diffviewer." msgid "Two files are required to evoke the diffviewer."
msgstr "" msgstr ""
msgid "Background protocol error"
msgstr ""
msgid "Reading failed"
msgstr "Грешка при четене"
msgid "Background process error" msgid "Background process error"
msgstr "Грешка във фоновия процес" msgstr "Грешка във фоновия процес"
@ -722,12 +728,6 @@ msgstr "Непозната грешка в дъщерния процес"
msgid "Child died unexpectedly" msgid "Child died unexpectedly"
msgstr "Дъщерният процес приключи неочаквано" msgstr "Дъщерният процес приключи неочаквано"
msgid "Background protocol error"
msgstr ""
msgid "Reading failed"
msgstr "Грешка при четене"
msgid "" msgid ""
"Background process sent us a request for more arguments\n" "Background process sent us a request for more arguments\n"
"than we can handle." "than we can handle."
@ -1499,7 +1499,7 @@ msgid ""
"written for the Midnight Commander." "written for the Midnight Commander."
msgstr "" msgstr ""
msgid "Copyright (C) 1996-2014 the Free Software Foundation" msgid "Copyright (C) 1996-2015 the Free Software Foundation"
msgstr "" msgstr ""
msgid "About" msgid "About"

View File

@ -11,7 +11,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Midnight Commander\n" "Project-Id-Version: Midnight Commander\n"
"Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n"
"POT-Creation-Date: 2015-02-17 15:19+0300\n" "POT-Creation-Date: 2015-02-26 09:43+0300\n"
"PO-Revision-Date: 2014-09-04 10:10+0000\n" "PO-Revision-Date: 2014-09-04 10:10+0000\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n" "Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Catalan (http://www.transifex.com/projects/p/mc/language/" "Language-Team: Catalan (http://www.transifex.com/projects/p/mc/language/"
@ -718,6 +718,12 @@ msgstr ""
msgid "Two files are required to evoke the diffviewer." msgid "Two files are required to evoke the diffviewer."
msgstr "" msgstr ""
msgid "Background protocol error"
msgstr ""
msgid "Reading failed"
msgstr ""
msgid "Background process error" msgid "Background process error"
msgstr "" msgstr ""
@ -727,12 +733,6 @@ msgstr ""
msgid "Child died unexpectedly" msgid "Child died unexpectedly"
msgstr "" msgstr ""
msgid "Background protocol error"
msgstr ""
msgid "Reading failed"
msgstr ""
msgid "" msgid ""
"Background process sent us a request for more arguments\n" "Background process sent us a request for more arguments\n"
"than we can handle." "than we can handle."
@ -1504,7 +1504,7 @@ msgid ""
"written for the Midnight Commander." "written for the Midnight Commander."
msgstr "" msgstr ""
msgid "Copyright (C) 1996-2014 the Free Software Foundation" msgid "Copyright (C) 1996-2015 the Free Software Foundation"
msgstr "" msgstr ""
msgid "About" msgid "About"

View File

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Midnight Commander\n" "Project-Id-Version: Midnight Commander\n"
"Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n"
"POT-Creation-Date: 2015-02-17 15:19+0300\n" "POT-Creation-Date: 2015-02-26 09:43+0300\n"
"PO-Revision-Date: 2014-09-04 10:10+0000\n" "PO-Revision-Date: 2014-09-04 10:10+0000\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n" "Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Czech (http://www.transifex.com/projects/p/mc/language/cs/)\n" "Language-Team: Czech (http://www.transifex.com/projects/p/mc/language/cs/)\n"
@ -739,6 +739,12 @@ msgstr "Prohlížeči nebyly zadány žádné parametry"
msgid "Two files are required to evoke the diffviewer." msgid "Two files are required to evoke the diffviewer."
msgstr "Dva soubory jsou potřeba k vyvolání prohlížeče změn" msgstr "Dva soubory jsou potřeba k vyvolání prohlížeče změn"
msgid "Background protocol error"
msgstr "Chyba protokolu na pozadí"
msgid "Reading failed"
msgstr "Čtení selhalo"
msgid "Background process error" msgid "Background process error"
msgstr "Chyba procesu na pozadí" msgstr "Chyba procesu na pozadí"
@ -748,12 +754,6 @@ msgstr "Neznámá chyba v potomku procesu"
msgid "Child died unexpectedly" msgid "Child died unexpectedly"
msgstr "Potomek procesu neočekávaně umřel" msgstr "Potomek procesu neočekávaně umřel"
msgid "Background protocol error"
msgstr "Chyba protokolu na pozadí"
msgid "Reading failed"
msgstr "Čtení selhalo"
msgid "" msgid ""
"Background process sent us a request for more arguments\n" "Background process sent us a request for more arguments\n"
"than we can handle." "than we can handle."
@ -1540,7 +1540,7 @@ msgid ""
"written for the Midnight Commander." "written for the Midnight Commander."
msgstr "" msgstr ""
msgid "Copyright (C) 1996-2014 the Free Software Foundation" msgid "Copyright (C) 1996-2015 the Free Software Foundation"
msgstr "" msgstr ""
msgid "About" msgid "About"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Midnight Commander\n" "Project-Id-Version: Midnight Commander\n"
"Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n"
"POT-Creation-Date: 2015-02-17 15:19+0300\n" "POT-Creation-Date: 2015-02-26 09:43+0300\n"
"PO-Revision-Date: 2014-09-04 10:10+0000\n" "PO-Revision-Date: 2014-09-04 10:10+0000\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n" "Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Danish (http://www.transifex.com/projects/p/mc/language/da/)\n" "Language-Team: Danish (http://www.transifex.com/projects/p/mc/language/da/)\n"
@ -720,6 +720,12 @@ msgstr "Ingen argumenter givet til fremviseren."
msgid "Two files are required to evoke the diffviewer." msgid "Two files are required to evoke the diffviewer."
msgstr "To filer kræves for at vække forskelsfremviseren." msgstr "To filer kræves for at vække forskelsfremviseren."
msgid "Background protocol error"
msgstr "Fejl i baggrundsprotokol"
msgid "Reading failed"
msgstr "Læsning fejlede"
msgid "Background process error" msgid "Background process error"
msgstr "Fejl i baggrundsproces" msgstr "Fejl i baggrundsproces"
@ -729,12 +735,6 @@ msgstr "Ukendt fejl i underproces"
msgid "Child died unexpectedly" msgid "Child died unexpectedly"
msgstr "Underproces døde uventet" msgstr "Underproces døde uventet"
msgid "Background protocol error"
msgstr "Fejl i baggrundsprotokol"
msgid "Reading failed"
msgstr "Læsning fejlede"
msgid "" msgid ""
"Background process sent us a request for more arguments\n" "Background process sent us a request for more arguments\n"
"than we can handle." "than we can handle."
@ -1521,7 +1521,7 @@ msgid ""
"written for the Midnight Commander." "written for the Midnight Commander."
msgstr "" msgstr ""
msgid "Copyright (C) 1996-2014 the Free Software Foundation" msgid "Copyright (C) 1996-2015 the Free Software Foundation"
msgstr "" msgstr ""
msgid "About" msgid "About"

View File

@ -10,7 +10,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Midnight Commander\n" "Project-Id-Version: Midnight Commander\n"
"Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n"
"POT-Creation-Date: 2015-02-17 15:19+0300\n" "POT-Creation-Date: 2015-02-26 09:43+0300\n"
"PO-Revision-Date: 2014-09-04 10:10+0000\n" "PO-Revision-Date: 2014-09-04 10:10+0000\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n" "Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: German (http://www.transifex.com/projects/p/mc/language/de/)\n" "Language-Team: German (http://www.transifex.com/projects/p/mc/language/de/)\n"
@ -724,6 +724,12 @@ msgstr "Keine Argumente an den Viewer übergeben."
msgid "Two files are required to evoke the diffviewer." msgid "Two files are required to evoke the diffviewer."
msgstr "2 Dateien werden benötigt, um den Diffviewer aufzurufen." msgstr "2 Dateien werden benötigt, um den Diffviewer aufzurufen."
msgid "Background protocol error"
msgstr "Fehler im Hintergrundprotokoll"
msgid "Reading failed"
msgstr "Fehler beim Lesen"
msgid "Background process error" msgid "Background process error"
msgstr "Fehler im Hintergrundprozess" msgstr "Fehler im Hintergrundprozess"
@ -733,12 +739,6 @@ msgstr "Unbekannter Fehler im Kindprozess"
msgid "Child died unexpectedly" msgid "Child died unexpectedly"
msgstr "Kindprozess starb unerwartet" msgstr "Kindprozess starb unerwartet"
msgid "Background protocol error"
msgstr "Fehler im Hintergrundprotokoll"
msgid "Reading failed"
msgstr "Fehler beim Lesen"
msgid "" msgid ""
"Background process sent us a request for more arguments\n" "Background process sent us a request for more arguments\n"
"than we can handle." "than we can handle."
@ -1528,7 +1528,7 @@ msgstr ""
"Ein benutzerfreundlicher Texteditor\n" "Ein benutzerfreundlicher Texteditor\n"
"geschrieben für Midnight Commander." "geschrieben für Midnight Commander."
msgid "Copyright (C) 1996-2014 the Free Software Foundation" msgid "Copyright (C) 1996-2015 the Free Software Foundation"
msgstr "" msgstr ""
msgid "About" msgid "About"

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