mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
cppcheck: reduce variable scope.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
a3b8a2f005
commit
0d489acd58
@ -535,7 +535,6 @@ convert_from_8bit_to_utf_c2 (const char input_char)
|
|||||||
unsigned char str[2];
|
unsigned char str[2];
|
||||||
unsigned char buf_ch[UTF8_CHAR_LEN + 1];
|
unsigned char buf_ch[UTF8_CHAR_LEN + 1];
|
||||||
int ch = '.';
|
int ch = '.';
|
||||||
int res = 0;
|
|
||||||
GIConv conv;
|
GIConv conv;
|
||||||
const char *cp_from;
|
const char *cp_from;
|
||||||
|
|
||||||
@ -547,6 +546,8 @@ convert_from_8bit_to_utf_c2 (const char input_char)
|
|||||||
|
|
||||||
if (conv != INVALID_CONV)
|
if (conv != INVALID_CONV)
|
||||||
{
|
{
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
switch (str_translate_char (conv, (char *) str, -1, (char *) buf_ch, sizeof (buf_ch)))
|
switch (str_translate_char (conv, (char *) str, -1, (char *) buf_ch, sizeof (buf_ch)))
|
||||||
{
|
{
|
||||||
case ESTR_SUCCESS:
|
case ESTR_SUCCESS:
|
||||||
|
@ -253,7 +253,6 @@ int
|
|||||||
mc_fhl_get_color (mc_fhl_t * fhl, file_entry_t * fe)
|
mc_fhl_get_color (mc_fhl_t * fhl, file_entry_t * fe)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
mc_fhl_filter_t *mc_filter;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (fhl == NULL)
|
if (fhl == NULL)
|
||||||
@ -261,6 +260,8 @@ mc_fhl_get_color (mc_fhl_t * fhl, file_entry_t * fe)
|
|||||||
|
|
||||||
for (i = 0; i < fhl->filters->len; i++)
|
for (i = 0; i < fhl->filters->len; i++)
|
||||||
{
|
{
|
||||||
|
mc_fhl_filter_t *mc_filter;
|
||||||
|
|
||||||
mc_filter = (mc_fhl_filter_t *) g_ptr_array_index (fhl->filters, i);
|
mc_filter = (mc_fhl_filter_t *) g_ptr_array_index (fhl->filters, i);
|
||||||
switch (mc_filter->type)
|
switch (mc_filter->type)
|
||||||
{
|
{
|
||||||
|
@ -456,13 +456,14 @@ keybind_lookup_actionname (unsigned long action)
|
|||||||
const char *
|
const char *
|
||||||
keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, unsigned long action)
|
keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, unsigned long action)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if (keymap != NULL)
|
if (keymap != NULL)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; keymap[i].key != 0; i++)
|
for (i = 0; keymap[i].key != 0; i++)
|
||||||
if (keymap[i].command == action)
|
if (keymap[i].command == action)
|
||||||
return (keymap[i].caption[0] != '\0') ? keymap[i].caption : NULL;
|
return (keymap[i].caption[0] != '\0') ? keymap[i].caption : NULL;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,12 +472,14 @@ keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, unsigned long ac
|
|||||||
unsigned long
|
unsigned long
|
||||||
keybind_lookup_keymap_command (const global_keymap_t * keymap, long key)
|
keybind_lookup_keymap_command (const global_keymap_t * keymap, long key)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if (keymap != NULL)
|
if (keymap != NULL)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; keymap[i].key != 0; i++)
|
for (i = 0; keymap[i].key != 0; i++)
|
||||||
if (keymap[i].key == key)
|
if (keymap[i].key == key)
|
||||||
return keymap[i].command;
|
return keymap[i].command;
|
||||||
|
}
|
||||||
|
|
||||||
return CK_IgnoreKey;
|
return CK_IgnoreKey;
|
||||||
}
|
}
|
||||||
|
@ -112,13 +112,14 @@ get_log_filename (void)
|
|||||||
static void
|
static void
|
||||||
mc_va_log (const char *fmt, va_list args)
|
mc_va_log (const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
FILE *f;
|
|
||||||
char *logfilename;
|
char *logfilename;
|
||||||
|
|
||||||
logfilename = get_log_filename ();
|
logfilename = get_log_filename ();
|
||||||
|
|
||||||
if (logfilename != NULL)
|
if (logfilename != NULL)
|
||||||
{
|
{
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
f = fopen (logfilename, "a");
|
f = fopen (logfilename, "a");
|
||||||
if (f != NULL)
|
if (f != NULL)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
The Free Software Foundation, Inc.
|
The Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by:
|
Written by:
|
||||||
Slava Zanko <slavazanko@gmail.com>, 2009, 2010, 2011
|
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
|
Andrew Borodin <aborodin@vmail.ru>, 2013
|
||||||
|
|
||||||
@ -290,11 +290,12 @@ static mc_search__found_cond_t
|
|||||||
mc_search__regex_found_cond (mc_search_t * lc_mc_search, GString * search_str)
|
mc_search__regex_found_cond (mc_search_t * lc_mc_search, GString * search_str)
|
||||||
{
|
{
|
||||||
gsize loop1;
|
gsize loop1;
|
||||||
mc_search_cond_t *mc_search_cond;
|
|
||||||
mc_search__found_cond_t ret;
|
|
||||||
|
|
||||||
for (loop1 = 0; loop1 < lc_mc_search->conditions->len; loop1++)
|
for (loop1 = 0; loop1 < lc_mc_search->conditions->len; loop1++)
|
||||||
{
|
{
|
||||||
|
mc_search_cond_t *mc_search_cond;
|
||||||
|
mc_search__found_cond_t ret;
|
||||||
|
|
||||||
mc_search_cond = (mc_search_cond_t *) g_ptr_array_index (lc_mc_search->conditions, loop1);
|
mc_search_cond = (mc_search_cond_t *) g_ptr_array_index (lc_mc_search->conditions, loop1);
|
||||||
|
|
||||||
if (!mc_search_cond->regex_handle)
|
if (!mc_search_cond->regex_handle)
|
||||||
@ -303,7 +304,6 @@ mc_search__regex_found_cond (mc_search_t * lc_mc_search, GString * search_str)
|
|||||||
ret =
|
ret =
|
||||||
mc_search__regex_found_cond_one (lc_mc_search, mc_search_cond->regex_handle,
|
mc_search__regex_found_cond_one (lc_mc_search, mc_search_cond->regex_handle,
|
||||||
search_str);
|
search_str);
|
||||||
|
|
||||||
if (ret != COND__NOT_FOUND)
|
if (ret != COND__NOT_FOUND)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -330,16 +330,19 @@ mc_search_regex__get_max_num_of_replace_tokens (const gchar * str, gsize len)
|
|||||||
if (str[loop] == '$' && str[loop + 1] == '{')
|
if (str[loop] == '$' && str[loop + 1] == '{')
|
||||||
{
|
{
|
||||||
gsize tmp_len;
|
gsize tmp_len;
|
||||||
char *tmp_str;
|
|
||||||
int tmp_token;
|
|
||||||
if (strutils_is_char_escaped (str, &str[loop]))
|
if (strutils_is_char_escaped (str, &str[loop]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (tmp_len = 0;
|
for (tmp_len = 0;
|
||||||
loop + tmp_len + 2 < len && (str[loop + 2 + tmp_len] & (char) 0xf0) == 0x30;
|
loop + tmp_len + 2 < len && (str[loop + 2 + tmp_len] & (char) 0xf0) == 0x30;
|
||||||
tmp_len++);
|
tmp_len++);
|
||||||
|
|
||||||
if (str[loop + 2 + tmp_len] == '}')
|
if (str[loop + 2 + tmp_len] == '}')
|
||||||
{
|
{
|
||||||
|
int tmp_token;
|
||||||
|
char *tmp_str;
|
||||||
|
|
||||||
tmp_str = g_strndup (&str[loop + 2], tmp_len);
|
tmp_str = g_strndup (&str[loop + 2], tmp_len);
|
||||||
tmp_token = atoi (tmp_str);
|
tmp_token = atoi (tmp_str);
|
||||||
if (max_token < tmp_token)
|
if (max_token < tmp_token)
|
||||||
@ -458,7 +461,6 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
|
|||||||
gsize * skip_len, replace_transform_type_t * replace_flags)
|
gsize * skip_len, replace_transform_type_t * replace_flags)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *tmp_str;
|
|
||||||
const char *curr_str = &(replace_str->str[current_pos]);
|
const char *curr_str = &(replace_str->str[current_pos]);
|
||||||
|
|
||||||
if (current_pos > replace_str->len)
|
if (current_pos > replace_str->len)
|
||||||
@ -469,6 +471,8 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
|
|||||||
if ((*curr_str == '$') && (*(curr_str + 1) == '{') && ((*(curr_str + 2) & (char) 0xf0) == 0x30)
|
if ((*curr_str == '$') && (*(curr_str + 1) == '{') && ((*(curr_str + 2) & (char) 0xf0) == 0x30)
|
||||||
&& (replace_str->len > current_pos + 2))
|
&& (replace_str->len > current_pos + 2))
|
||||||
{
|
{
|
||||||
|
char *tmp_str;
|
||||||
|
|
||||||
if (strutils_is_char_escaped (replace_str->str, curr_str))
|
if (strutils_is_char_escaped (replace_str->str, curr_str))
|
||||||
{
|
{
|
||||||
*skip_len = 1;
|
*skip_len = 1;
|
||||||
@ -914,7 +918,7 @@ mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * repla
|
|||||||
GString *ret;
|
GString *ret;
|
||||||
gchar *tmp_str;
|
gchar *tmp_str;
|
||||||
|
|
||||||
int num_replace_tokens, lc_index;
|
int num_replace_tokens;
|
||||||
gsize loop;
|
gsize loop;
|
||||||
gsize len = 0;
|
gsize len = 0;
|
||||||
gchar *prev_str;
|
gchar *prev_str;
|
||||||
@ -939,6 +943,8 @@ mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * repla
|
|||||||
|
|
||||||
for (loop = 0; loop < replace_str->len - 1; loop++)
|
for (loop = 0; loop < replace_str->len - 1; loop++)
|
||||||
{
|
{
|
||||||
|
int lc_index;
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
if (lc_index == REPLACE_PREPARE_T_NOTHING_SPECIAL)
|
if (lc_index == REPLACE_PREPARE_T_NOTHING_SPECIAL)
|
||||||
|
@ -760,7 +760,6 @@ str_msg_term_size (const char *text, int *lines, int *columns)
|
|||||||
char *p, *tmp;
|
char *p, *tmp;
|
||||||
char *q;
|
char *q;
|
||||||
char c = '\0';
|
char c = '\0';
|
||||||
int width;
|
|
||||||
|
|
||||||
*lines = 1;
|
*lines = 1;
|
||||||
*columns = 0;
|
*columns = 0;
|
||||||
@ -770,6 +769,8 @@ str_msg_term_size (const char *text, int *lines, int *columns)
|
|||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
|
int width;
|
||||||
|
|
||||||
q = strchr (p, '\n');
|
q = strchr (p, '\n');
|
||||||
if (q != NULL)
|
if (q != NULL)
|
||||||
{
|
{
|
||||||
|
@ -348,7 +348,6 @@ str_8bit_term_trim (const char *text, int width)
|
|||||||
static char result[BUF_MEDIUM];
|
static char result[BUF_MEDIUM];
|
||||||
size_t remain;
|
size_t remain;
|
||||||
char *actual;
|
char *actual;
|
||||||
size_t pos = 0;
|
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
||||||
length = strlen (text);
|
length = strlen (text);
|
||||||
@ -357,9 +356,12 @@ str_8bit_term_trim (const char *text, int width)
|
|||||||
|
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
{
|
{
|
||||||
|
size_t pos;
|
||||||
|
|
||||||
if (width >= (int) length)
|
if (width >= (int) length)
|
||||||
{
|
{
|
||||||
for (; pos < length && remain > 1; pos++, actual++, remain--)
|
|
||||||
|
for (pos = 0; pos < length && remain > 1; pos++, actual++, remain--)
|
||||||
actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
|
actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
|
||||||
}
|
}
|
||||||
else if (width <= 3)
|
else if (width <= 3)
|
||||||
@ -373,8 +375,7 @@ str_8bit_term_trim (const char *text, int width)
|
|||||||
actual += 3;
|
actual += 3;
|
||||||
remain -= 3;
|
remain -= 3;
|
||||||
|
|
||||||
pos += length - width + 3;
|
for (pos = length - width + 3; pos < length && remain > 1; pos++, actual++, remain--)
|
||||||
for (; pos < length && remain > 1; pos++, actual++, remain--)
|
|
||||||
actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
|
actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,7 +409,6 @@ str_8bit_term_substring (const char *text, int start, int width)
|
|||||||
static char result[BUF_MEDIUM];
|
static char result[BUF_MEDIUM];
|
||||||
size_t remain;
|
size_t remain;
|
||||||
char *actual;
|
char *actual;
|
||||||
size_t pos = 0;
|
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
||||||
actual = result;
|
actual = result;
|
||||||
@ -417,8 +417,10 @@ str_8bit_term_substring (const char *text, int start, int width)
|
|||||||
|
|
||||||
if (start < (int) length)
|
if (start < (int) length)
|
||||||
{
|
{
|
||||||
pos += start;
|
size_t pos;
|
||||||
for (; pos < length && width > 0 && remain > 1; pos++, width--, actual++, remain--)
|
|
||||||
|
for (pos = start; pos < length && width > 0 && remain > 1;
|
||||||
|
pos++, width--, actual++, remain--)
|
||||||
actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
|
actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,7 +520,6 @@ str_8bit_search_first (const char *text, const char *search, int case_sen)
|
|||||||
char *fold_text;
|
char *fold_text;
|
||||||
char *fold_search;
|
char *fold_search;
|
||||||
const char *match;
|
const char *match;
|
||||||
size_t offset;
|
|
||||||
|
|
||||||
fold_text = (case_sen) ? (char *) text : str_8bit_strdown (text);
|
fold_text = (case_sen) ? (char *) text : str_8bit_strdown (text);
|
||||||
fold_search = (case_sen) ? (char *) search : str_8bit_strdown (search);
|
fold_search = (case_sen) ? (char *) search : str_8bit_strdown (search);
|
||||||
@ -526,6 +527,8 @@ str_8bit_search_first (const char *text, const char *search, int case_sen)
|
|||||||
match = g_strstr_len (fold_text, -1, fold_search);
|
match = g_strstr_len (fold_text, -1, fold_search);
|
||||||
if (match != NULL)
|
if (match != NULL)
|
||||||
{
|
{
|
||||||
|
size_t offset;
|
||||||
|
|
||||||
offset = match - fold_text;
|
offset = match - fold_text;
|
||||||
match = text + offset;
|
match = text + offset;
|
||||||
}
|
}
|
||||||
@ -545,7 +548,6 @@ str_8bit_search_last (const char *text, const char *search, int case_sen)
|
|||||||
char *fold_text;
|
char *fold_text;
|
||||||
char *fold_search;
|
char *fold_search;
|
||||||
const char *match;
|
const char *match;
|
||||||
size_t offset;
|
|
||||||
|
|
||||||
fold_text = (case_sen) ? (char *) text : str_8bit_strdown (text);
|
fold_text = (case_sen) ? (char *) text : str_8bit_strdown (text);
|
||||||
fold_search = (case_sen) ? (char *) search : str_8bit_strdown (search);
|
fold_search = (case_sen) ? (char *) search : str_8bit_strdown (search);
|
||||||
@ -553,6 +555,8 @@ str_8bit_search_last (const char *text, const char *search, int case_sen)
|
|||||||
match = g_strrstr_len (fold_text, -1, fold_search);
|
match = g_strrstr_len (fold_text, -1, fold_search);
|
||||||
if (match != NULL)
|
if (match != NULL)
|
||||||
{
|
{
|
||||||
|
size_t offset;
|
||||||
|
|
||||||
offset = match - fold_text;
|
offset = match - fold_text;
|
||||||
match = text + offset;
|
match = text + offset;
|
||||||
}
|
}
|
||||||
|
@ -313,20 +313,20 @@ str_ascii_term_trim (const char *text, int width)
|
|||||||
static char result[BUF_MEDIUM];
|
static char result[BUF_MEDIUM];
|
||||||
size_t remain;
|
size_t remain;
|
||||||
char *actual;
|
char *actual;
|
||||||
size_t pos = 0;
|
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
||||||
length = strlen (text);
|
length = strlen (text);
|
||||||
actual = result;
|
actual = result;
|
||||||
remain = sizeof (result);
|
remain = sizeof (result);
|
||||||
|
|
||||||
|
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
{
|
{
|
||||||
|
size_t pos;
|
||||||
|
|
||||||
if (width >= (int) length)
|
if (width >= (int) length)
|
||||||
{
|
{
|
||||||
/* copy all characters */
|
/* copy all characters */
|
||||||
for (; pos < length && remain > 1; pos++, actual++, remain--)
|
for (pos = 0; pos < length && remain > 1; pos++, actual++, remain--)
|
||||||
{
|
{
|
||||||
actual[0] = isascii ((unsigned char) text[pos]) ? text[pos] : '?';
|
actual[0] = isascii ((unsigned char) text[pos]) ? text[pos] : '?';
|
||||||
actual[0] = g_ascii_isprint ((gchar) actual[0]) ? actual[0] : '.';
|
actual[0] = g_ascii_isprint ((gchar) actual[0]) ? actual[0] : '.';
|
||||||
@ -343,10 +343,8 @@ str_ascii_term_trim (const char *text, int width)
|
|||||||
actual += 3;
|
actual += 3;
|
||||||
remain -= 3;
|
remain -= 3;
|
||||||
|
|
||||||
pos += length - width + 3;
|
|
||||||
|
|
||||||
/* copy suffix of text */
|
/* copy suffix of text */
|
||||||
for (; pos < length && remain > 1; pos++, actual++, remain--)
|
for (pos = length - width + 3; pos < length && remain > 1; pos++, actual++, remain--)
|
||||||
{
|
{
|
||||||
actual[0] = isascii ((unsigned char) text[pos]) ? text[pos] : '?';
|
actual[0] = isascii ((unsigned char) text[pos]) ? text[pos] : '?';
|
||||||
actual[0] = g_ascii_isprint ((gchar) actual[0]) ? actual[0] : '.';
|
actual[0] = g_ascii_isprint ((gchar) actual[0]) ? actual[0] : '.';
|
||||||
@ -383,7 +381,6 @@ str_ascii_term_substring (const char *text, int start, int width)
|
|||||||
static char result[BUF_MEDIUM];
|
static char result[BUF_MEDIUM];
|
||||||
size_t remain;
|
size_t remain;
|
||||||
char *actual;
|
char *actual;
|
||||||
size_t pos = 0;
|
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
||||||
actual = result;
|
actual = result;
|
||||||
@ -392,11 +389,12 @@ str_ascii_term_substring (const char *text, int start, int width)
|
|||||||
|
|
||||||
if (start < (int) length)
|
if (start < (int) length)
|
||||||
{
|
{
|
||||||
pos += start;
|
size_t pos;
|
||||||
/* copy at most width characters from text from start */
|
|
||||||
for (; pos < length && width > 0 && remain > 1; pos++, width--, actual++, remain--)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
/* copy at most width characters from text from start */
|
||||||
|
for (pos = start; pos < length && width > 0 && remain > 1;
|
||||||
|
pos++, width--, actual++, remain--)
|
||||||
|
{
|
||||||
actual[0] = isascii ((unsigned char) text[pos]) ? text[pos] : '?';
|
actual[0] = isascii ((unsigned char) text[pos]) ? text[pos] : '?';
|
||||||
actual[0] = g_ascii_isprint ((gchar) actual[0]) ? actual[0] : '.';
|
actual[0] = g_ascii_isprint ((gchar) actual[0]) ? actual[0] : '.';
|
||||||
}
|
}
|
||||||
@ -497,7 +495,6 @@ str_ascii_search_first (const char *text, const char *search, int case_sen)
|
|||||||
char *fold_text;
|
char *fold_text;
|
||||||
char *fold_search;
|
char *fold_search;
|
||||||
const char *match;
|
const char *match;
|
||||||
size_t offset;
|
|
||||||
|
|
||||||
fold_text = (case_sen) ? (char *) text : g_ascii_strdown (text, -1);
|
fold_text = (case_sen) ? (char *) text : g_ascii_strdown (text, -1);
|
||||||
fold_search = (case_sen) ? (char *) search : g_ascii_strdown (search, -1);
|
fold_search = (case_sen) ? (char *) search : g_ascii_strdown (search, -1);
|
||||||
@ -505,6 +502,8 @@ str_ascii_search_first (const char *text, const char *search, int case_sen)
|
|||||||
match = g_strstr_len (fold_text, -1, fold_search);
|
match = g_strstr_len (fold_text, -1, fold_search);
|
||||||
if (match != NULL)
|
if (match != NULL)
|
||||||
{
|
{
|
||||||
|
size_t offset;
|
||||||
|
|
||||||
offset = match - fold_text;
|
offset = match - fold_text;
|
||||||
match = text + offset;
|
match = text + offset;
|
||||||
}
|
}
|
||||||
@ -524,7 +523,6 @@ str_ascii_search_last (const char *text, const char *search, int case_sen)
|
|||||||
char *fold_text;
|
char *fold_text;
|
||||||
char *fold_search;
|
char *fold_search;
|
||||||
const char *match;
|
const char *match;
|
||||||
size_t offset;
|
|
||||||
|
|
||||||
fold_text = (case_sen) ? (char *) text : g_ascii_strdown (text, -1);
|
fold_text = (case_sen) ? (char *) text : g_ascii_strdown (text, -1);
|
||||||
fold_search = (case_sen) ? (char *) search : g_ascii_strdown (search, -1);
|
fold_search = (case_sen) ? (char *) search : g_ascii_strdown (search, -1);
|
||||||
@ -532,6 +530,8 @@ str_ascii_search_last (const char *text, const char *search, int case_sen)
|
|||||||
match = g_strrstr_len (fold_text, -1, fold_search);
|
match = g_strrstr_len (fold_text, -1, fold_search);
|
||||||
if (match != NULL)
|
if (match != NULL)
|
||||||
{
|
{
|
||||||
|
size_t offset;
|
||||||
|
|
||||||
offset = match - fold_text;
|
offset = match - fold_text;
|
||||||
match = text + offset;
|
match = text + offset;
|
||||||
}
|
}
|
||||||
|
@ -439,11 +439,12 @@ str_utf8_term_form (const char *text)
|
|||||||
{
|
{
|
||||||
static char result[BUF_MEDIUM * 6];
|
static char result[BUF_MEDIUM * 6];
|
||||||
const struct term_form *pre_form;
|
const struct term_form *pre_form;
|
||||||
char *composed;
|
|
||||||
|
|
||||||
pre_form = str_utf8_make_make_term_form (text, (size_t) (-1));
|
pre_form = str_utf8_make_make_term_form (text, (size_t) (-1));
|
||||||
if (pre_form->compose)
|
if (pre_form->compose)
|
||||||
{
|
{
|
||||||
|
char *composed;
|
||||||
|
|
||||||
composed = g_utf8_normalize (pre_form->text, -1, G_NORMALIZE_DEFAULT_COMPOSE);
|
composed = g_utf8_normalize (pre_form->text, -1, G_NORMALIZE_DEFAULT_COMPOSE);
|
||||||
g_strlcpy (result, composed, sizeof (result));
|
g_strlcpy (result, composed, sizeof (result));
|
||||||
g_free (composed);
|
g_free (composed);
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
Internal stuff of color setup
|
Internal stuff of color setup
|
||||||
|
|
||||||
Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||||
2007, 2008, 2009, 2010, 2011
|
2007, 2008, 2009, 2010, 2011, 2013
|
||||||
The Free Software Foundation, Inc.
|
The Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by:
|
Written by:
|
||||||
Andrew Borodin <aborodin@vmail.ru>, 2009
|
Andrew Borodin <aborodin@vmail.ru>, 2009
|
||||||
Slava Zanko <slavazanko@gmail.com>, 2009
|
Slava Zanko <slavazanko@gmail.com>, 2009, 2013
|
||||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||||
|
|
||||||
This file is part of the Midnight Commander.
|
This file is part of the Midnight Commander.
|
||||||
@ -124,7 +124,6 @@ parse_256_color_name (const char *color_name)
|
|||||||
const char *
|
const char *
|
||||||
tty_color_get_name_by_index (int idx)
|
tty_color_get_name_by_index (int idx)
|
||||||
{
|
{
|
||||||
static char **color_N_names = NULL;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Find the real English name of the first 16 colors, */
|
/* Find the real English name of the first 16 colors, */
|
||||||
@ -135,6 +134,8 @@ tty_color_get_name_by_index (int idx)
|
|||||||
/* Create and return the strings "color16" to "color255". */
|
/* Create and return the strings "color16" to "color255". */
|
||||||
if (idx >= 16 && idx < 256)
|
if (idx >= 16 && idx < 256)
|
||||||
{
|
{
|
||||||
|
static char **color_N_names = NULL;
|
||||||
|
|
||||||
if (color_N_names == NULL)
|
if (color_N_names == NULL)
|
||||||
{
|
{
|
||||||
color_N_names = g_try_malloc0 (240 * sizeof (char *));
|
color_N_names = g_try_malloc0 (240 * sizeof (char *));
|
||||||
@ -172,14 +173,18 @@ int
|
|||||||
tty_attr_get_bits (const char *attrs)
|
tty_attr_get_bits (const char *attrs)
|
||||||
{
|
{
|
||||||
int attr_bits = 0;
|
int attr_bits = 0;
|
||||||
gchar **attr_list;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
if (attrs != NULL)
|
if (attrs != NULL)
|
||||||
{
|
{
|
||||||
|
gchar **attr_list;
|
||||||
|
int i;
|
||||||
|
|
||||||
attr_list = g_strsplit (attrs, "+", -1);
|
attr_list = g_strsplit (attrs, "+", -1);
|
||||||
|
|
||||||
for (i = 0; attr_list[i] != NULL; i++)
|
for (i = 0; attr_list[i] != NULL; i++)
|
||||||
{
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
for (j = 0; attributes_table[j].name != NULL; j++)
|
for (j = 0; attributes_table[j].name != NULL; j++)
|
||||||
{
|
{
|
||||||
if (strcmp (attr_list[i], attributes_table[j].name) == 0)
|
if (strcmp (attr_list[i], attributes_table[j].name) == 0)
|
||||||
|
@ -65,18 +65,17 @@ has_colors (gboolean disable, gboolean force)
|
|||||||
{
|
{
|
||||||
const char *terminal = getenv ("TERM");
|
const char *terminal = getenv ("TERM");
|
||||||
const size_t len = strlen (terminal);
|
const size_t len = strlen (terminal);
|
||||||
|
|
||||||
char *cts = mc_global.tty.color_terminal_string;
|
char *cts = mc_global.tty.color_terminal_string;
|
||||||
char *s;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
/* check mc_global.tty.color_terminal_string */
|
/* check mc_global.tty.color_terminal_string */
|
||||||
while (*cts != '\0')
|
while (*cts != '\0')
|
||||||
{
|
{
|
||||||
|
char *s;
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
while (*cts == ' ' || *cts == '\t')
|
while (*cts == ' ' || *cts == '\t')
|
||||||
cts++;
|
cts++;
|
||||||
s = cts;
|
s = cts;
|
||||||
i = 0;
|
|
||||||
|
|
||||||
while (*cts != '\0' && *cts != ',')
|
while (*cts != '\0' && *cts != ',')
|
||||||
{
|
{
|
||||||
@ -145,7 +144,6 @@ tty_color_deinit_lib (void)
|
|||||||
void
|
void
|
||||||
tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair)
|
tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair)
|
||||||
{
|
{
|
||||||
const char *fg, *bg;
|
|
||||||
if (mc_color_pair->ifg <= (int) SPEC_A_REVERSE)
|
if (mc_color_pair->ifg <= (int) SPEC_A_REVERSE)
|
||||||
{
|
{
|
||||||
switch (mc_color_pair->ifg)
|
switch (mc_color_pair->ifg)
|
||||||
@ -172,6 +170,8 @@ tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const char *fg, *bg;
|
||||||
|
|
||||||
fg = tty_color_get_name_by_index (mc_color_pair->ifg);
|
fg = tty_color_get_name_by_index (mc_color_pair->ifg);
|
||||||
bg = tty_color_get_name_by_index (mc_color_pair->ibg);
|
bg = tty_color_get_name_by_index (mc_color_pair->ibg);
|
||||||
SLtt_set_color (mc_color_pair->pair_index, (char *) "", (char *) fg, (char *) bg);
|
SLtt_set_color (mc_color_pair->pair_index, (char *) "", (char *) fg, (char *) bg);
|
||||||
|
@ -606,17 +606,16 @@ try_channels (int set_timeout)
|
|||||||
{
|
{
|
||||||
struct timeval time_out;
|
struct timeval time_out;
|
||||||
static fd_set select_set;
|
static fd_set select_set;
|
||||||
struct timeval *timeptr;
|
|
||||||
int v;
|
|
||||||
int maxfdp;
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
struct timeval *timeptr = NULL;
|
||||||
|
int maxfdp, v;
|
||||||
|
|
||||||
FD_ZERO (&select_set);
|
FD_ZERO (&select_set);
|
||||||
FD_SET (input_fd, &select_set); /* Add stdin */
|
FD_SET (input_fd, &select_set); /* Add stdin */
|
||||||
maxfdp = max (add_selects (&select_set), input_fd);
|
maxfdp = max (add_selects (&select_set), input_fd);
|
||||||
|
|
||||||
timeptr = NULL;
|
|
||||||
if (set_timeout)
|
if (set_timeout)
|
||||||
{
|
{
|
||||||
time_out.tv_sec = 0;
|
time_out.tv_sec = 0;
|
||||||
@ -867,7 +866,7 @@ get_modifier (void)
|
|||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
#ifdef __QNXNTO__
|
#ifdef __QNXNTO__
|
||||||
int mod_status, shift_ext_status;
|
int mod_status;
|
||||||
static int in_photon = 0;
|
static int in_photon = 0;
|
||||||
static int ph_ig = 0;
|
static int ph_ig = 0;
|
||||||
PhCursorInfo_t cursor_info;
|
PhCursorInfo_t cursor_info;
|
||||||
@ -922,6 +921,8 @@ get_modifier (void)
|
|||||||
console or xterm */
|
console or xterm */
|
||||||
if (in_photon == -1)
|
if (in_photon == -1)
|
||||||
{
|
{
|
||||||
|
int shift_ext_status;
|
||||||
|
|
||||||
if (devctl (fileno (stdin), DCMD_CHR_LINESTATUS, &mod_status, sizeof (int), NULL) == -1)
|
if (devctl (fileno (stdin), DCMD_CHR_LINESTATUS, &mod_status, sizeof (int), NULL) == -1)
|
||||||
return 0;
|
return 0;
|
||||||
shift_ext_status = mod_status & 0xffffff00UL;
|
shift_ext_status = mod_status & 0xffffff00UL;
|
||||||
@ -1951,7 +1952,6 @@ int
|
|||||||
tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
|
tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
static int flag = 0; /* Return value from select */
|
|
||||||
#ifdef HAVE_LIBGPM
|
#ifdef HAVE_LIBGPM
|
||||||
static struct Gpm_Event ev; /* Mouse event */
|
static struct Gpm_Event ev; /* Mouse event */
|
||||||
#endif
|
#endif
|
||||||
@ -1984,6 +1984,7 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
|
|||||||
while (pending_keys == NULL)
|
while (pending_keys == NULL)
|
||||||
{
|
{
|
||||||
int nfd;
|
int nfd;
|
||||||
|
static int flag = 0; /* Return value from select */
|
||||||
fd_set select_set;
|
fd_set select_set;
|
||||||
|
|
||||||
FD_ZERO (&select_set);
|
FD_ZERO (&select_set);
|
||||||
|
@ -415,7 +415,7 @@ load_qnx_key_defines (void)
|
|||||||
|
|
||||||
if (!_qnx_keys_defined)
|
if (!_qnx_keys_defined)
|
||||||
{
|
{
|
||||||
int idx, str_idx;
|
int idx;
|
||||||
int term_setup_ok;
|
int term_setup_ok;
|
||||||
|
|
||||||
__setupterm (NULL, fileno (stdout), &term_setup_ok);
|
__setupterm (NULL, fileno (stdout), &term_setup_ok);
|
||||||
@ -424,7 +424,8 @@ load_qnx_key_defines (void)
|
|||||||
|
|
||||||
for (idx = 0; idx < sizeof (xtra_key_defines) / sizeof (xtra_key_defines[0]); idx++)
|
for (idx = 0; idx < sizeof (xtra_key_defines) / sizeof (xtra_key_defines[0]); idx++)
|
||||||
{
|
{
|
||||||
str_idx = xtra_key_defines[idx].str_idx;
|
int str_idx = xtra_key_defines[idx].str_idx;
|
||||||
|
|
||||||
if (__QTISOFFS (str_idx))
|
if (__QTISOFFS (str_idx))
|
||||||
{
|
{
|
||||||
if (*__QTISSTR (str_idx))
|
if (*__QTISSTR (str_idx))
|
||||||
|
@ -528,8 +528,6 @@ tty_print_char (int c)
|
|||||||
void
|
void
|
||||||
tty_print_anychar (int c)
|
tty_print_anychar (int c)
|
||||||
{
|
{
|
||||||
unsigned char str[UTF8_CHAR_LEN + 1];
|
|
||||||
|
|
||||||
if (mc_global.utf8_display || c > 255)
|
if (mc_global.utf8_display || c > 255)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
@ -543,6 +541,7 @@ tty_print_anychar (int c)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unsigned char str[UTF8_CHAR_LEN + 1];
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
str[res] = '\0';
|
str[res] = '\0';
|
||||||
|
@ -168,12 +168,13 @@ static void
|
|||||||
slang_reset_softkeys (void)
|
slang_reset_softkeys (void)
|
||||||
{
|
{
|
||||||
int key;
|
int key;
|
||||||
char *send;
|
|
||||||
static const char display[] = " ";
|
static const char display[] = " ";
|
||||||
char tmp[BUF_SMALL];
|
char tmp[BUF_SMALL];
|
||||||
|
|
||||||
for (key = 1; key < 9; key++)
|
for (key = 1; key < 9; key++)
|
||||||
{
|
{
|
||||||
|
char *send;
|
||||||
|
|
||||||
g_snprintf (tmp, sizeof (tmp), "k%d", key);
|
g_snprintf (tmp, sizeof (tmp), "k%d", key);
|
||||||
send = (char *) SLtt_tgetstr (tmp);
|
send = (char *) SLtt_tgetstr (tmp);
|
||||||
if (send != NULL)
|
if (send != NULL)
|
||||||
@ -672,11 +673,12 @@ tty_print_alt_char (int c, gboolean single)
|
|||||||
void
|
void
|
||||||
tty_print_anychar (int c)
|
tty_print_anychar (int c)
|
||||||
{
|
{
|
||||||
char str[UTF8_CHAR_LEN + 1];
|
|
||||||
|
|
||||||
if (c > 255)
|
if (c > 255)
|
||||||
{
|
{
|
||||||
int res = g_unichar_to_utf8 (c, str);
|
char str[UTF8_CHAR_LEN + 1];
|
||||||
|
int res;
|
||||||
|
|
||||||
|
res = g_unichar_to_utf8 (c, str);
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
{
|
{
|
||||||
str[0] = '.';
|
str[0] = '.';
|
||||||
|
@ -179,12 +179,12 @@ x11_available (void)
|
|||||||
Display *
|
Display *
|
||||||
mc_XOpenDisplay (const char *displayname)
|
mc_XOpenDisplay (const char *displayname)
|
||||||
{
|
{
|
||||||
Display *retval;
|
|
||||||
|
|
||||||
if (x11_available ())
|
if (x11_available ())
|
||||||
{
|
{
|
||||||
if (setjmp (x11_exception) == 0)
|
if (setjmp (x11_exception) == 0)
|
||||||
{
|
{
|
||||||
|
Display *retval;
|
||||||
|
|
||||||
longjmp_allowed = TRUE;
|
longjmp_allowed = TRUE;
|
||||||
retval = func_XOpenDisplay (displayname);
|
retval = func_XOpenDisplay (displayname);
|
||||||
longjmp_allowed = FALSE;
|
longjmp_allowed = FALSE;
|
||||||
@ -199,12 +199,12 @@ mc_XOpenDisplay (const char *displayname)
|
|||||||
int
|
int
|
||||||
mc_XCloseDisplay (Display * display)
|
mc_XCloseDisplay (Display * display)
|
||||||
{
|
{
|
||||||
int retval;
|
|
||||||
|
|
||||||
if (x11_available ())
|
if (x11_available ())
|
||||||
{
|
{
|
||||||
if (setjmp (x11_exception) == 0)
|
if (setjmp (x11_exception) == 0)
|
||||||
{
|
{
|
||||||
|
int retval;
|
||||||
|
|
||||||
longjmp_allowed = TRUE;
|
longjmp_allowed = TRUE;
|
||||||
retval = func_XCloseDisplay (display);
|
retval = func_XCloseDisplay (display);
|
||||||
longjmp_allowed = FALSE;
|
longjmp_allowed = FALSE;
|
||||||
|
@ -240,7 +240,6 @@ char *
|
|||||||
get_owner (int uid)
|
get_owner (int uid)
|
||||||
{
|
{
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
static char ibuf[10];
|
|
||||||
char *name;
|
char *name;
|
||||||
static int uid_last;
|
static int uid_last;
|
||||||
|
|
||||||
@ -256,6 +255,8 @@ get_owner (int uid)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
static char ibuf[10];
|
||||||
|
|
||||||
g_snprintf (ibuf, sizeof (ibuf), "%d", uid);
|
g_snprintf (ibuf, sizeof (ibuf), "%d", uid);
|
||||||
return ibuf;
|
return ibuf;
|
||||||
}
|
}
|
||||||
@ -267,7 +268,6 @@ char *
|
|||||||
get_group (int gid)
|
get_group (int gid)
|
||||||
{
|
{
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
static char gbuf[10];
|
|
||||||
char *name;
|
char *name;
|
||||||
static int gid_last;
|
static int gid_last;
|
||||||
|
|
||||||
@ -283,6 +283,8 @@ get_group (int gid)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
static char gbuf[10];
|
||||||
|
|
||||||
g_snprintf (gbuf, sizeof (gbuf), "%d", gid);
|
g_snprintf (gbuf, sizeof (gbuf), "%d", gid);
|
||||||
return gbuf;
|
return gbuf;
|
||||||
}
|
}
|
||||||
@ -463,7 +465,6 @@ tilde_expand (const char *directory)
|
|||||||
{
|
{
|
||||||
struct passwd *passwd;
|
struct passwd *passwd;
|
||||||
const char *p, *q;
|
const char *p, *q;
|
||||||
char *name;
|
|
||||||
|
|
||||||
if (*directory != '~')
|
if (*directory != '~')
|
||||||
return g_strdup (directory);
|
return g_strdup (directory);
|
||||||
@ -485,6 +486,8 @@ tilde_expand (const char *directory)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char *name;
|
||||||
|
|
||||||
name = g_strndup (p, q - p);
|
name = g_strndup (p, q - p);
|
||||||
passwd = getpwnam (name);
|
passwd = getpwnam (name);
|
||||||
q++;
|
q++;
|
||||||
@ -624,7 +627,6 @@ void
|
|||||||
custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
|
custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
|
||||||
{
|
{
|
||||||
char *p, *s;
|
char *p, *s;
|
||||||
size_t len;
|
|
||||||
char *lpath = path; /* path without leading UNC part */
|
char *lpath = path; /* path without leading UNC part */
|
||||||
const size_t url_delim_len = strlen (VFS_PATH_URL_DELIMITER);
|
const size_t url_delim_len = strlen (VFS_PATH_URL_DELIMITER);
|
||||||
|
|
||||||
@ -672,6 +674,8 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
|
|||||||
|
|
||||||
if (flags & CANON_PATH_REMSLASHDOTS)
|
if (flags & CANON_PATH_REMSLASHDOTS)
|
||||||
{
|
{
|
||||||
|
size_t len;
|
||||||
|
|
||||||
/* 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 && *p == PATH_SEP)
|
||||||
|
@ -1238,7 +1238,6 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||||||
char *dirname, *name;
|
char *dirname, *name;
|
||||||
struct vfs_s_entry *ent;
|
struct vfs_s_entry *ent;
|
||||||
struct vfs_s_inode *dir;
|
struct vfs_s_inode *dir;
|
||||||
int tmp_handle;
|
|
||||||
|
|
||||||
/* If the filesystem is read-only, disable file creation */
|
/* If the filesystem is read-only, disable file creation */
|
||||||
if (!(flags & O_CREAT) || !(path_element->class->write))
|
if (!(flags & O_CREAT) || !(path_element->class->write))
|
||||||
@ -1258,6 +1257,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||||||
vfs_s_insert_entry (path_element->class, dir, ent);
|
vfs_s_insert_entry (path_element->class, dir, ent);
|
||||||
if ((VFSDATA (path_element)->flags & VFS_S_USETMP) != 0)
|
if ((VFSDATA (path_element)->flags & VFS_S_USETMP) != 0)
|
||||||
{
|
{
|
||||||
|
int tmp_handle;
|
||||||
vfs_path_t *tmp_vpath;
|
vfs_path_t *tmp_vpath;
|
||||||
|
|
||||||
tmp_handle = vfs_mkstemps (&tmp_vpath, path_element->class->name, name);
|
tmp_handle = vfs_mkstemps (&tmp_vpath, path_element->class->name, name);
|
||||||
@ -1547,7 +1547,6 @@ vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char ter
|
|||||||
int
|
int
|
||||||
vfs_s_get_line_interruptible (struct vfs_class *me, char *buffer, int size, int fd)
|
vfs_s_get_line_interruptible (struct vfs_class *me, char *buffer, int size, int fd)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
(void) me;
|
(void) me;
|
||||||
@ -1555,6 +1554,8 @@ vfs_s_get_line_interruptible (struct vfs_class *me, char *buffer, int size, int
|
|||||||
tty_enable_interrupt_key ();
|
tty_enable_interrupt_key ();
|
||||||
for (i = 0; i < size - 1; i++)
|
for (i = 0; i < size - 1; i++)
|
||||||
{
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
n = read (fd, buffer + i, 1);
|
n = read (fd, buffer + i, 1);
|
||||||
tty_disable_interrupt_key ();
|
tty_disable_interrupt_key ();
|
||||||
if (n == -1 && errno == EINTR)
|
if (n == -1 && errno == EINTR)
|
||||||
|
@ -239,7 +239,7 @@ vfs_path_url_split (vfs_path_element_t * path_element, const char *path)
|
|||||||
{
|
{
|
||||||
char *pcopy;
|
char *pcopy;
|
||||||
const char *pend;
|
const char *pend;
|
||||||
char *colon, *inner_colon, *at, *rest;
|
char *colon, *at, *rest;
|
||||||
|
|
||||||
path_element->port = 0;
|
path_element->port = 0;
|
||||||
|
|
||||||
@ -254,6 +254,8 @@ vfs_path_url_split (vfs_path_element_t * path_element, const char *path)
|
|||||||
rest = pcopy;
|
rest = pcopy;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char *inner_colon;
|
||||||
|
|
||||||
*at = '\0';
|
*at = '\0';
|
||||||
inner_colon = strchr (pcopy, ':');
|
inner_colon = strchr (pcopy, ':');
|
||||||
if (inner_colon != NULL)
|
if (inner_colon != NULL)
|
||||||
@ -443,7 +445,6 @@ vfs_path_from_str_uri_parser (char *path, vfs_path_flag_t flags)
|
|||||||
{
|
{
|
||||||
char *vfs_prefix_start;
|
char *vfs_prefix_start;
|
||||||
char *real_vfs_prefix_start = url_delimiter;
|
char *real_vfs_prefix_start = url_delimiter;
|
||||||
char *slash_pointer;
|
|
||||||
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 && *(real_vfs_prefix_start) != PATH_SEP)
|
||||||
@ -463,6 +464,8 @@ vfs_path_from_str_uri_parser (char *path, vfs_path_flag_t flags)
|
|||||||
sub = VFSDATA (element);
|
sub = VFSDATA (element);
|
||||||
if (sub != NULL && (sub->flags & VFS_S_REMOTE) != 0)
|
if (sub != NULL && (sub->flags & VFS_S_REMOTE) != 0)
|
||||||
{
|
{
|
||||||
|
char *slash_pointer;
|
||||||
|
|
||||||
slash_pointer = strchr (url_delimiter, PATH_SEP);
|
slash_pointer = strchr (url_delimiter, PATH_SEP);
|
||||||
if (slash_pointer == NULL)
|
if (slash_pointer == NULL)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Utilities for VFS modules.
|
Utilities for VFS modules.
|
||||||
|
|
||||||
Copyright (C) 1988, 1992, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
Copyright (C) 1988, 1992, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||||
2005, 2006, 2007, 2011
|
2005, 2006, 2007, 2011, 2013
|
||||||
The Free Software Foundation, Inc.
|
The Free Software Foundation, Inc.
|
||||||
|
|
||||||
Copyright (C) 1995, 1996 Miguel de Icaza
|
Copyright (C) 1995, 1996 Miguel de Icaza
|
||||||
@ -60,11 +60,13 @@
|
|||||||
#define TGNMLEN 256
|
#define TGNMLEN 256
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define myuid ( my_uid < 0? (my_uid = getuid()): my_uid )
|
|
||||||
#define mygid ( my_gid < 0? (my_gid = getgid()): my_gid )
|
|
||||||
|
|
||||||
#define MC_HISTORY_VFS_PASSWORD "mc.vfs.password"
|
#define MC_HISTORY_VFS_PASSWORD "mc.vfs.password"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME2, the "-993" is to reduce the chance of a hit on the first lookup.
|
||||||
|
*/
|
||||||
|
#define GUID_DEFAULT_CONST -993
|
||||||
|
|
||||||
/*** file scope type declarations ****************************************************************/
|
/*** file scope type declarations ****************************************************************/
|
||||||
|
|
||||||
/*** file scope variables ************************************************************************/
|
/*** file scope variables ************************************************************************/
|
||||||
@ -96,7 +98,6 @@ vfs_get_local_username (void)
|
|||||||
/**
|
/**
|
||||||
* Look up a user or group name from a uid/gid, maintaining a cache.
|
* Look up a user or group name from a uid/gid, maintaining a cache.
|
||||||
* FIXME, for now it's a one-entry cache.
|
* FIXME, for now it's a one-entry cache.
|
||||||
* FIXME2, the "-993" is to reduce the chance of a hit on the first lookup.
|
|
||||||
* This file should be modified for non-unix systems to do something
|
* This file should be modified for non-unix systems to do something
|
||||||
* reasonable.
|
* reasonable.
|
||||||
*/
|
*/
|
||||||
@ -106,15 +107,14 @@ vfs_get_local_username (void)
|
|||||||
int
|
int
|
||||||
vfs_finduid (const char *uname)
|
vfs_finduid (const char *uname)
|
||||||
{
|
{
|
||||||
static int saveuid = -993;
|
static int saveuid = GUID_DEFAULT_CONST;
|
||||||
static char saveuname[TUNMLEN];
|
static char saveuname[TUNMLEN] = "\0";
|
||||||
static int my_uid = -993;
|
|
||||||
|
|
||||||
struct passwd *pw;
|
|
||||||
|
|
||||||
if (uname[0] != saveuname[0] /* Quick test w/o proc call */
|
if (uname[0] != saveuname[0] /* Quick test w/o proc call */
|
||||||
|| 0 != strncmp (uname, saveuname, TUNMLEN))
|
|| 0 != strncmp (uname, saveuname, TUNMLEN))
|
||||||
{
|
{
|
||||||
|
struct passwd *pw;
|
||||||
|
|
||||||
g_strlcpy (saveuname, uname, TUNMLEN);
|
g_strlcpy (saveuname, uname, TUNMLEN);
|
||||||
pw = getpwnam (uname);
|
pw = getpwnam (uname);
|
||||||
if (pw)
|
if (pw)
|
||||||
@ -123,7 +123,12 @@ vfs_finduid (const char *uname)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
saveuid = myuid;
|
static int my_uid = GUID_DEFAULT_CONST;
|
||||||
|
|
||||||
|
if (my_uid < 0)
|
||||||
|
my_uid = getuid ();
|
||||||
|
|
||||||
|
saveuid = my_uid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return saveuid;
|
return saveuid;
|
||||||
@ -134,15 +139,15 @@ vfs_finduid (const char *uname)
|
|||||||
int
|
int
|
||||||
vfs_findgid (const char *gname)
|
vfs_findgid (const char *gname)
|
||||||
{
|
{
|
||||||
static int savegid = -993;
|
static int savegid = GUID_DEFAULT_CONST;
|
||||||
static char savegname[TGNMLEN];
|
static char savegname[TGNMLEN] = "\0";
|
||||||
static int my_gid = -993;
|
|
||||||
|
|
||||||
struct group *gr;
|
|
||||||
|
|
||||||
if (gname[0] != savegname[0] /* Quick test w/o proc call */
|
if (gname[0] != savegname[0] /* Quick test w/o proc call */
|
||||||
|| 0 != strncmp (gname, savegname, TUNMLEN))
|
|| 0 != strncmp (gname, savegname, TUNMLEN))
|
||||||
{
|
{
|
||||||
|
struct group *gr;
|
||||||
|
|
||||||
g_strlcpy (savegname, gname, TUNMLEN);
|
g_strlcpy (savegname, gname, TUNMLEN);
|
||||||
gr = getgrnam (gname);
|
gr = getgrnam (gname);
|
||||||
if (gr)
|
if (gr)
|
||||||
@ -151,7 +156,12 @@ vfs_findgid (const char *gname)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
savegid = mygid;
|
static int my_gid = GUID_DEFAULT_CONST;
|
||||||
|
|
||||||
|
if (my_gid < 0)
|
||||||
|
my_gid = getgid ();
|
||||||
|
|
||||||
|
savegid = my_gid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return savegid;
|
return savegid;
|
||||||
@ -232,7 +242,7 @@ vfs_url_split (const char *path, int default_port, vfs_url_flags_t flags)
|
|||||||
char *pcopy;
|
char *pcopy;
|
||||||
size_t pcopy_len;
|
size_t pcopy_len;
|
||||||
const char *pend;
|
const char *pend;
|
||||||
char *dir, *colon, *inner_colon, *at, *rest;
|
char *dir, *colon, *at, *rest;
|
||||||
|
|
||||||
path_element = g_new0 (vfs_path_element_t, 1);
|
path_element = g_new0 (vfs_path_element_t, 1);
|
||||||
path_element->port = default_port;
|
path_element->port = default_port;
|
||||||
@ -264,6 +274,8 @@ vfs_url_split (const char *path, int default_port, vfs_url_flags_t flags)
|
|||||||
rest = pcopy;
|
rest = pcopy;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char *inner_colon;
|
||||||
|
|
||||||
*at = '\0';
|
*at = '\0';
|
||||||
inner_colon = strchr (pcopy, ':');
|
inner_colon = strchr (pcopy, ':');
|
||||||
if (inner_colon != NULL)
|
if (inner_colon != NULL)
|
||||||
|
@ -113,7 +113,6 @@ _vfs_translate_path (const char *path, int size, GIConv defcnv, GString * buffer
|
|||||||
estr_t state = ESTR_SUCCESS;
|
estr_t state = ESTR_SUCCESS;
|
||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
const char *semi;
|
const char *semi;
|
||||||
const char *slash;
|
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return ESTR_SUCCESS;
|
return ESTR_SUCCESS;
|
||||||
@ -125,6 +124,7 @@ _vfs_translate_path (const char *path, int size, GIConv defcnv, GString * buffer
|
|||||||
if (semi != NULL && (semi == path || *(semi - 1) == PATH_SEP))
|
if (semi != NULL && (semi == path || *(semi - 1) == PATH_SEP))
|
||||||
{
|
{
|
||||||
char encoding[16];
|
char encoding[16];
|
||||||
|
const char *slash;
|
||||||
GIConv coder = INVALID_CONV;
|
GIConv coder = INVALID_CONV;
|
||||||
int ms;
|
int ms;
|
||||||
|
|
||||||
|
@ -162,7 +162,6 @@ buttonbar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi
|
|||||||
{
|
{
|
||||||
WButtonBar *bb = BUTTONBAR (w);
|
WButtonBar *bb = BUTTONBAR (w);
|
||||||
int i;
|
int i;
|
||||||
const char *text;
|
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
@ -187,6 +186,7 @@ buttonbar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi
|
|||||||
for (i = 0; i < BUTTONBAR_LABELS_NUM; i++)
|
for (i = 0; i < BUTTONBAR_LABELS_NUM; i++)
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
|
const char *text;
|
||||||
|
|
||||||
width = buttonbar_get_button_width (bb, i);
|
width = buttonbar_get_button_width (bb, i);
|
||||||
if (width <= 0)
|
if (width <= 0)
|
||||||
|
@ -528,7 +528,6 @@ dlg_key_event (WDialog * h, int d_key)
|
|||||||
static void
|
static void
|
||||||
frontend_dlg_run (WDialog * h)
|
frontend_dlg_run (WDialog * h)
|
||||||
{
|
{
|
||||||
int d_key;
|
|
||||||
Gpm_Event event;
|
Gpm_Event event;
|
||||||
|
|
||||||
event.x = -1;
|
event.x = -1;
|
||||||
@ -542,6 +541,8 @@ frontend_dlg_run (WDialog * h)
|
|||||||
|
|
||||||
while (h->state == DLG_ACTIVE)
|
while (h->state == DLG_ACTIVE)
|
||||||
{
|
{
|
||||||
|
int d_key;
|
||||||
|
|
||||||
if (mc_global.tty.winch_flag != 0)
|
if (mc_global.tty.winch_flag != 0)
|
||||||
dialog_change_screen_size ();
|
dialog_change_screen_size ();
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ char *
|
|||||||
history_show (GList ** history, Widget * widget, int current)
|
history_show (GList ** history, Widget * widget, int current)
|
||||||
{
|
{
|
||||||
GList *z, *hlist = NULL, *hi;
|
GList *z, *hlist = NULL, *hi;
|
||||||
size_t maxlen, i, count = 0;
|
size_t maxlen, count = 0;
|
||||||
char *r = NULL;
|
char *r = NULL;
|
||||||
WDialog *query_dlg;
|
WDialog *query_dlg;
|
||||||
WListbox *query_list;
|
WListbox *query_list;
|
||||||
@ -304,6 +304,7 @@ history_show (GList ** history, Widget * widget, int current)
|
|||||||
for (z = *history; z != NULL; z = g_list_previous (z))
|
for (z = *history; z != NULL; z = g_list_previous (z))
|
||||||
{
|
{
|
||||||
WLEntry *entry;
|
WLEntry *entry;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
i = str_term_width1 ((char *) z->data);
|
i = str_term_width1 ((char *) z->data);
|
||||||
maxlen = max (maxlen, i);
|
maxlen = max (maxlen, i);
|
||||||
|
@ -312,7 +312,6 @@ move_buffer_backward (WInput * in, int start, int end)
|
|||||||
static cb_ret_t
|
static cb_ret_t
|
||||||
insert_char (WInput * in, int c_code)
|
insert_char (WInput * in, int c_code)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (in->highlight)
|
if (in->highlight)
|
||||||
@ -356,6 +355,7 @@ insert_char (WInput * in, int c_code)
|
|||||||
|
|
||||||
if (strlen (in->buffer) + in->charpoint < in->current_max_size)
|
if (strlen (in->buffer) + in->charpoint < in->current_max_size)
|
||||||
{
|
{
|
||||||
|
size_t i;
|
||||||
/* bytes from begin */
|
/* bytes from begin */
|
||||||
size_t ins_point = str_offset_to_pos (in->buffer, in->point);
|
size_t ins_point = str_offset_to_pos (in->buffer, in->point);
|
||||||
/* move chars */
|
/* move chars */
|
||||||
@ -1253,7 +1253,6 @@ input_update (WInput * in, gboolean clear_first)
|
|||||||
{
|
{
|
||||||
Widget *w = WIDGET (in);
|
Widget *w = WIDGET (in);
|
||||||
int has_history = 0;
|
int has_history = 0;
|
||||||
int i;
|
|
||||||
int buf_len;
|
int buf_len;
|
||||||
const char *cp;
|
const char *cp;
|
||||||
int pw;
|
int pw;
|
||||||
@ -1332,6 +1331,8 @@ input_update (WInput * in, gboolean clear_first)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
cp = str_term_substring (in->buffer, in->term_first_shown, w->cols - has_history);
|
cp = str_term_substring (in->buffer, in->term_first_shown, w->cols - has_history);
|
||||||
tty_setcolor (in->color[WINPUTC_MAIN]);
|
tty_setcolor (in->color[WINPUTC_MAIN]);
|
||||||
for (i = 0; i < w->cols - has_history; i++)
|
for (i = 0; i < w->cols - has_history; i++)
|
||||||
|
@ -736,8 +736,6 @@ completion_matches (const char *text, CompletionFunction entry_function, input_c
|
|||||||
lowest common denominator. That then becomes match_list[0]. */
|
lowest common denominator. That then becomes match_list[0]. */
|
||||||
if (matches)
|
if (matches)
|
||||||
{
|
{
|
||||||
register size_t i = 1;
|
|
||||||
int low = 4096; /* Count of max-matched characters. */
|
|
||||||
|
|
||||||
/* If only one match, just use that. */
|
/* If only one match, just use that. */
|
||||||
if (matches == 1)
|
if (matches == 1)
|
||||||
@ -747,6 +745,8 @@ completion_matches (const char *text, CompletionFunction entry_function, input_c
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
size_t i = 1;
|
||||||
|
int low = 4096; /* Count of max-matched characters. */
|
||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
qsort (match_list + 1, matches, sizeof (char *), match_compare);
|
qsort (match_list + 1, matches, sizeof (char *), match_compare);
|
||||||
@ -847,12 +847,11 @@ try_complete_commands_prepare (try_complete_automation_state_t * state, char *te
|
|||||||
state->in_command_position++;
|
state->in_command_position++;
|
||||||
else if (strchr (command_separator_chars, ti[0]) != NULL)
|
else if (strchr (command_separator_chars, ti[0]) != NULL)
|
||||||
{
|
{
|
||||||
int this_char, prev_char;
|
|
||||||
|
|
||||||
state->in_command_position++;
|
state->in_command_position++;
|
||||||
|
|
||||||
if (ti != text)
|
if (ti != text)
|
||||||
{
|
{
|
||||||
|
int this_char, prev_char;
|
||||||
|
|
||||||
/* Handle the two character tokens '>&', '<&', and '>|'.
|
/* Handle the two character tokens '>&', '<&', and '>|'.
|
||||||
We are not in a command position after one of these. */
|
We are not in a command position after one of these. */
|
||||||
this_char = ti[0];
|
this_char = ti[0];
|
||||||
@ -938,20 +937,20 @@ try_complete_all_possible (try_complete_automation_state_t * state, char *text,
|
|||||||
{
|
{
|
||||||
char *const cdpath_ref = g_strdup (getenv ("CDPATH"));
|
char *const cdpath_ref = g_strdup (getenv ("CDPATH"));
|
||||||
char *cdpath = cdpath_ref;
|
char *cdpath = cdpath_ref;
|
||||||
char c, *s;
|
char c;
|
||||||
|
|
||||||
|
c = (cdpath == NULL) ? '\0' : ':';
|
||||||
|
|
||||||
if (cdpath == NULL)
|
|
||||||
c = 0;
|
|
||||||
else
|
|
||||||
c = ':';
|
|
||||||
while (!matches && c == ':')
|
while (!matches && c == ':')
|
||||||
{
|
{
|
||||||
|
char *s;
|
||||||
|
|
||||||
s = strchr (cdpath, ':');
|
s = strchr (cdpath, ':');
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
s = strchr (cdpath, 0);
|
s = strchr (cdpath, '\0');
|
||||||
c = *s;
|
c = *s;
|
||||||
*s = 0;
|
*s = '\0';
|
||||||
if (*cdpath)
|
if (*cdpath != '\0')
|
||||||
{
|
{
|
||||||
state->r = mc_build_filename (cdpath, state->word, NULL);
|
state->r = mc_build_filename (cdpath, state->word, NULL);
|
||||||
SHOW_C_CTX ("try_complete:filename_subst_2");
|
SHOW_C_CTX ("try_complete:filename_subst_2");
|
||||||
@ -1009,7 +1008,6 @@ insert_text (WInput * in, char *text, ssize_t size)
|
|||||||
static cb_ret_t
|
static cb_ret_t
|
||||||
query_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
|
query_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
|
||||||
{
|
{
|
||||||
static char buff[MB_LEN_MAX] = "";
|
|
||||||
static int bl = 0;
|
static int bl = 0;
|
||||||
|
|
||||||
WDialog *h = DIALOG (w);
|
WDialog *h = DIALOG (w);
|
||||||
@ -1085,6 +1083,7 @@ query_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
static char buff[MB_LEN_MAX] = "";
|
||||||
GList *e;
|
GList *e;
|
||||||
int i;
|
int i;
|
||||||
int need_redraw = 0;
|
int need_redraw = 0;
|
||||||
|
@ -70,7 +70,7 @@ create_listbox_window_centered (int center_y, int center_x, int lines, int cols,
|
|||||||
|
|
||||||
const int space = 4;
|
const int space = 4;
|
||||||
|
|
||||||
int xpos, ypos, len;
|
int xpos, ypos;
|
||||||
Listbox *listbox;
|
Listbox *listbox;
|
||||||
|
|
||||||
/* Adjust sizes */
|
/* Adjust sizes */
|
||||||
@ -78,6 +78,8 @@ create_listbox_window_centered (int center_y, int center_x, int lines, int cols,
|
|||||||
|
|
||||||
if (title != NULL)
|
if (title != NULL)
|
||||||
{
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
len = str_term_width1 (title) + 4;
|
len = str_term_width1 (title) + 4;
|
||||||
cols = max (cols, len);
|
cols = max (cols, len);
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,6 @@ static void
|
|||||||
menubar_first (WMenuBar * menubar)
|
menubar_first (WMenuBar * menubar)
|
||||||
{
|
{
|
||||||
menu_t *menu = MENU (g_list_nth_data (menubar->menu, menubar->selected));
|
menu_t *menu = MENU (g_list_nth_data (menubar->menu, menubar->selected));
|
||||||
menu_entry_t *entry;
|
|
||||||
|
|
||||||
if (menu->selected == 0)
|
if (menu->selected == 0)
|
||||||
return;
|
return;
|
||||||
@ -406,6 +405,8 @@ menubar_first (WMenuBar * menubar)
|
|||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
|
menu_entry_t *entry;
|
||||||
|
|
||||||
entry = MENUENTRY (g_list_nth_data (menu->entries, menu->selected));
|
entry = MENUENTRY (g_list_nth_data (menu->entries, menu->selected));
|
||||||
|
|
||||||
if ((entry == NULL) || (entry->command == CK_IgnoreKey))
|
if ((entry == NULL) || (entry->command == CK_IgnoreKey))
|
||||||
|
@ -274,12 +274,10 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
WDialog *query_dlg;
|
WDialog *query_dlg;
|
||||||
WButton *button;
|
WButton *button;
|
||||||
WButton *defbutton = NULL;
|
|
||||||
int win_len = 0;
|
int win_len = 0;
|
||||||
int i;
|
int i;
|
||||||
int result = -1;
|
int result = -1;
|
||||||
int cols, lines;
|
int cols, lines;
|
||||||
char *cur_name;
|
|
||||||
const int *query_colors = (flags & D_ERROR) != 0 ? alarm_colors : dialog_colors;
|
const int *query_colors = (flags & D_ERROR) != 0 ? alarm_colors : dialog_colors;
|
||||||
dlg_flags_t dlg_flags = (flags & D_CENTER) != 0 ? (DLG_CENTER | DLG_TRYUP) : DLG_NONE;
|
dlg_flags_t dlg_flags = (flags & D_CENTER) != 0 ? (DLG_CENTER | DLG_TRYUP) : DLG_NONE;
|
||||||
|
|
||||||
@ -311,9 +309,10 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
|
|||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
WButton *defbutton = NULL;
|
||||||
|
|
||||||
add_widget_autopos (query_dlg, label_new (2, 3, text), WPOS_KEEP_TOP | WPOS_CENTER_HORZ,
|
add_widget_autopos (query_dlg, label_new (2, 3, text), WPOS_KEEP_TOP | WPOS_CENTER_HORZ,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
add_widget (query_dlg, hline_new (lines - 4, -1, -1));
|
add_widget (query_dlg, hline_new (lines - 4, -1, -1));
|
||||||
|
|
||||||
cols = (cols - win_len - 2) / 2 + 2;
|
cols = (cols - win_len - 2) / 2 + 2;
|
||||||
@ -321,6 +320,7 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
|
|||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
int xpos;
|
int xpos;
|
||||||
|
char *cur_name;
|
||||||
|
|
||||||
cur_name = va_arg (ap, char *);
|
cur_name = va_arg (ap, char *);
|
||||||
xpos = str_term_width1 (cur_name) + 6;
|
xpos = str_term_width1 (cur_name) + 6;
|
||||||
@ -487,11 +487,12 @@ input_expand_dialog (const char *header, const char *text,
|
|||||||
input_complete_t completion_flags)
|
input_complete_t completion_flags)
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
char *expanded;
|
|
||||||
|
|
||||||
result = input_dialog (header, text, history_name, def_text, completion_flags);
|
result = input_dialog (header, text, history_name, def_text, completion_flags);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
char *expanded;
|
||||||
|
|
||||||
expanded = tilde_expand (result);
|
expanded = tilde_expand (result);
|
||||||
g_free (result);
|
g_free (result);
|
||||||
return expanded;
|
return expanded;
|
||||||
|
@ -138,8 +138,6 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
|
|||||||
static void
|
static void
|
||||||
handle_console_linux (console_action_t action)
|
handle_console_linux (console_action_t action)
|
||||||
{
|
{
|
||||||
char *tty_name;
|
|
||||||
char *mc_conssaver;
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
@ -186,6 +184,8 @@ handle_console_linux (console_action_t action)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Child */
|
/* Child */
|
||||||
|
char *tty_name;
|
||||||
|
|
||||||
/* Close the extra pipe ends */
|
/* Close the extra pipe ends */
|
||||||
status = close (pipefd1[1]);
|
status = close (pipefd1[1]);
|
||||||
status = close (pipefd2[0]);
|
status = close (pipefd2[0]);
|
||||||
@ -206,8 +206,10 @@ handle_console_linux (console_action_t action)
|
|||||||
if (dup2 (status, 2) == -1)
|
if (dup2 (status, 2) == -1)
|
||||||
break;
|
break;
|
||||||
status = close (status);
|
status = close (status);
|
||||||
if (tty_name)
|
if (tty_name != NULL)
|
||||||
{
|
{
|
||||||
|
char *mc_conssaver;
|
||||||
|
|
||||||
/* Exec the console save/restore handler */
|
/* Exec the console save/restore handler */
|
||||||
mc_conssaver = mc_build_filename (SAVERDIR, "cons.saver", NULL);
|
mc_conssaver = mc_build_filename (SAVERDIR, "cons.saver", NULL);
|
||||||
execl (mc_conssaver, "cons.saver", tty_name, (char *) NULL);
|
execl (mc_conssaver, "cons.saver", tty_name, (char *) NULL);
|
||||||
|
@ -143,7 +143,6 @@ static gboolean
|
|||||||
mcdiffview_do_search_backward (WDiff * dview)
|
mcdiffview_do_search_backward (WDiff * dview)
|
||||||
{
|
{
|
||||||
ssize_t ind;
|
ssize_t ind;
|
||||||
DIFFLN *p;
|
|
||||||
|
|
||||||
if (dview->search.last_accessed_num_line < 0)
|
if (dview->search.last_accessed_num_line < 0)
|
||||||
{
|
{
|
||||||
@ -156,6 +155,8 @@ mcdiffview_do_search_backward (WDiff * dview)
|
|||||||
|
|
||||||
for (ind = --dview->search.last_accessed_num_line; ind >= 0; ind--)
|
for (ind = --dview->search.last_accessed_num_line; ind >= 0; ind--)
|
||||||
{
|
{
|
||||||
|
DIFFLN *p;
|
||||||
|
|
||||||
p = (DIFFLN *) & g_array_index (dview->a[dview->ord], DIFFLN, (size_t) ind);
|
p = (DIFFLN *) & g_array_index (dview->a[dview->ord], DIFFLN, (size_t) ind);
|
||||||
if (p->u.len == 0)
|
if (p->u.len == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -177,7 +178,6 @@ static gboolean
|
|||||||
mcdiffview_do_search_forward (WDiff * dview)
|
mcdiffview_do_search_forward (WDiff * dview)
|
||||||
{
|
{
|
||||||
size_t ind;
|
size_t ind;
|
||||||
DIFFLN *p;
|
|
||||||
|
|
||||||
if (dview->search.last_accessed_num_line < 0)
|
if (dview->search.last_accessed_num_line < 0)
|
||||||
dview->search.last_accessed_num_line = -1;
|
dview->search.last_accessed_num_line = -1;
|
||||||
@ -190,6 +190,8 @@ mcdiffview_do_search_forward (WDiff * dview)
|
|||||||
for (ind = (size_t)++ dview->search.last_accessed_num_line; ind < dview->a[dview->ord]->len;
|
for (ind = (size_t)++ dview->search.last_accessed_num_line; ind < dview->a[dview->ord]->len;
|
||||||
ind++)
|
ind++)
|
||||||
{
|
{
|
||||||
|
DIFFLN *p;
|
||||||
|
|
||||||
p = (DIFFLN *) & g_array_index (dview->a[dview->ord], DIFFLN, ind);
|
p = (DIFFLN *) & g_array_index (dview->a[dview->ord], DIFFLN, ind);
|
||||||
if (p->u.len == 0)
|
if (p->u.len == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -70,9 +70,11 @@
|
|||||||
#define g_array_foreach(a, TP, cbf) \
|
#define g_array_foreach(a, TP, cbf) \
|
||||||
do { \
|
do { \
|
||||||
size_t g_array_foreach_i;\
|
size_t g_array_foreach_i;\
|
||||||
TP *g_array_foreach_var = NULL; \
|
\
|
||||||
for (g_array_foreach_i = 0; g_array_foreach_i < a->len; g_array_foreach_i++) \
|
for (g_array_foreach_i = 0; g_array_foreach_i < a->len; g_array_foreach_i++) \
|
||||||
{ \
|
{ \
|
||||||
|
TP *g_array_foreach_var; \
|
||||||
|
\
|
||||||
g_array_foreach_var = &g_array_index (a, TP, g_array_foreach_i); \
|
g_array_foreach_var = &g_array_index (a, TP, g_array_foreach_i); \
|
||||||
(*cbf) (g_array_foreach_var); \
|
(*cbf) (g_array_foreach_var); \
|
||||||
} \
|
} \
|
||||||
@ -1419,8 +1421,7 @@ cvt_mget (const char *src, size_t srcsize, char *dst, int dstsize, int skip, int
|
|||||||
utf_ch = dview_get_utf ((char *) src, &w, &res);
|
utf_ch = dview_get_utf ((char *) src, &w, &res);
|
||||||
if (w > 1)
|
if (w > 1)
|
||||||
skip += w - 1;
|
skip += w - 1;
|
||||||
if (!g_unichar_isprint (utf_ch))
|
(void) utf_ch;
|
||||||
utf_ch = '.';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1521,8 +1522,7 @@ cvt_mgeta (const char *src, size_t srcsize, char *dst, int dstsize, int skip, in
|
|||||||
utf_ch = dview_get_utf ((char *) src, &w, &res);
|
utf_ch = dview_get_utf ((char *) src, &w, &res);
|
||||||
if (w > 1)
|
if (w > 1)
|
||||||
skip += w - 1;
|
skip += w - 1;
|
||||||
if (!g_unichar_isprint (utf_ch))
|
(void) utf_ch;
|
||||||
utf_ch = '.';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1799,12 +1799,12 @@ redo_diff (WDiff * dview)
|
|||||||
if (dview->hdiff != NULL)
|
if (dview->hdiff != NULL)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
const DIFFLN *p;
|
|
||||||
const DIFFLN *q;
|
|
||||||
|
|
||||||
for (i = 0; i < dview->a[DIFF_LEFT]->len; i++)
|
for (i = 0; i < dview->a[DIFF_LEFT]->len; i++)
|
||||||
{
|
{
|
||||||
GArray *h = NULL;
|
GArray *h = NULL;
|
||||||
|
const DIFFLN *p;
|
||||||
|
const DIFFLN *q;
|
||||||
|
|
||||||
p = &g_array_index (dview->a[DIFF_LEFT], DIFFLN, i);
|
p = &g_array_index (dview->a[DIFF_LEFT], DIFFLN, i);
|
||||||
q = &g_array_index (dview->a[DIFF_RIGHT], DIFFLN, i);
|
q = &g_array_index (dview->a[DIFF_RIGHT], DIFFLN, i);
|
||||||
@ -2921,10 +2921,10 @@ dview_goto_cmd (WDiff * dview, diff_place_t ord)
|
|||||||
|
|
||||||
if (newline > 0)
|
if (newline > 0)
|
||||||
{
|
{
|
||||||
const DIFFLN *p;
|
|
||||||
|
|
||||||
for (; i < dview->a[ord]->len; i++)
|
for (; i < dview->a[ord]->len; i++)
|
||||||
{
|
{
|
||||||
|
const DIFFLN *p;
|
||||||
|
|
||||||
p = &g_array_index (dview->a[ord], DIFFLN, i);
|
p = &g_array_index (dview->a[ord], DIFFLN, i);
|
||||||
if (p->line == newline)
|
if (p->line == newline)
|
||||||
break;
|
break;
|
||||||
|
@ -186,7 +186,7 @@ edit_load_file_fast (edit_buffer_t * buf, const vfs_path_t * filename_vpath)
|
|||||||
static int
|
static int
|
||||||
edit_find_filter (const vfs_path_t * filename_vpath)
|
edit_find_filter (const vfs_path_t * filename_vpath)
|
||||||
{
|
{
|
||||||
size_t i, l, e;
|
size_t i, l;
|
||||||
|
|
||||||
if (filename_vpath == NULL)
|
if (filename_vpath == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
@ -194,6 +194,8 @@ edit_find_filter (const vfs_path_t * filename_vpath)
|
|||||||
l = strlen (vfs_path_as_str (filename_vpath));
|
l = strlen (vfs_path_as_str (filename_vpath));
|
||||||
for (i = 0; i < G_N_ELEMENTS (all_filters); i++)
|
for (i = 0; i < G_N_ELEMENTS (all_filters); i++)
|
||||||
{
|
{
|
||||||
|
size_t e;
|
||||||
|
|
||||||
e = strlen (all_filters[i].extension);
|
e = strlen (all_filters[i].extension);
|
||||||
if (l > e)
|
if (l > e)
|
||||||
if (!strcmp (all_filters[i].extension, vfs_path_as_str (filename_vpath) + l - e))
|
if (!strcmp (all_filters[i].extension, vfs_path_as_str (filename_vpath) + l - e))
|
||||||
@ -1336,7 +1338,6 @@ static void
|
|||||||
edit_auto_indent (WEdit * edit)
|
edit_auto_indent (WEdit * edit)
|
||||||
{
|
{
|
||||||
off_t p;
|
off_t p;
|
||||||
char c;
|
|
||||||
|
|
||||||
p = edit->buffer.curs1;
|
p = edit->buffer.curs1;
|
||||||
/* use the previous line as a template */
|
/* use the previous line as a template */
|
||||||
@ -1344,6 +1345,8 @@ edit_auto_indent (WEdit * edit)
|
|||||||
/* copy the leading whitespace of the line */
|
/* copy the leading whitespace of the line */
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{ /* no range check - the line _is_ \n-terminated */
|
{ /* no range check - the line _is_ \n-terminated */
|
||||||
|
char c;
|
||||||
|
|
||||||
c = edit_buffer_get_byte (&edit->buffer, p++);
|
c = edit_buffer_get_byte (&edit->buffer, p++);
|
||||||
if (c != ' ' && c != '\t')
|
if (c != ' ' && c != '\t')
|
||||||
break;
|
break;
|
||||||
@ -1419,7 +1422,6 @@ static void
|
|||||||
check_and_wrap_line (WEdit * edit)
|
check_and_wrap_line (WEdit * edit)
|
||||||
{
|
{
|
||||||
off_t curs;
|
off_t curs;
|
||||||
int c;
|
|
||||||
|
|
||||||
if (!option_typewriter_wrap)
|
if (!option_typewriter_wrap)
|
||||||
return;
|
return;
|
||||||
@ -1429,6 +1431,8 @@ check_and_wrap_line (WEdit * edit)
|
|||||||
curs = edit->buffer.curs1;
|
curs = edit->buffer.curs1;
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
curs--;
|
curs--;
|
||||||
c = edit_buffer_get_byte (&edit->buffer, curs);
|
c = edit_buffer_get_byte (&edit->buffer, curs);
|
||||||
if (c == '\n' || curs <= 0)
|
if (c == '\n' || curs <= 0)
|
||||||
@ -1461,7 +1465,7 @@ static off_t
|
|||||||
edit_get_bracket (WEdit * edit, gboolean in_screen, unsigned long furthest_bracket_search)
|
edit_get_bracket (WEdit * edit, gboolean in_screen, unsigned long furthest_bracket_search)
|
||||||
{
|
{
|
||||||
const char *const b = "{}{[][()(", *p;
|
const char *const b = "{}{[][()(", *p;
|
||||||
int i = 1, a, inc = -1, c, d, n = 0;
|
int i = 1, inc = -1, c, d, n = 0;
|
||||||
unsigned long j = 0;
|
unsigned long j = 0;
|
||||||
off_t q;
|
off_t q;
|
||||||
|
|
||||||
@ -1481,6 +1485,8 @@ edit_get_bracket (WEdit * edit, gboolean in_screen, unsigned long furthest_brack
|
|||||||
inc = 1;
|
inc = 1;
|
||||||
for (q = edit->buffer.curs1 + inc;; q += inc)
|
for (q = edit->buffer.curs1 + inc;; q += inc)
|
||||||
{
|
{
|
||||||
|
int a;
|
||||||
|
|
||||||
/* out of buffer? */
|
/* out of buffer? */
|
||||||
if (q >= edit->buffer.size || q < 0)
|
if (q >= edit->buffer.size || q < 0)
|
||||||
break;
|
break;
|
||||||
@ -3311,7 +3317,7 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
|||||||
{
|
{
|
||||||
str[res] = '\0';
|
str[res] = '\0';
|
||||||
}
|
}
|
||||||
while (i <= UTF8_CHAR_LEN && str[i] != 0)
|
while (i <= UTF8_CHAR_LEN && str[i] != '\0')
|
||||||
{
|
{
|
||||||
char_for_insertion = str[i];
|
char_for_insertion = str[i];
|
||||||
edit_insert (edit, char_for_insertion);
|
edit_insert (edit, char_for_insertion);
|
||||||
|
@ -584,8 +584,6 @@ edit_buffer_backspace (edit_buffer_t * buf)
|
|||||||
off_t
|
off_t
|
||||||
edit_buffer_move_forward (const edit_buffer_t * buf, off_t current, long lines, off_t upto)
|
edit_buffer_move_forward (const edit_buffer_t * buf, off_t current, long lines, off_t upto)
|
||||||
{
|
{
|
||||||
long next;
|
|
||||||
|
|
||||||
if (upto != 0)
|
if (upto != 0)
|
||||||
return (off_t) edit_buffer_count_lines (buf, current, upto);
|
return (off_t) edit_buffer_count_lines (buf, current, upto);
|
||||||
|
|
||||||
@ -593,6 +591,8 @@ edit_buffer_move_forward (const edit_buffer_t * buf, off_t current, long lines,
|
|||||||
|
|
||||||
while (lines-- != 0)
|
while (lines-- != 0)
|
||||||
{
|
{
|
||||||
|
long next;
|
||||||
|
|
||||||
next = edit_buffer_get_eol (buf, current) + 1;
|
next = edit_buffer_get_eol (buf, current) + 1;
|
||||||
if (next > buf->size)
|
if (next > buf->size)
|
||||||
break;
|
break;
|
||||||
|
@ -1924,7 +1924,6 @@ edit_load_macro_cmd (WEdit * edit)
|
|||||||
gsize len, values_len;
|
gsize len, values_len;
|
||||||
const char *section_name = "editor";
|
const char *section_name = "editor";
|
||||||
gchar *macros_fname;
|
gchar *macros_fname;
|
||||||
int hotkey;
|
|
||||||
|
|
||||||
(void) edit;
|
(void) edit;
|
||||||
|
|
||||||
@ -1938,6 +1937,7 @@ edit_load_macro_cmd (WEdit * edit)
|
|||||||
keys = mc_config_get_keys (macros_config, section_name, &len);
|
keys = mc_config_get_keys (macros_config, section_name, &len);
|
||||||
for (profile_keys = keys; *profile_keys != NULL; profile_keys++)
|
for (profile_keys = keys; *profile_keys != NULL; profile_keys++)
|
||||||
{
|
{
|
||||||
|
int hotkey;
|
||||||
gboolean have_macro = FALSE;
|
gboolean have_macro = FALSE;
|
||||||
GArray *macros;
|
GArray *macros;
|
||||||
macros_t macro;
|
macros_t macro;
|
||||||
@ -2008,8 +2008,6 @@ edit_load_macro_cmd (WEdit * edit)
|
|||||||
gboolean
|
gboolean
|
||||||
edit_save_confirm_cmd (WEdit * edit)
|
edit_save_confirm_cmd (WEdit * edit)
|
||||||
{
|
{
|
||||||
char *f = NULL;
|
|
||||||
|
|
||||||
if (edit->filename_vpath == NULL)
|
if (edit->filename_vpath == NULL)
|
||||||
return edit_save_as_cmd (edit);
|
return edit_save_as_cmd (edit);
|
||||||
|
|
||||||
@ -2018,6 +2016,7 @@ edit_save_confirm_cmd (WEdit * edit)
|
|||||||
|
|
||||||
if (edit_confirm_save)
|
if (edit_confirm_save)
|
||||||
{
|
{
|
||||||
|
char *f;
|
||||||
gboolean ok;
|
gboolean ok;
|
||||||
|
|
||||||
f = g_strdup_printf (_("Confirm save file: \"%s\""),
|
f = g_strdup_printf (_("Confirm save file: \"%s\""),
|
||||||
@ -2278,7 +2277,6 @@ void
|
|||||||
edit_block_copy_cmd (WEdit * edit)
|
edit_block_copy_cmd (WEdit * edit)
|
||||||
{
|
{
|
||||||
off_t start_mark, end_mark, current = edit->buffer.curs1;
|
off_t start_mark, end_mark, current = edit->buffer.curs1;
|
||||||
long col_delta = 0;
|
|
||||||
off_t mark1, mark2;
|
off_t mark1, mark2;
|
||||||
long c1, c2;
|
long c1, c2;
|
||||||
off_t size;
|
off_t size;
|
||||||
@ -2296,6 +2294,8 @@ edit_block_copy_cmd (WEdit * edit)
|
|||||||
|
|
||||||
if (edit->column_highlight)
|
if (edit->column_highlight)
|
||||||
{
|
{
|
||||||
|
long col_delta;
|
||||||
|
|
||||||
col_delta = abs (edit->column2 - edit->column1);
|
col_delta = abs (edit->column2 - edit->column1);
|
||||||
edit_insert_column_of_text (edit, copy_buf, size, col_delta, &mark1, &mark2, &c1, &c2);
|
edit_insert_column_of_text (edit, copy_buf, size, col_delta, &mark1, &mark2, &c1, &c2);
|
||||||
}
|
}
|
||||||
|
@ -419,7 +419,6 @@ editcmd_dialog_select_definition_show (WEdit * edit, char *match_expr, int max_l
|
|||||||
WListbox *def_list;
|
WListbox *def_list;
|
||||||
int def_dlg_h; /* dialog height */
|
int def_dlg_h; /* dialog height */
|
||||||
int def_dlg_w; /* dialog width */
|
int def_dlg_w; /* dialog width */
|
||||||
char *label_def = NULL;
|
|
||||||
|
|
||||||
(void) word_len;
|
(void) word_len;
|
||||||
/* calculate the dialog metrics */
|
/* calculate the dialog metrics */
|
||||||
@ -456,6 +455,8 @@ editcmd_dialog_select_definition_show (WEdit * edit, char *match_expr, int max_l
|
|||||||
/* fill the listbox with the completions */
|
/* fill the listbox with the completions */
|
||||||
for (i = 0; i < num_lines; i++)
|
for (i = 0; i < num_lines; i++)
|
||||||
{
|
{
|
||||||
|
char *label_def;
|
||||||
|
|
||||||
label_def =
|
label_def =
|
||||||
g_strdup_printf ("%s -> %s:%ld", def_hash[i].short_define, def_hash[i].filename,
|
g_strdup_printf ("%s -> %s:%ld", def_hash[i].short_define, def_hash[i].filename,
|
||||||
def_hash[i].line);
|
def_hash[i].line);
|
||||||
|
@ -510,13 +510,9 @@ edit_draw_this_line (WEdit * edit, off_t b, long row, long start_col, long end_c
|
|||||||
struct line_s *p = line;
|
struct line_s *p = line;
|
||||||
|
|
||||||
off_t m1 = 0, m2 = 0, q;
|
off_t m1 = 0, m2 = 0, q;
|
||||||
long c1, c2;
|
|
||||||
int col, start_col_real;
|
int col, start_col_real;
|
||||||
unsigned int c;
|
|
||||||
int color;
|
int color;
|
||||||
int abn_style;
|
int abn_style;
|
||||||
int i;
|
|
||||||
unsigned int cur_line = 0;
|
|
||||||
int book_mark = 0;
|
int book_mark = 0;
|
||||||
char line_stat[LINE_STATE_WIDTH + 1] = "\0";
|
char line_stat[LINE_STATE_WIDTH + 1] = "\0";
|
||||||
|
|
||||||
@ -547,6 +543,8 @@ edit_draw_this_line (WEdit * edit, off_t b, long row, long start_col, long end_c
|
|||||||
|
|
||||||
if (option_line_state)
|
if (option_line_state)
|
||||||
{
|
{
|
||||||
|
unsigned int cur_line;
|
||||||
|
|
||||||
cur_line = edit->start_line + row;
|
cur_line = edit->start_line + row;
|
||||||
if (cur_line <= (unsigned int) edit->buffer.lines)
|
if (cur_line <= (unsigned int) edit->buffer.lines)
|
||||||
{
|
{
|
||||||
@ -572,6 +570,8 @@ edit_draw_this_line (WEdit * edit, off_t b, long row, long start_col, long end_c
|
|||||||
off_t tws = 0;
|
off_t tws = 0;
|
||||||
if (tty_use_colors () && visible_tws)
|
if (tty_use_colors () && visible_tws)
|
||||||
{
|
{
|
||||||
|
unsigned int c;
|
||||||
|
|
||||||
tws = edit_buffer_get_eol (&edit->buffer, b);
|
tws = edit_buffer_get_eol (&edit->buffer, b);
|
||||||
while (tws > b
|
while (tws > b
|
||||||
&& ((c = edit_buffer_get_byte (&edit->buffer, tws - 1)) == ' ' || c == '\t'))
|
&& ((c = edit_buffer_get_byte (&edit->buffer, tws - 1)) == ' ' || c == '\t'))
|
||||||
@ -581,7 +581,7 @@ edit_draw_this_line (WEdit * edit, off_t b, long row, long start_col, long end_c
|
|||||||
while (col <= end_col - edit->start_col)
|
while (col <= end_col - edit->start_col)
|
||||||
{
|
{
|
||||||
int cw = 1;
|
int cw = 1;
|
||||||
int tab_over = 0;
|
unsigned int c;
|
||||||
gboolean wide_width_char = FALSE;
|
gboolean wide_width_char = FALSE;
|
||||||
gboolean control_char = FALSE;
|
gboolean control_char = FALSE;
|
||||||
|
|
||||||
@ -594,6 +594,7 @@ edit_draw_this_line (WEdit * edit, off_t b, long row, long start_col, long end_c
|
|||||||
if (edit->column_highlight)
|
if (edit->column_highlight)
|
||||||
{
|
{
|
||||||
long x;
|
long x;
|
||||||
|
long c1, c2;
|
||||||
|
|
||||||
x = (long) edit_move_forward3 (edit, b, 0, q);
|
x = (long) edit_move_forward3 (edit, b, 0, q);
|
||||||
c1 = min (edit->column1, edit->column2);
|
c1 = min (edit->column1, edit->column2);
|
||||||
@ -632,74 +633,80 @@ edit_draw_this_line (WEdit * edit, off_t b, long row, long start_col, long end_c
|
|||||||
col = end_col - edit->start_col + 1; /* quit */
|
col = end_col - edit->start_col + 1; /* quit */
|
||||||
break;
|
break;
|
||||||
case '\t':
|
case '\t':
|
||||||
i = TAB_SIZE - ((int) col % TAB_SIZE);
|
|
||||||
tab_over = (end_col - edit->start_col) - (col + i - 1);
|
|
||||||
if (tab_over < 0)
|
|
||||||
i += tab_over;
|
|
||||||
col += i;
|
|
||||||
if (tty_use_colors () &&
|
|
||||||
((visible_tabs || (visible_tws && q >= tws)) && enable_show_tabs_tws))
|
|
||||||
{
|
{
|
||||||
if (p->style & MOD_MARKED)
|
int tab_over;
|
||||||
c = p->style;
|
int i;
|
||||||
else if (book_mark)
|
|
||||||
c |= book_mark << 16;
|
i = TAB_SIZE - ((int) col % TAB_SIZE);
|
||||||
else
|
tab_over = (end_col - edit->start_col) - (col + i - 1);
|
||||||
c = p->style | MOD_WHITESPACE;
|
if (tab_over < 0)
|
||||||
if (i > 2)
|
i += tab_over;
|
||||||
|
col += i;
|
||||||
|
if (tty_use_colors () &&
|
||||||
|
((visible_tabs || (visible_tws && q >= tws)) && enable_show_tabs_tws))
|
||||||
{
|
{
|
||||||
p->ch = '<';
|
if (p->style & MOD_MARKED)
|
||||||
p->style = c;
|
c = p->style;
|
||||||
p++;
|
else if (book_mark)
|
||||||
while (--i > 1)
|
c |= book_mark << 16;
|
||||||
|
else
|
||||||
|
c = p->style | MOD_WHITESPACE;
|
||||||
|
if (i > 2)
|
||||||
{
|
{
|
||||||
p->ch = '-';
|
p->ch = '<';
|
||||||
|
p->style = c;
|
||||||
|
p++;
|
||||||
|
while (--i > 1)
|
||||||
|
{
|
||||||
|
p->ch = '-';
|
||||||
|
p->style = c;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
p->ch = '>';
|
||||||
|
p->style = c;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
else if (i > 1)
|
||||||
|
{
|
||||||
|
p->ch = '<';
|
||||||
|
p->style = c;
|
||||||
|
p++;
|
||||||
|
p->ch = '>';
|
||||||
|
p->style = c;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->ch = '>';
|
||||||
p->style = c;
|
p->style = c;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
p->ch = '>';
|
|
||||||
p->style = c;
|
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
else if (i > 1)
|
else if (tty_use_colors () && visible_tws && q >= tws
|
||||||
|
&& enable_show_tabs_tws)
|
||||||
{
|
{
|
||||||
p->ch = '<';
|
p->ch = '.';
|
||||||
p->style = c;
|
p->style |= MOD_WHITESPACE;
|
||||||
p++;
|
c = p->style & ~MOD_CURSOR;
|
||||||
p->ch = '>';
|
|
||||||
p->style = c;
|
|
||||||
p++;
|
p++;
|
||||||
|
while (--i)
|
||||||
|
{
|
||||||
|
p->ch = ' ';
|
||||||
|
p->style = c;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->ch = '>';
|
p->ch |= ' ';
|
||||||
p->style = c;
|
c = p->style & ~MOD_CURSOR;
|
||||||
p++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (tty_use_colors () && visible_tws && q >= tws && enable_show_tabs_tws)
|
|
||||||
{
|
|
||||||
p->ch = '.';
|
|
||||||
p->style |= MOD_WHITESPACE;
|
|
||||||
c = p->style & ~MOD_CURSOR;
|
|
||||||
p++;
|
|
||||||
while (--i)
|
|
||||||
{
|
|
||||||
p->ch = ' ';
|
|
||||||
p->style = c;
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p->ch |= ' ';
|
|
||||||
c = p->style & ~MOD_CURSOR;
|
|
||||||
p++;
|
|
||||||
while (--i)
|
|
||||||
{
|
|
||||||
p->ch = ' ';
|
|
||||||
p->style = c;
|
|
||||||
p++;
|
p++;
|
||||||
|
while (--i)
|
||||||
|
{
|
||||||
|
p->ch = ' ';
|
||||||
|
p->style = c;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -847,9 +854,7 @@ render_edit_text (WEdit * edit, long start_row, long start_column, long end_row,
|
|||||||
Widget *w = WIDGET (edit);
|
Widget *w = WIDGET (edit);
|
||||||
Widget *wh = WIDGET (w->owner);
|
Widget *wh = WIDGET (w->owner);
|
||||||
|
|
||||||
long row = 0, curs_row;
|
|
||||||
int force = edit->force;
|
int force = edit->force;
|
||||||
long b;
|
|
||||||
int y1, x1, y2, x2;
|
int y1, x1, y2, x2;
|
||||||
|
|
||||||
int last_line;
|
int last_line;
|
||||||
@ -903,6 +908,8 @@ render_edit_text (WEdit * edit, long start_row, long start_column, long end_row,
|
|||||||
*/
|
*/
|
||||||
if ((force & REDRAW_CHAR_ONLY) == 0 || (force & REDRAW_PAGE) != 0)
|
if ((force & REDRAW_CHAR_ONLY) == 0 || (force & REDRAW_PAGE) != 0)
|
||||||
{
|
{
|
||||||
|
long row, b;
|
||||||
|
|
||||||
if ((force & REDRAW_PAGE) != 0)
|
if ((force & REDRAW_PAGE) != 0)
|
||||||
{
|
{
|
||||||
row = start_row;
|
row = start_row;
|
||||||
@ -918,7 +925,7 @@ render_edit_text (WEdit * edit, long start_row, long start_column, long end_row,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
curs_row = edit->curs_row;
|
long curs_row = edit->curs_row;
|
||||||
|
|
||||||
if ((force & REDRAW_BEFORE_CURSOR) != 0 && start_row < curs_row)
|
if ((force & REDRAW_BEFORE_CURSOR) != 0 && start_row < curs_row)
|
||||||
{
|
{
|
||||||
|
@ -888,8 +888,6 @@ edit_read_syntax_rules (WEdit * edit, FILE * f, char **args, int args_size)
|
|||||||
struct context_rule **r, *c = NULL;
|
struct context_rule **r, *c = NULL;
|
||||||
int num_words = -1, num_contexts = -1;
|
int num_words = -1, num_contexts = -1;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
int argc;
|
|
||||||
int i, j;
|
|
||||||
int alloc_contexts = MAX_CONTEXTS,
|
int alloc_contexts = MAX_CONTEXTS,
|
||||||
alloc_words_per_context = MAX_WORDS_PER_CONTEXT,
|
alloc_words_per_context = MAX_WORDS_PER_CONTEXT,
|
||||||
max_alloc_words_per_context = MAX_WORDS_PER_CONTEXT;
|
max_alloc_words_per_context = MAX_WORDS_PER_CONTEXT;
|
||||||
@ -909,6 +907,7 @@ edit_read_syntax_rules (WEdit * edit, FILE * f, char **args, int args_size)
|
|||||||
{
|
{
|
||||||
char **a;
|
char **a;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
int argc;
|
||||||
|
|
||||||
line++;
|
line++;
|
||||||
l = 0;
|
l = 0;
|
||||||
@ -1200,7 +1199,8 @@ edit_read_syntax_rules (WEdit * edit, FILE * f, char **args, int args_size)
|
|||||||
|
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
char *first_chars, *p;
|
int i;
|
||||||
|
char *first_chars;
|
||||||
|
|
||||||
if (num_contexts == -1)
|
if (num_contexts == -1)
|
||||||
return line;
|
return line;
|
||||||
@ -1209,6 +1209,9 @@ edit_read_syntax_rules (WEdit * edit, FILE * f, char **args, int args_size)
|
|||||||
|
|
||||||
for (i = 0; edit->rules[i] != NULL; i++)
|
for (i = 0; edit->rules[i] != NULL; i++)
|
||||||
{
|
{
|
||||||
|
char *p;
|
||||||
|
int j;
|
||||||
|
|
||||||
c = edit->rules[i];
|
c = edit->rules[i];
|
||||||
p = first_chars;
|
p = first_chars;
|
||||||
*p++ = (char) 1;
|
*p++ = (char) 1;
|
||||||
|
@ -450,7 +450,6 @@ toggle_panels (void)
|
|||||||
{
|
{
|
||||||
#ifdef ENABLE_SUBSHELL
|
#ifdef ENABLE_SUBSHELL
|
||||||
vfs_path_t *new_dir_vpath = NULL;
|
vfs_path_t *new_dir_vpath = NULL;
|
||||||
vfs_path_t **new_dir_p;
|
|
||||||
#endif /* ENABLE_SUBSHELL */
|
#endif /* ENABLE_SUBSHELL */
|
||||||
|
|
||||||
SIG_ATOMIC_VOLATILE_T was_sigwinch = 0;
|
SIG_ATOMIC_VOLATILE_T was_sigwinch = 0;
|
||||||
@ -479,6 +478,8 @@ toggle_panels (void)
|
|||||||
#ifdef ENABLE_SUBSHELL
|
#ifdef ENABLE_SUBSHELL
|
||||||
if (mc_global.tty.use_subshell)
|
if (mc_global.tty.use_subshell)
|
||||||
{
|
{
|
||||||
|
vfs_path_t **new_dir_p;
|
||||||
|
|
||||||
new_dir_p = vfs_current_is_local ()? &new_dir_vpath : NULL;
|
new_dir_p = vfs_current_is_local ()? &new_dir_vpath : NULL;
|
||||||
invoke_subshell (NULL, VISIBLY, new_dir_p);
|
invoke_subshell (NULL, VISIBLY, new_dir_p);
|
||||||
}
|
}
|
||||||
|
@ -316,18 +316,19 @@ chl_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *dat
|
|||||||
static void
|
static void
|
||||||
do_enter_key (WDialog * h, int f_pos)
|
do_enter_key (WDialog * h, int f_pos)
|
||||||
{
|
{
|
||||||
WDialog *chl_dlg;
|
|
||||||
WListbox *chl_list;
|
WListbox *chl_list;
|
||||||
struct passwd *chl_pass;
|
struct passwd *chl_pass;
|
||||||
struct group *chl_grp;
|
struct group *chl_grp;
|
||||||
int fe;
|
int fe;
|
||||||
int lxx, lyy, b_pos;
|
|
||||||
gboolean chl_end, is_owner;
|
gboolean chl_end, is_owner;
|
||||||
const char *title;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
int result;
|
||||||
|
WDialog *chl_dlg;
|
||||||
|
const char *title;
|
||||||
|
int lxx, lyy, b_pos;
|
||||||
|
|
||||||
is_owner = (f_pos == 3);
|
is_owner = (f_pos == 3);
|
||||||
title = is_owner ? _("owner") : _("group");
|
title = is_owner ? _("owner") : _("group");
|
||||||
|
|
||||||
|
@ -520,18 +520,17 @@ configure_box (void)
|
|||||||
void
|
void
|
||||||
panel_options_box (void)
|
panel_options_box (void)
|
||||||
{
|
{
|
||||||
const char *qsearch_options[] = {
|
|
||||||
N_("Case &insensitive"),
|
|
||||||
N_("Cas&e sensitive"),
|
|
||||||
N_("Use panel sort mo&de")
|
|
||||||
};
|
|
||||||
|
|
||||||
int simple_swap;
|
int simple_swap;
|
||||||
|
|
||||||
simple_swap = mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,
|
simple_swap = mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,
|
||||||
"simple_swap", FALSE) ? 1 : 0;
|
"simple_swap", FALSE) ? 1 : 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
const char *qsearch_options[] = {
|
||||||
|
N_("Case &insensitive"),
|
||||||
|
N_("Cas&e sensitive"),
|
||||||
|
N_("Use panel sort mo&de")
|
||||||
|
};
|
||||||
|
|
||||||
quick_widget_t quick_widgets[] = {
|
quick_widget_t quick_widgets[] = {
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
QUICK_START_COLUMNS,
|
QUICK_START_COLUMNS,
|
||||||
|
@ -332,7 +332,6 @@ chown_cmd (void)
|
|||||||
{
|
{
|
||||||
char *fname;
|
char *fname;
|
||||||
struct stat sf_stat;
|
struct stat sf_stat;
|
||||||
WDialog *ch_dlg;
|
|
||||||
uid_t new_user;
|
uid_t new_user;
|
||||||
gid_t new_group;
|
gid_t new_group;
|
||||||
char buffer[BUF_TINY];
|
char buffer[BUF_TINY];
|
||||||
@ -342,6 +341,7 @@ chown_cmd (void)
|
|||||||
do
|
do
|
||||||
{ /* do while any files remaining */
|
{ /* do while any files remaining */
|
||||||
vfs_path_t *vpath;
|
vfs_path_t *vpath;
|
||||||
|
WDialog *ch_dlg;
|
||||||
|
|
||||||
ch_dlg = init_chown ();
|
ch_dlg = init_chown ();
|
||||||
new_user = new_group = -1;
|
new_user = new_group = -1;
|
||||||
|
@ -294,7 +294,7 @@ select_unselect_cmd (const char *title, const char *history_name, gboolean do_se
|
|||||||
static int
|
static int
|
||||||
compare_files (const vfs_path_t * vpath1, const vfs_path_t * vpath2, off_t size)
|
compare_files (const vfs_path_t * vpath1, const vfs_path_t * vpath2, off_t size)
|
||||||
{
|
{
|
||||||
int file1, file2;
|
int file1;
|
||||||
int result = -1; /* Different by default */
|
int result = -1; /* Different by default */
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
@ -303,15 +303,20 @@ compare_files (const vfs_path_t * vpath1, const vfs_path_t * vpath2, off_t size)
|
|||||||
file1 = open (vfs_path_as_str (vpath1), O_RDONLY);
|
file1 = open (vfs_path_as_str (vpath1), O_RDONLY);
|
||||||
if (file1 >= 0)
|
if (file1 >= 0)
|
||||||
{
|
{
|
||||||
|
int file2;
|
||||||
|
|
||||||
file2 = open (vfs_path_as_str (vpath2), O_RDONLY);
|
file2 = open (vfs_path_as_str (vpath2), O_RDONLY);
|
||||||
if (file2 >= 0)
|
if (file2 >= 0)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
char *data1, *data2;
|
char *data1;
|
||||||
|
|
||||||
/* Ugly if jungle */
|
/* Ugly if jungle */
|
||||||
data1 = mmap (0, size, PROT_READ, MAP_FILE | MAP_PRIVATE, file1, 0);
|
data1 = mmap (0, size, PROT_READ, MAP_FILE | MAP_PRIVATE, file1, 0);
|
||||||
if (data1 != (char *) -1)
|
if (data1 != (char *) -1)
|
||||||
{
|
{
|
||||||
|
char *data2;
|
||||||
|
|
||||||
data2 = mmap (0, size, PROT_READ, MAP_FILE | MAP_PRIVATE, file2, 0);
|
data2 = mmap (0, size, PROT_READ, MAP_FILE | MAP_PRIVATE, file2, 0);
|
||||||
if (data2 != (char *) -1)
|
if (data2 != (char *) -1)
|
||||||
{
|
{
|
||||||
@ -619,7 +624,6 @@ set_basic_panel_listing_to (int panel_index, int listing_mode)
|
|||||||
gboolean
|
gboolean
|
||||||
view_file_at_line (const vfs_path_t * filename_vpath, int plain_view, int internal, long start_line)
|
view_file_at_line (const vfs_path_t * filename_vpath, int plain_view, int internal, long start_line)
|
||||||
{
|
{
|
||||||
static const char *viewer = NULL;
|
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
if (plain_view)
|
if (plain_view)
|
||||||
@ -670,6 +674,8 @@ view_file_at_line (const vfs_path_t * filename_vpath, int plain_view, int intern
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
static const char *viewer = NULL;
|
||||||
|
|
||||||
if (viewer == NULL)
|
if (viewer == NULL)
|
||||||
{
|
{
|
||||||
viewer = getenv ("VIEWER");
|
viewer = getenv ("VIEWER");
|
||||||
@ -784,7 +790,6 @@ view_filtered_cmd (void)
|
|||||||
void
|
void
|
||||||
do_edit_at_line (const vfs_path_t * what_vpath, gboolean internal, long start_line)
|
do_edit_at_line (const vfs_path_t * what_vpath, gboolean internal, long start_line)
|
||||||
{
|
{
|
||||||
static const char *editor = NULL;
|
|
||||||
|
|
||||||
#ifdef USE_INTERNAL_EDIT
|
#ifdef USE_INTERNAL_EDIT
|
||||||
if (internal)
|
if (internal)
|
||||||
@ -792,6 +797,8 @@ do_edit_at_line (const vfs_path_t * what_vpath, gboolean internal, long start_li
|
|||||||
else
|
else
|
||||||
#endif /* USE_INTERNAL_EDIT */
|
#endif /* USE_INTERNAL_EDIT */
|
||||||
{
|
{
|
||||||
|
static const char *editor = NULL;
|
||||||
|
|
||||||
(void) internal;
|
(void) internal;
|
||||||
|
|
||||||
if (editor == NULL)
|
if (editor == NULL)
|
||||||
@ -1056,11 +1063,11 @@ void
|
|||||||
select_invert_cmd (void)
|
select_invert_cmd (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
file_entry_t *file;
|
|
||||||
|
|
||||||
for (i = 0; i < current_panel->dir.len; i++)
|
for (i = 0; i < current_panel->dir.len; i++)
|
||||||
{
|
{
|
||||||
file = ¤t_panel->dir.list[i];
|
file_entry_t *file = ¤t_panel->dir.list[i];
|
||||||
|
|
||||||
if (!panels_options.reverse_files_only || !S_ISDIR (file->st.st_mode))
|
if (!panels_options.reverse_files_only || !S_ISDIR (file->st.st_mode))
|
||||||
do_file_mark (current_panel, i, !file->f.marked);
|
do_file_mark (current_panel, i, !file->f.marked);
|
||||||
}
|
}
|
||||||
@ -1087,7 +1094,6 @@ unselect_cmd (void)
|
|||||||
void
|
void
|
||||||
ext_cmd (void)
|
ext_cmd (void)
|
||||||
{
|
{
|
||||||
vfs_path_t *buffer_vpath;
|
|
||||||
vfs_path_t *extdir_vpath;
|
vfs_path_t *extdir_vpath;
|
||||||
int dir;
|
int dir;
|
||||||
|
|
||||||
@ -1102,6 +1108,8 @@ ext_cmd (void)
|
|||||||
|
|
||||||
if (dir == 0)
|
if (dir == 0)
|
||||||
{
|
{
|
||||||
|
vfs_path_t *buffer_vpath;
|
||||||
|
|
||||||
buffer_vpath = mc_config_get_full_vpath (MC_FILEBIND_FILE);
|
buffer_vpath = mc_config_get_full_vpath (MC_FILEBIND_FILE);
|
||||||
check_for_default (extdir_vpath, buffer_vpath);
|
check_for_default (extdir_vpath, buffer_vpath);
|
||||||
do_edit (buffer_vpath);
|
do_edit (buffer_vpath);
|
||||||
@ -1180,7 +1188,6 @@ edit_mc_menu_cmd (void)
|
|||||||
void
|
void
|
||||||
edit_fhl_cmd (void)
|
edit_fhl_cmd (void)
|
||||||
{
|
{
|
||||||
vfs_path_t *buffer_vpath = NULL;
|
|
||||||
vfs_path_t *fhlfile_vpath = NULL;
|
vfs_path_t *fhlfile_vpath = NULL;
|
||||||
|
|
||||||
int dir;
|
int dir;
|
||||||
@ -1196,6 +1203,8 @@ edit_fhl_cmd (void)
|
|||||||
|
|
||||||
if (dir == 0)
|
if (dir == 0)
|
||||||
{
|
{
|
||||||
|
vfs_path_t *buffer_vpath;
|
||||||
|
|
||||||
buffer_vpath = mc_config_get_full_vpath (MC_FHL_INI_FILE);
|
buffer_vpath = mc_config_get_full_vpath (MC_FHL_INI_FILE);
|
||||||
check_for_default (fhlfile_vpath, buffer_vpath);
|
check_for_default (fhlfile_vpath, buffer_vpath);
|
||||||
do_edit (buffer_vpath);
|
do_edit (buffer_vpath);
|
||||||
@ -1369,7 +1378,7 @@ edit_symlink_cmd (void)
|
|||||||
char buffer[MC_MAXPATHLEN];
|
char buffer[MC_MAXPATHLEN];
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
int i;
|
int i;
|
||||||
char *dest, *q;
|
char *q;
|
||||||
vfs_path_t *p_vpath;
|
vfs_path_t *p_vpath;
|
||||||
|
|
||||||
p = selection (current_panel)->fname;
|
p = selection (current_panel)->fname;
|
||||||
@ -1380,6 +1389,8 @@ edit_symlink_cmd (void)
|
|||||||
i = readlink (p, buffer, MC_MAXPATHLEN - 1);
|
i = readlink (p, buffer, MC_MAXPATHLEN - 1);
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
|
char *dest;
|
||||||
|
|
||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
dest =
|
dest =
|
||||||
input_expand_dialog (_("Edit symlink"), q, MC_HISTORY_FM_EDIT_LINK, buffer,
|
input_expand_dialog (_("Edit symlink"), q, MC_HISTORY_FM_EDIT_LINK, buffer,
|
||||||
|
@ -386,12 +386,13 @@ sort_vers (file_entry_t * a, file_entry_t * b)
|
|||||||
int
|
int
|
||||||
sort_ext (file_entry_t * a, file_entry_t * b)
|
sort_ext (file_entry_t * a, file_entry_t * b)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
int ad = MY_ISDIR (a);
|
int ad = MY_ISDIR (a);
|
||||||
int bd = MY_ISDIR (b);
|
int bd = MY_ISDIR (b);
|
||||||
|
|
||||||
if (ad == bd || panels_options.mix_all_files)
|
if (ad == bd || panels_options.mix_all_files)
|
||||||
{
|
{
|
||||||
|
int r;
|
||||||
|
|
||||||
if (a->second_sort_key == NULL)
|
if (a->second_sort_key == NULL)
|
||||||
a->second_sort_key = str_create_key (extension (a->fname), case_sensitive);
|
a->second_sort_key = str_create_key (extension (a->fname), case_sensitive);
|
||||||
if (b->second_sort_key == NULL)
|
if (b->second_sort_key == NULL)
|
||||||
|
@ -625,9 +625,6 @@ regex_check_type (const vfs_path_t * filename_vpath, const char *ptr, gboolean c
|
|||||||
|
|
||||||
/* Following variables are valid if *have_type is TRUE */
|
/* Following variables are valid if *have_type is TRUE */
|
||||||
static char content_string[2048];
|
static char content_string[2048];
|
||||||
#ifdef HAVE_CHARSET
|
|
||||||
static char encoding_id[21]; /* CSISO51INISCYRILLIC -- 20 */
|
|
||||||
#endif
|
|
||||||
static size_t content_shift = 0;
|
static size_t content_shift = 0;
|
||||||
static int got_data = 0;
|
static int got_data = 0;
|
||||||
|
|
||||||
@ -640,6 +637,7 @@ regex_check_type (const vfs_path_t * filename_vpath, const char *ptr, gboolean c
|
|||||||
const char *realname; /* name used with "file" */
|
const char *realname; /* name used with "file" */
|
||||||
|
|
||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
|
static char encoding_id[21]; /* CSISO51INISCYRILLIC -- 20 */
|
||||||
int got_encoding_data;
|
int got_encoding_data;
|
||||||
#endif /* HAVE_CHARSET */
|
#endif /* HAVE_CHARSET */
|
||||||
|
|
||||||
|
@ -401,13 +401,13 @@ make_symlink (FileOpContext * ctx, const char *src_path, const char *dst_path)
|
|||||||
|
|
||||||
if (ctx->stable_symlinks && !g_path_is_absolute (link_target))
|
if (ctx->stable_symlinks && !g_path_is_absolute (link_target))
|
||||||
{
|
{
|
||||||
char *p, *s;
|
|
||||||
vfs_path_t *q;
|
|
||||||
|
|
||||||
const char *r = strrchr (src_path, PATH_SEP);
|
const char *r = strrchr (src_path, PATH_SEP);
|
||||||
|
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
|
char *p;
|
||||||
|
vfs_path_t *q;
|
||||||
|
|
||||||
p = g_strndup (src_path, r - src_path + 1);
|
p = g_strndup (src_path, r - src_path + 1);
|
||||||
if (g_path_is_absolute (dst_path))
|
if (g_path_is_absolute (dst_path))
|
||||||
q = vfs_path_from_str_flags (dst_path, VPF_NO_CANON);
|
q = vfs_path_from_str_flags (dst_path, VPF_NO_CANON);
|
||||||
@ -416,6 +416,7 @@ make_symlink (FileOpContext * ctx, const char *src_path, const char *dst_path)
|
|||||||
|
|
||||||
if (vfs_path_tokens_count (q) > 1)
|
if (vfs_path_tokens_count (q) > 1)
|
||||||
{
|
{
|
||||||
|
char *s;
|
||||||
vfs_path_t *tmp_vpath1, *tmp_vpath2;
|
vfs_path_t *tmp_vpath1, *tmp_vpath2;
|
||||||
|
|
||||||
tmp_vpath1 = vfs_path_vtokens_get (q, -1, 1);
|
tmp_vpath1 = vfs_path_vtokens_get (q, -1, 1);
|
||||||
@ -1026,7 +1027,6 @@ move_file_file (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, c
|
|||||||
static FileProgressStatus
|
static FileProgressStatus
|
||||||
erase_file (FileOpTotalContext * tctx, FileOpContext * ctx, const vfs_path_t * vpath)
|
erase_file (FileOpTotalContext * tctx, FileOpContext * ctx, const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
int return_status;
|
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
file_progress_show_deleting (ctx, vfs_path_as_str (vpath), &tctx->progress_count);
|
file_progress_show_deleting (ctx, vfs_path_as_str (vpath), &tctx->progress_count);
|
||||||
@ -1044,6 +1044,8 @@ erase_file (FileOpTotalContext * tctx, FileOpContext * ctx, const vfs_path_t * v
|
|||||||
|
|
||||||
while (mc_unlink (vpath) != 0 && !ctx->skip_all)
|
while (mc_unlink (vpath) != 0 && !ctx->skip_all)
|
||||||
{
|
{
|
||||||
|
int return_status;
|
||||||
|
|
||||||
return_status = file_error (_("Cannot delete file \"%s\"\n%s"), vfs_path_as_str (vpath));
|
return_status = file_error (_("Cannot delete file \"%s\"\n%s"), vfs_path_as_str (vpath));
|
||||||
if (return_status == FILE_ABORT)
|
if (return_status == FILE_ABORT)
|
||||||
return return_status;
|
return return_status;
|
||||||
|
@ -879,8 +879,6 @@ file_progress_show (FileOpContext * ctx, off_t done, off_t total,
|
|||||||
{
|
{
|
||||||
FileOpContextUI *ui;
|
FileOpContextUI *ui;
|
||||||
char buffer[BUF_TINY];
|
char buffer[BUF_TINY];
|
||||||
char buffer2[BUF_TINY];
|
|
||||||
char buffer3[BUF_TINY];
|
|
||||||
|
|
||||||
if (!verbose || ctx == NULL || ctx->ui == NULL)
|
if (!verbose || ctx == NULL || ctx->ui == NULL)
|
||||||
return;
|
return;
|
||||||
@ -901,11 +899,15 @@ file_progress_show (FileOpContext * ctx, off_t done, off_t total,
|
|||||||
|
|
||||||
if (ui->showing_eta && ctx->eta_secs > 0.5)
|
if (ui->showing_eta && ctx->eta_secs > 0.5)
|
||||||
{
|
{
|
||||||
|
char buffer2[BUF_TINY];
|
||||||
|
|
||||||
file_eta_prepare_for_show (buffer2, ctx->eta_secs, FALSE);
|
file_eta_prepare_for_show (buffer2, ctx->eta_secs, FALSE);
|
||||||
if (ctx->bps == 0)
|
if (ctx->bps == 0)
|
||||||
g_snprintf (buffer, BUF_TINY, "%s %s", buffer2, stalled_msg);
|
g_snprintf (buffer, BUF_TINY, "%s %s", buffer2, stalled_msg);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char buffer3[BUF_TINY];
|
||||||
|
|
||||||
file_bps_prepare_for_show (buffer3, ctx->bps);
|
file_bps_prepare_for_show (buffer3, ctx->bps);
|
||||||
g_snprintf (buffer, BUF_TINY, "%s (%s) %s", buffer2, buffer3, stalled_msg);
|
g_snprintf (buffer, BUF_TINY, "%s (%s) %s", buffer2, buffer3, stalled_msg);
|
||||||
}
|
}
|
||||||
|
@ -1810,10 +1810,11 @@ find_file (void)
|
|||||||
char *start_dir = NULL, *pattern = NULL, *content = NULL, *ignore_dirs = NULL;
|
char *start_dir = NULL, *pattern = NULL, *content = NULL, *ignore_dirs = NULL;
|
||||||
ssize_t start_dir_len;
|
ssize_t start_dir_len;
|
||||||
char *filename = NULL, *dirname = NULL;
|
char *filename = NULL, *dirname = NULL;
|
||||||
int v;
|
|
||||||
|
|
||||||
while (find_parameters (&start_dir, &start_dir_len, &ignore_dirs, &pattern, &content))
|
while (find_parameters (&start_dir, &start_dir_len, &ignore_dirs, &pattern, &content))
|
||||||
{
|
{
|
||||||
|
int v;
|
||||||
|
|
||||||
if (pattern[0] == '\0')
|
if (pattern[0] == '\0')
|
||||||
break; /* nothing search */
|
break; /* nothing search */
|
||||||
|
|
||||||
|
@ -1393,7 +1393,6 @@ static void
|
|||||||
clean_up_hotlist_groups (const char *section)
|
clean_up_hotlist_groups (const char *section)
|
||||||
{
|
{
|
||||||
char *grp_section;
|
char *grp_section;
|
||||||
gchar **profile_keys, **keys;
|
|
||||||
gsize len;
|
gsize len;
|
||||||
|
|
||||||
grp_section = g_strconcat (section, ".Group", (char *) NULL);
|
grp_section = g_strconcat (section, ".Group", (char *) NULL);
|
||||||
@ -1402,6 +1401,8 @@ clean_up_hotlist_groups (const char *section)
|
|||||||
|
|
||||||
if (mc_config_has_group (mc_main_config, grp_section))
|
if (mc_config_has_group (mc_main_config, grp_section))
|
||||||
{
|
{
|
||||||
|
char **profile_keys, **keys;
|
||||||
|
|
||||||
profile_keys = keys = mc_config_get_keys (mc_main_config, grp_section, &len);
|
profile_keys = keys = mc_config_get_keys (mc_main_config, grp_section, &len);
|
||||||
|
|
||||||
while (*profile_keys != NULL)
|
while (*profile_keys != NULL)
|
||||||
|
@ -877,8 +877,6 @@ set_hintbar (const char *str)
|
|||||||
void
|
void
|
||||||
rotate_dash (gboolean show)
|
rotate_dash (gboolean show)
|
||||||
{
|
{
|
||||||
static const char rotating_dash[4] = "|/-\\";
|
|
||||||
static size_t pos = 0;
|
|
||||||
Widget *w = WIDGET (midnight_dlg);
|
Widget *w = WIDGET (midnight_dlg);
|
||||||
|
|
||||||
if (!nice_rotating_dash || (ok_to_refresh <= 0))
|
if (!nice_rotating_dash || (ok_to_refresh <= 0))
|
||||||
@ -891,6 +889,9 @@ rotate_dash (gboolean show)
|
|||||||
tty_print_alt_char (ACS_URCORNER, FALSE);
|
tty_print_alt_char (ACS_URCORNER, FALSE);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
static const char rotating_dash[4] = "|/-\\";
|
||||||
|
static size_t pos = 0;
|
||||||
|
|
||||||
tty_print_char (rotating_dash[pos]);
|
tty_print_char (rotating_dash[pos]);
|
||||||
pos = (pos + 1) % sizeof (rotating_dash);
|
pos = (pos + 1) % sizeof (rotating_dash);
|
||||||
}
|
}
|
||||||
@ -903,14 +904,14 @@ rotate_dash (gboolean show)
|
|||||||
const char *
|
const char *
|
||||||
get_nth_panel_name (int num)
|
get_nth_panel_name (int num)
|
||||||
{
|
{
|
||||||
static char buffer[BUF_SMALL];
|
|
||||||
|
|
||||||
if (!num)
|
if (!num)
|
||||||
return "New Left Panel";
|
return "New Left Panel";
|
||||||
else if (num == 1)
|
else if (num == 1)
|
||||||
return "New Right Panel";
|
return "New Right Panel";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
static char buffer[BUF_SMALL];
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), "%ith Panel", num);
|
g_snprintf (buffer, sizeof (buffer), "%ith Panel", num);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
@ -814,13 +814,13 @@ put_prog_name (void)
|
|||||||
static void
|
static void
|
||||||
put_tagged (WPanel * panel)
|
put_tagged (WPanel * panel)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!command_prompt)
|
if (!command_prompt)
|
||||||
return;
|
return;
|
||||||
input_disable_update (cmdline);
|
input_disable_update (cmdline);
|
||||||
if (panel->marked)
|
if (panel->marked)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < panel->dir.len; i++)
|
for (i = 0; i < panel->dir.len; i++)
|
||||||
{
|
{
|
||||||
if (panel->dir.list[i].f.marked)
|
if (panel->dir.list[i].f.marked)
|
||||||
|
@ -621,7 +621,6 @@ read_file_system_list (int need_fs_type)
|
|||||||
#ifdef MOUNTED_LISTMNTENT
|
#ifdef MOUNTED_LISTMNTENT
|
||||||
{
|
{
|
||||||
struct tabmntent *mntlist, *p;
|
struct tabmntent *mntlist, *p;
|
||||||
struct mntent *mnt;
|
|
||||||
struct mount_entry *me;
|
struct mount_entry *me;
|
||||||
|
|
||||||
/* the third and fourth arguments could be used to filter mounts,
|
/* the third and fourth arguments could be used to filter mounts,
|
||||||
@ -633,7 +632,8 @@ read_file_system_list (int need_fs_type)
|
|||||||
return NULL;
|
return NULL;
|
||||||
for (p = mntlist; p; p = p->next)
|
for (p = mntlist; p; p = p->next)
|
||||||
{
|
{
|
||||||
mnt = p->ment;
|
struct mntent *mnt = p->ment;
|
||||||
|
|
||||||
me = g_malloc (sizeof (*me));
|
me = g_malloc (sizeof (*me));
|
||||||
me->me_devname = g_strdup (mnt->mnt_fsname);
|
me->me_devname = g_strdup (mnt->mnt_fsname);
|
||||||
me->me_mountdir = g_strdup (mnt->mnt_dir);
|
me->me_mountdir = g_strdup (mnt->mnt_dir);
|
||||||
@ -1590,13 +1590,15 @@ void
|
|||||||
my_statfs (struct my_statfs *myfs_stats, const char *path)
|
my_statfs (struct my_statfs *myfs_stats, const char *path)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_INFOMOUNT_LIST
|
#ifdef HAVE_INFOMOUNT_LIST
|
||||||
size_t i, len = 0;
|
size_t len = 0;
|
||||||
struct mount_entry *entry = NULL;
|
struct mount_entry *entry = NULL;
|
||||||
struct mount_entry *temp = mc_mount_list;
|
struct mount_entry *temp = mc_mount_list;
|
||||||
struct fs_usage fs_use;
|
struct fs_usage fs_use;
|
||||||
|
|
||||||
while (temp)
|
while (temp)
|
||||||
{
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
i = strlen (temp->me_mountdir);
|
i = strlen (temp->me_mountdir);
|
||||||
if (i > len && (strncmp (path, temp->me_mountdir, i) == 0))
|
if (i > len && (strncmp (path, temp->me_mountdir, i) == 0))
|
||||||
if (!entry || (path[i] == PATH_SEP || path[i] == '\0'))
|
if (!entry || (path[i] == PATH_SEP || path[i] == '\0'))
|
||||||
|
@ -1548,7 +1548,6 @@ paint_frame (WPanel * panel)
|
|||||||
Widget *w = WIDGET (panel);
|
Widget *w = WIDGET (panel);
|
||||||
|
|
||||||
int side, width;
|
int side, width;
|
||||||
GString *format_txt;
|
|
||||||
|
|
||||||
adjust_top_file (panel);
|
adjust_top_file (panel);
|
||||||
|
|
||||||
@ -1559,6 +1558,7 @@ paint_frame (WPanel * panel)
|
|||||||
|
|
||||||
for (side = 0; side <= panel->split; side++)
|
for (side = 0; side <= panel->split; side++)
|
||||||
{
|
{
|
||||||
|
GString *format_txt;
|
||||||
format_e *format;
|
format_e *format;
|
||||||
|
|
||||||
if (side)
|
if (side)
|
||||||
@ -1826,7 +1826,6 @@ use_display_format (WPanel * panel, const char *format, char **error, int isstat
|
|||||||
int expand_top = 0; /* Max used element in expand */
|
int expand_top = 0; /* Max used element in expand */
|
||||||
int usable_columns; /* Usable columns in the panel */
|
int usable_columns; /* Usable columns in the panel */
|
||||||
int total_cols = 0;
|
int total_cols = 0;
|
||||||
int i;
|
|
||||||
format_e *darr, *home;
|
format_e *darr, *home;
|
||||||
|
|
||||||
if (!format)
|
if (!format)
|
||||||
@ -1856,11 +1855,12 @@ use_display_format (WPanel * panel, const char *format, char **error, int isstat
|
|||||||
/* If we used more columns than the available columns, adjust that */
|
/* If we used more columns than the available columns, adjust that */
|
||||||
if (total_cols > usable_columns)
|
if (total_cols > usable_columns)
|
||||||
{
|
{
|
||||||
int pdif, dif = total_cols - usable_columns;
|
int dif = total_cols - usable_columns;
|
||||||
|
|
||||||
while (dif)
|
while (dif)
|
||||||
{
|
{
|
||||||
pdif = dif;
|
int pdif = dif;
|
||||||
|
|
||||||
for (darr = home; darr; darr = darr->next)
|
for (darr = home; darr; darr = darr->next)
|
||||||
{
|
{
|
||||||
if (dif && darr->field_len - 1)
|
if (dif && darr->field_len - 1)
|
||||||
@ -1880,6 +1880,7 @@ use_display_format (WPanel * panel, const char *format, char **error, int isstat
|
|||||||
/* Expand the available space */
|
/* Expand the available space */
|
||||||
if ((usable_columns > total_cols) && expand_top)
|
if ((usable_columns > total_cols) && expand_top)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
int spaces = (usable_columns - total_cols) / expand_top;
|
int spaces = (usable_columns - total_cols) / expand_top;
|
||||||
int extra = (usable_columns - total_cols) % expand_top;
|
int extra = (usable_columns - total_cols) % expand_top;
|
||||||
|
|
||||||
@ -2699,7 +2700,7 @@ static void
|
|||||||
chdir_to_readlink (WPanel * panel)
|
chdir_to_readlink (WPanel * panel)
|
||||||
{
|
{
|
||||||
vfs_path_t *new_dir_vpath;
|
vfs_path_t *new_dir_vpath;
|
||||||
char buffer[MC_MAXPATHLEN], *p;
|
char buffer[MC_MAXPATHLEN];
|
||||||
int i;
|
int i;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
vfs_path_t *panel_fname_vpath;
|
vfs_path_t *panel_fname_vpath;
|
||||||
@ -2724,6 +2725,8 @@ chdir_to_readlink (WPanel * panel)
|
|||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
if (!S_ISDIR (st.st_mode))
|
if (!S_ISDIR (st.st_mode))
|
||||||
{
|
{
|
||||||
|
char *p;
|
||||||
|
|
||||||
p = strrchr (buffer, PATH_SEP);
|
p = strrchr (buffer, PATH_SEP);
|
||||||
if (p && !p[1])
|
if (p && !p[1])
|
||||||
{
|
{
|
||||||
@ -3529,7 +3532,6 @@ mouse_sort_col (WPanel * panel, int x)
|
|||||||
const char *lc_sort_name = NULL;
|
const char *lc_sort_name = NULL;
|
||||||
panel_field_t *col_sort_format = NULL;
|
panel_field_t *col_sort_format = NULL;
|
||||||
format_e *format;
|
format_e *format;
|
||||||
gchar *title;
|
|
||||||
|
|
||||||
for (i = 0, format = panel->format; format != NULL; format = format->next)
|
for (i = 0, format = panel->format; format != NULL; format = format->next)
|
||||||
{
|
{
|
||||||
@ -3547,6 +3549,8 @@ mouse_sort_col (WPanel * panel, int x)
|
|||||||
|
|
||||||
for (i = 0; panel_fields[i].id != NULL; i++)
|
for (i = 0; panel_fields[i].id != NULL; i++)
|
||||||
{
|
{
|
||||||
|
char *title;
|
||||||
|
|
||||||
title = panel_get_title_without_hotkey (panel_fields[i].title_hotkey);
|
title = panel_get_title_without_hotkey (panel_fields[i].title_hotkey);
|
||||||
if (!strcmp (lc_sort_name, title) && panel_fields[i].sort_routine)
|
if (!strcmp (lc_sort_name, title) && panel_fields[i].sort_routine)
|
||||||
{
|
{
|
||||||
|
@ -172,14 +172,14 @@ static void
|
|||||||
save_tree (WTree * tree)
|
save_tree (WTree * tree)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
char *tree_name;
|
|
||||||
|
|
||||||
(void) tree;
|
(void) tree;
|
||||||
error = tree_store_save ();
|
error = tree_store_save ();
|
||||||
|
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
|
char *tree_name;
|
||||||
|
|
||||||
tree_name = mc_config_get_full_path (MC_TREESTORE_FILE);
|
tree_name = mc_config_get_full_path (MC_TREESTORE_FILE);
|
||||||
fprintf (stderr, _("Cannot open the %s file for writing:\n%s\n"), tree_name,
|
fprintf (stderr, _("Cannot open the %s file for writing:\n%s\n"), tree_name,
|
||||||
unix_error_string (error));
|
unix_error_string (error));
|
||||||
|
@ -207,9 +207,7 @@ static int
|
|||||||
tree_store_load_from (char *name)
|
tree_store_load_from (char *name)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char buffer[MC_MAXPATHLEN + 20], oldname[MC_MAXPATHLEN];
|
char buffer[MC_MAXPATHLEN + 20];
|
||||||
char *different;
|
|
||||||
int common;
|
|
||||||
int do_load;
|
int do_load;
|
||||||
|
|
||||||
g_return_val_if_fail (name != NULL, FALSE);
|
g_return_val_if_fail (name != NULL, FALSE);
|
||||||
@ -239,6 +237,8 @@ tree_store_load_from (char *name)
|
|||||||
|
|
||||||
if (do_load)
|
if (do_load)
|
||||||
{
|
{
|
||||||
|
char oldname[MC_MAXPATHLEN];
|
||||||
|
|
||||||
ts.loaded = TRUE;
|
ts.loaded = TRUE;
|
||||||
|
|
||||||
/* File open -> read contents */
|
/* File open -> read contents */
|
||||||
@ -264,8 +264,11 @@ tree_store_load_from (char *name)
|
|||||||
/* Clear-text decompression */
|
/* Clear-text decompression */
|
||||||
char *s = strtok (lc_name, " ");
|
char *s = strtok (lc_name, " ");
|
||||||
|
|
||||||
if (s)
|
if (s != NULL)
|
||||||
{
|
{
|
||||||
|
char *different;
|
||||||
|
int common;
|
||||||
|
|
||||||
common = atoi (s);
|
common = atoi (s);
|
||||||
different = strtok (NULL, "");
|
different = strtok (NULL, "");
|
||||||
if (different)
|
if (different)
|
||||||
@ -344,10 +347,10 @@ tree_store_save_to (char *name)
|
|||||||
current = ts.tree_first;
|
current = ts.tree_first;
|
||||||
while (current)
|
while (current)
|
||||||
{
|
{
|
||||||
int i, common;
|
|
||||||
|
|
||||||
if (vfs_file_is_local (current->name))
|
if (vfs_file_is_local (current->name))
|
||||||
{
|
{
|
||||||
|
int i, common;
|
||||||
|
|
||||||
/* Clear-text compression */
|
/* Clear-text compression */
|
||||||
if (current->prev && (common = str_common (current->prev->name, current->name)) > 2)
|
if (current->prev && (common = str_common (current->prev->name, current->name)) > 2)
|
||||||
{
|
{
|
||||||
@ -482,11 +485,11 @@ static void
|
|||||||
tree_store_notify_remove (tree_entry * entry)
|
tree_store_notify_remove (tree_entry * entry)
|
||||||
{
|
{
|
||||||
hook_t *p = remove_entry_hooks;
|
hook_t *p = remove_entry_hooks;
|
||||||
tree_store_remove_fn r;
|
|
||||||
|
|
||||||
while (p != NULL)
|
while (p != NULL)
|
||||||
{
|
{
|
||||||
r = (tree_store_remove_fn) p->hook_fn;
|
tree_store_remove_fn r = (tree_store_remove_fn) p->hook_fn;
|
||||||
|
|
||||||
r (entry, p->hook_data);
|
r (entry, p->hook_data);
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
@ -689,7 +692,7 @@ tree_store_remove_entry_remove_hook (tree_store_remove_fn callback)
|
|||||||
void
|
void
|
||||||
tree_store_remove_entry (const vfs_path_t * name_vpath)
|
tree_store_remove_entry (const vfs_path_t * name_vpath)
|
||||||
{
|
{
|
||||||
tree_entry *current, *base, *old;
|
tree_entry *current, *base;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
g_return_if_fail (name_vpath != NULL);
|
g_return_if_fail (name_vpath != NULL);
|
||||||
@ -715,6 +718,7 @@ tree_store_remove_entry (const vfs_path_t * name_vpath)
|
|||||||
while (current != NULL && vfs_path_equal_len (current->name, base->name, len))
|
while (current != NULL && vfs_path_equal_len (current->name, base->name, len))
|
||||||
{
|
{
|
||||||
gboolean ok;
|
gboolean ok;
|
||||||
|
tree_entry *old;
|
||||||
const char *cname;
|
const char *cname;
|
||||||
|
|
||||||
cname = vfs_path_as_str (current->name);
|
cname = vfs_path_as_str (current->name);
|
||||||
@ -859,7 +863,7 @@ tree_store_start_check (const vfs_path_t * vpath)
|
|||||||
void
|
void
|
||||||
tree_store_end_check (void)
|
tree_store_end_check (void)
|
||||||
{
|
{
|
||||||
tree_entry *current, *old;
|
tree_entry *current;
|
||||||
size_t len;
|
size_t len;
|
||||||
GList *the_queue;
|
GList *the_queue;
|
||||||
|
|
||||||
@ -875,6 +879,7 @@ tree_store_end_check (void)
|
|||||||
while (current != NULL && vfs_path_equal_len (current->name, ts.check_name, len))
|
while (current != NULL && vfs_path_equal_len (current->name, ts.check_name, len))
|
||||||
{
|
{
|
||||||
gboolean ok;
|
gboolean ok;
|
||||||
|
tree_entry *old;
|
||||||
const char *cname;
|
const char *cname;
|
||||||
|
|
||||||
cname = vfs_path_as_str (current->name);
|
cname = vfs_path_as_str (current->name);
|
||||||
@ -905,7 +910,6 @@ tree_entry *
|
|||||||
tree_store_rescan (const vfs_path_t * vpath)
|
tree_store_rescan (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
tree_entry *entry;
|
tree_entry *entry;
|
||||||
|
|
||||||
@ -923,6 +927,8 @@ tree_store_rescan (const vfs_path_t * vpath)
|
|||||||
dirp = mc_opendir (vpath);
|
dirp = mc_opendir (vpath);
|
||||||
if (dirp)
|
if (dirp)
|
||||||
{
|
{
|
||||||
|
struct dirent *dp;
|
||||||
|
|
||||||
for (dp = mc_readdir (dirp); dp; dp = mc_readdir (dirp))
|
for (dp = mc_readdir (dirp); dp; dp = mc_readdir (dirp))
|
||||||
{
|
{
|
||||||
vfs_path_t *tmp_vpath;
|
vfs_path_t *tmp_vpath;
|
||||||
|
@ -307,15 +307,16 @@ static void
|
|||||||
debug_out (char *start, char *end, int cond)
|
debug_out (char *start, char *end, int cond)
|
||||||
{
|
{
|
||||||
static char *msg;
|
static char *msg;
|
||||||
int len;
|
|
||||||
|
|
||||||
if (start == NULL && end == NULL)
|
if (start == NULL && end == NULL)
|
||||||
{
|
{
|
||||||
/* Show output */
|
/* Show output */
|
||||||
if (debug_flag && msg)
|
if (debug_flag && msg)
|
||||||
{
|
{
|
||||||
|
size_t len;
|
||||||
|
|
||||||
len = strlen (msg);
|
len = strlen (msg);
|
||||||
if (len)
|
if (len != 0)
|
||||||
msg[len - 1] = 0;
|
msg[len - 1] = 0;
|
||||||
message (D_NORMAL, _("Debug"), "%s", msg);
|
message (D_NORMAL, _("Debug"), "%s", msg);
|
||||||
|
|
||||||
@ -361,11 +362,12 @@ test_line (WEdit * edit_widget, char *p, int *result)
|
|||||||
{
|
{
|
||||||
int condition;
|
int condition;
|
||||||
char operator;
|
char operator;
|
||||||
char *debug_start, *debug_end;
|
|
||||||
|
|
||||||
/* Repeat till end of line */
|
/* Repeat till end of line */
|
||||||
while (*p && *p != '\n')
|
while (*p && *p != '\n')
|
||||||
{
|
{
|
||||||
|
char *debug_start, *debug_end;
|
||||||
|
|
||||||
/* support quote space .mnu */
|
/* support quote space .mnu */
|
||||||
while ((*p == ' ' && *(p - 1) != '\\') || *p == '\t')
|
while ((*p == ' ' && *(p - 1) != '\\') || *p == '\t')
|
||||||
p++;
|
p++;
|
||||||
@ -473,7 +475,6 @@ execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_p
|
|||||||
{
|
{
|
||||||
if (*commands == '}')
|
if (*commands == '}')
|
||||||
{
|
{
|
||||||
char *tmp;
|
|
||||||
*parameter = 0;
|
*parameter = 0;
|
||||||
parameter =
|
parameter =
|
||||||
input_dialog (_("Parameter"), lc_prompt, MC_HISTORY_FM_MENU_EXEC_PARAM, "",
|
input_dialog (_("Parameter"), lc_prompt, MC_HISTORY_FM_MENU_EXEC_PARAM, "",
|
||||||
@ -490,6 +491,8 @@ execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_p
|
|||||||
}
|
}
|
||||||
if (do_quote)
|
if (do_quote)
|
||||||
{
|
{
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
tmp = name_quote (parameter, 0);
|
tmp = name_quote (parameter, 0);
|
||||||
fputs (tmp, cmd_file);
|
fputs (tmp, cmd_file);
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
@ -689,12 +692,13 @@ check_format_var (const char *p, char **v)
|
|||||||
{
|
{
|
||||||
const char *q = p;
|
const char *q = p;
|
||||||
char *var_name;
|
char *var_name;
|
||||||
const char *value;
|
|
||||||
const char *dots = 0;
|
|
||||||
|
|
||||||
*v = 0;
|
*v = NULL;
|
||||||
if (!strncmp (p, "var{", 4))
|
if (!strncmp (p, "var{", 4))
|
||||||
{
|
{
|
||||||
|
const char *dots = NULL;
|
||||||
|
const char *value;
|
||||||
|
|
||||||
for (q += 4; *q && *q != '}'; q++)
|
for (q += 4; *q && *q != '}'; q++)
|
||||||
{
|
{
|
||||||
if (*q == ':')
|
if (*q == ':')
|
||||||
@ -925,7 +929,6 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
|
|||||||
int max_cols, menu_lines, menu_limit;
|
int max_cols, menu_lines, menu_limit;
|
||||||
int col, i, accept_entry = 1;
|
int col, i, accept_entry = 1;
|
||||||
int selected, old_patterns;
|
int selected, old_patterns;
|
||||||
Listbox *listbox;
|
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
gboolean interactive = TRUE;
|
gboolean interactive = TRUE;
|
||||||
|
|
||||||
@ -1093,6 +1096,8 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
|
|||||||
selected = selected_entry;
|
selected = selected_entry;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Listbox *listbox;
|
||||||
|
|
||||||
max_cols = min (max (max_cols, col), MAX_ENTRY_LEN);
|
max_cols = min (max (max_cols, col), MAX_ENTRY_LEN);
|
||||||
|
|
||||||
/* Create listbox */
|
/* Create listbox */
|
||||||
|
@ -296,9 +296,7 @@ move_to_bottom (void)
|
|||||||
static const char *
|
static const char *
|
||||||
help_follow_link (const char *start, const char *lc_selected_item)
|
help_follow_link (const char *start, const char *lc_selected_item)
|
||||||
{
|
{
|
||||||
char link_name[MAXLINKNAME];
|
|
||||||
const char *p;
|
const char *p;
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
if (lc_selected_item == NULL)
|
if (lc_selected_item == NULL)
|
||||||
return start;
|
return start;
|
||||||
@ -307,6 +305,9 @@ help_follow_link (const char *start, const char *lc_selected_item)
|
|||||||
;
|
;
|
||||||
if (*p == CHAR_LINK_POINTER)
|
if (*p == CHAR_LINK_POINTER)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
char link_name[MAXLINKNAME];
|
||||||
|
|
||||||
link_name[0] = '[';
|
link_name[0] = '[';
|
||||||
for (i = 1; *p != CHAR_LINK_END && *p && *p != CHAR_NODE_END && i < MAXLINKNAME - 3;)
|
for (i = 1; *p != CHAR_LINK_END && *p && *p != CHAR_NODE_END && i < MAXLINKNAME - 3;)
|
||||||
link_name[i++] = *++p;
|
link_name[i++] = *++p;
|
||||||
|
@ -453,9 +453,10 @@ main (int argc, char *argv[])
|
|||||||
if (macros_list != NULL)
|
if (macros_list != NULL)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
macros_t *macros;
|
|
||||||
for (i = 0; i < macros_list->len; i++)
|
for (i = 0; i < macros_list->len; i++)
|
||||||
{
|
{
|
||||||
|
macros_t *macros;
|
||||||
|
|
||||||
macros = &g_array_index (macros_list, struct macros_t, i);
|
macros = &g_array_index (macros_list, struct macros_t, i);
|
||||||
if (macros != NULL && macros->macro != NULL)
|
if (macros != NULL && macros->macro != NULL)
|
||||||
(void) g_array_free (macros->macro, FALSE);
|
(void) g_array_free (macros->macro, FALSE);
|
||||||
|
@ -510,7 +510,6 @@ setup__move_panels_config_into_separate_file (const char *profile)
|
|||||||
{
|
{
|
||||||
mc_config_t *tmp_cfg;
|
mc_config_t *tmp_cfg;
|
||||||
char **groups, **curr_grp;
|
char **groups, **curr_grp;
|
||||||
const char *need_grp;
|
|
||||||
|
|
||||||
if (!exist_file (profile))
|
if (!exist_file (profile))
|
||||||
return;
|
return;
|
||||||
@ -547,6 +546,8 @@ setup__move_panels_config_into_separate_file (const char *profile)
|
|||||||
|
|
||||||
while (*curr_grp)
|
while (*curr_grp)
|
||||||
{
|
{
|
||||||
|
const char *need_grp;
|
||||||
|
|
||||||
need_grp = setup__is_cfg_group_must_panel_config (*curr_grp);
|
need_grp = setup__is_cfg_group_must_panel_config (*curr_grp);
|
||||||
if (need_grp != NULL)
|
if (need_grp != NULL)
|
||||||
{
|
{
|
||||||
|
@ -184,10 +184,12 @@ static struct termios raw_mode;
|
|||||||
static ssize_t
|
static ssize_t
|
||||||
write_all (int fd, const void *buf, size_t count)
|
write_all (int fd, const void *buf, size_t count)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
|
||||||
ssize_t written = 0;
|
ssize_t written = 0;
|
||||||
|
|
||||||
while (count > 0)
|
while (count > 0)
|
||||||
{
|
{
|
||||||
|
ssize_t ret;
|
||||||
|
|
||||||
ret = write (fd, (const unsigned char *) buf + written, count);
|
ret = write (fd, (const unsigned char *) buf + written, count);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
@ -471,7 +473,6 @@ static gboolean
|
|||||||
feed_subshell (int how, int fail_on_error)
|
feed_subshell (int how, int fail_on_error)
|
||||||
{
|
{
|
||||||
fd_set read_set; /* For 'select' */
|
fd_set read_set; /* For 'select' */
|
||||||
int maxfdp;
|
|
||||||
int bytes; /* For the return value from 'read' */
|
int bytes; /* For the return value from 'read' */
|
||||||
int i; /* Loop counter */
|
int i; /* Loop counter */
|
||||||
|
|
||||||
@ -485,6 +486,8 @@ feed_subshell (int how, int fail_on_error)
|
|||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
|
int maxfdp;
|
||||||
|
|
||||||
if (!subshell_alive)
|
if (!subshell_alive)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -384,12 +384,12 @@ fish_set_env (int flags)
|
|||||||
static gboolean
|
static gboolean
|
||||||
fish_info (struct vfs_class *me, struct vfs_s_super *super)
|
fish_info (struct vfs_class *me, struct vfs_s_super *super)
|
||||||
{
|
{
|
||||||
char buffer[BUF_8K];
|
|
||||||
if (fish_command (me, super, NONE, SUP->scr_info) == COMPLETE)
|
if (fish_command (me, super, NONE, SUP->scr_info) == COMPLETE)
|
||||||
{
|
{
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
char buffer[BUF_8K];
|
||||||
|
|
||||||
res = vfs_s_get_line_interruptible (me, buffer, sizeof (buffer), SUP->sockr);
|
res = vfs_s_get_line_interruptible (me, buffer, sizeof (buffer), SUP->sockr);
|
||||||
if ((res == 0) || (res == EINTR))
|
if ((res == 0) || (res == EINTR))
|
||||||
|
@ -697,23 +697,27 @@ static void
|
|||||||
ftpfs_load_no_proxy_list (void)
|
ftpfs_load_no_proxy_list (void)
|
||||||
{
|
{
|
||||||
/* FixMe: shouldn't be hardcoded!!! */
|
/* FixMe: shouldn't be hardcoded!!! */
|
||||||
char s[BUF_LARGE]; /* provide for BUF_LARGE characters */
|
|
||||||
FILE *npf;
|
|
||||||
int c;
|
|
||||||
char *p;
|
|
||||||
static char *mc_file = NULL;
|
static char *mc_file = NULL;
|
||||||
|
|
||||||
mc_file = g_build_filename (mc_global.sysconfig_dir, "mc.no_proxy", (char *) NULL);
|
mc_file = g_build_filename (mc_global.sysconfig_dir, "mc.no_proxy", (char *) NULL);
|
||||||
if (exist_file (mc_file))
|
if (exist_file (mc_file))
|
||||||
{
|
{
|
||||||
|
FILE *npf;
|
||||||
|
|
||||||
npf = fopen (mc_file, "r");
|
npf = fopen (mc_file, "r");
|
||||||
if (npf != NULL)
|
if (npf != NULL)
|
||||||
{
|
{
|
||||||
|
char s[BUF_LARGE]; /* provide for BUF_LARGE characters */
|
||||||
|
|
||||||
while (fgets (s, sizeof (s), npf) != NULL)
|
while (fgets (s, sizeof (s), npf) != NULL)
|
||||||
{
|
{
|
||||||
|
char *p;
|
||||||
|
|
||||||
p = strchr (s, '\n');
|
p = strchr (s, '\n');
|
||||||
if (p == NULL) /* skip bogus entries */
|
if (p == NULL) /* skip bogus entries */
|
||||||
{
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
while ((c = fgetc (npf)) != EOF && c != '\n')
|
while ((c = fgetc (npf)) != EOF && c != '\n')
|
||||||
;
|
;
|
||||||
continue;
|
continue;
|
||||||
@ -1409,7 +1413,6 @@ ftpfs_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh)
|
|||||||
struct vfs_s_super *super = FH_SUPER;
|
struct vfs_s_super *super = FH_SUPER;
|
||||||
static unsigned char const ipbuf[3] = { IAC, IP, IAC };
|
static unsigned char const ipbuf[3] = { IAC, IP, IAC };
|
||||||
fd_set mask;
|
fd_set mask;
|
||||||
char buf[BUF_8K];
|
|
||||||
int dsock = FH_SOCK;
|
int dsock = FH_SOCK;
|
||||||
FH_SOCK = -1;
|
FH_SOCK = -1;
|
||||||
SUP->ctl_connection_busy = 0;
|
SUP->ctl_connection_busy = 0;
|
||||||
@ -1437,6 +1440,8 @@ ftpfs_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh)
|
|||||||
if (select (dsock + 1, &mask, NULL, NULL, NULL) > 0)
|
if (select (dsock + 1, &mask, NULL, NULL, NULL) > 0)
|
||||||
{
|
{
|
||||||
struct timeval start_tim, tim;
|
struct timeval start_tim, tim;
|
||||||
|
char buf[BUF_8K];
|
||||||
|
|
||||||
gettimeofday (&start_tim, NULL);
|
gettimeofday (&start_tim, NULL);
|
||||||
/* flush the remaining data */
|
/* flush the remaining data */
|
||||||
while (read (dsock, buf, sizeof (buf)) > 0)
|
while (read (dsock, buf, sizeof (buf)) > 0)
|
||||||
@ -2310,11 +2315,12 @@ ftpfs_netrc_next (void)
|
|||||||
static int
|
static int
|
||||||
ftpfs_netrc_bad_mode (const char *netrcname)
|
ftpfs_netrc_bad_mode (const char *netrcname)
|
||||||
{
|
{
|
||||||
static int be_angry = 1;
|
|
||||||
struct stat mystat;
|
struct stat mystat;
|
||||||
|
|
||||||
if (stat (netrcname, &mystat) >= 0 && (mystat.st_mode & 077))
|
if (stat (netrcname, &mystat) >= 0 && (mystat.st_mode & 077))
|
||||||
{
|
{
|
||||||
|
static int be_angry = 1;
|
||||||
|
|
||||||
if (be_angry)
|
if (be_angry)
|
||||||
{
|
{
|
||||||
message (D_ERROR, MSG_ERROR,
|
message (D_ERROR, MSG_ERROR,
|
||||||
@ -2404,7 +2410,6 @@ ftpfs_netrc_lookup (const char *host, char **login, char **pass)
|
|||||||
char *tmp_pass = NULL;
|
char *tmp_pass = NULL;
|
||||||
char hostname[MAXHOSTNAMELEN];
|
char hostname[MAXHOSTNAMELEN];
|
||||||
const char *domain;
|
const char *domain;
|
||||||
keyword_t keyword;
|
|
||||||
static struct rupcache
|
static struct rupcache
|
||||||
{
|
{
|
||||||
struct rupcache *next;
|
struct rupcache *next;
|
||||||
@ -2456,6 +2461,8 @@ ftpfs_netrc_lookup (const char *host, char **login, char **pass)
|
|||||||
/* Scan for keywords following "default" and "machine" */
|
/* Scan for keywords following "default" and "machine" */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
keyword_t keyword;
|
||||||
|
|
||||||
int need_break = 0;
|
int need_break = 0;
|
||||||
keyword = ftpfs_netrc_next ();
|
keyword = ftpfs_netrc_next ();
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ sfs_vfmake (const vfs_path_t * vpath, vfs_path_t * cache_vpath)
|
|||||||
char pad[10240];
|
char pad[10240];
|
||||||
char *s_iter, *t = pad;
|
char *s_iter, *t = pad;
|
||||||
int was_percent = 0;
|
int was_percent = 0;
|
||||||
vfs_path_t *pname, *s; /* name of parent archive */
|
vfs_path_t *pname; /* name of parent archive */
|
||||||
char *pqname; /* name of parent archive, quoted */
|
char *pqname; /* name of parent archive, quoted */
|
||||||
const vfs_path_element_t *path_element;
|
const vfs_path_element_t *path_element;
|
||||||
|
|
||||||
@ -150,6 +150,8 @@ sfs_vfmake (const vfs_path_t * vpath, vfs_path_t * cache_vpath)
|
|||||||
/* if ((sfs_flags[w] & F_2) || (!inpath) || (!*inpath)); else return -1; */
|
/* if ((sfs_flags[w] & F_2) || (!inpath) || (!*inpath)); else return -1; */
|
||||||
if ((sfs_flags[w] & F_NOLOCALCOPY) == 0)
|
if ((sfs_flags[w] & F_NOLOCALCOPY) == 0)
|
||||||
{
|
{
|
||||||
|
vfs_path_t *s;
|
||||||
|
|
||||||
s = mc_getlocalcopy (pname);
|
s = mc_getlocalcopy (pname);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
{
|
{
|
||||||
|
@ -754,7 +754,6 @@ tar_open_archive (struct vfs_s_super *archive, const vfs_path_t * vpath,
|
|||||||
{
|
{
|
||||||
/* Initial status at start of archive */
|
/* Initial status at start of archive */
|
||||||
ReadStatus status = STATUS_EOFMARK;
|
ReadStatus status = STATUS_EOFMARK;
|
||||||
ReadStatus prev_status;
|
|
||||||
int tard;
|
int tard;
|
||||||
|
|
||||||
current_tar_position = 0;
|
current_tar_position = 0;
|
||||||
@ -766,8 +765,8 @@ tar_open_archive (struct vfs_s_super *archive, const vfs_path_t * vpath,
|
|||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
size_t h_size;
|
size_t h_size;
|
||||||
|
ReadStatus prev_status = status;
|
||||||
|
|
||||||
prev_status = status;
|
|
||||||
status = tar_read_header (vpath_element->class, archive, tard, &h_size);
|
status = tar_read_header (vpath_element->class, archive, tard, &h_size);
|
||||||
|
|
||||||
switch (status)
|
switch (status)
|
||||||
|
@ -148,13 +148,13 @@ mcview_display_status (mcview_t * view)
|
|||||||
|
|
||||||
if (width > 40)
|
if (width > 40)
|
||||||
{
|
{
|
||||||
char buffer[BUF_TRUNC_LEN + 1];
|
|
||||||
|
|
||||||
widget_move (view, top, width - 32);
|
widget_move (view, top, width - 32);
|
||||||
if (view->hex_mode)
|
if (view->hex_mode)
|
||||||
tty_printf ("0x%08" PRIxMAX, (uintmax_t) view->hex_cursor);
|
tty_printf ("0x%08" PRIxMAX, (uintmax_t) view->hex_cursor);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char buffer[BUF_TRUNC_LEN + 1];
|
||||||
|
|
||||||
size_trunc_len (buffer, BUF_TRUNC_LEN, mcview_get_filesize (view), 0,
|
size_trunc_len (buffer, BUF_TRUNC_LEN, mcview_get_filesize (view), 0,
|
||||||
panels_options.kilobyte_si);
|
panels_options.kilobyte_si);
|
||||||
tty_printf ("%9" PRIuMAX "/%s%s %s", (uintmax_t) view->dpy_end,
|
tty_printf ("%9" PRIuMAX "/%s%s %s", (uintmax_t) view->dpy_end,
|
||||||
|
@ -113,8 +113,6 @@ void
|
|||||||
mcview_growbuf_read_until (mcview_t * view, off_t ofs)
|
mcview_growbuf_read_until (mcview_t * view, off_t ofs)
|
||||||
{
|
{
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
byte *p;
|
|
||||||
size_t bytesfree;
|
|
||||||
gboolean short_read;
|
gboolean short_read;
|
||||||
|
|
||||||
#ifdef HAVE_ASSERT_H
|
#ifdef HAVE_ASSERT_H
|
||||||
@ -127,6 +125,9 @@ mcview_growbuf_read_until (mcview_t * view, off_t ofs)
|
|||||||
short_read = FALSE;
|
short_read = FALSE;
|
||||||
while (mcview_growbuf_filesize (view) < ofs || short_read)
|
while (mcview_growbuf_filesize (view) < ofs || short_read)
|
||||||
{
|
{
|
||||||
|
byte *p;
|
||||||
|
size_t bytesfree;
|
||||||
|
|
||||||
if (view->growbuf_lastindex == VIEW_PAGE_SIZE)
|
if (view->growbuf_lastindex == VIEW_PAGE_SIZE)
|
||||||
{
|
{
|
||||||
/* Append a new block to the growing buffer */
|
/* Append a new block to the growing buffer */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Function for hex view
|
Function for hex view
|
||||||
|
|
||||||
Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
|
Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
2004, 2005, 2006, 2007, 2009, 2011
|
2004, 2005, 2006, 2007, 2009, 2011, 2013
|
||||||
The Free Software Foundation, Inc.
|
The Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by:
|
Written by:
|
||||||
@ -14,7 +14,7 @@
|
|||||||
Norbert Warmuth, 1997
|
Norbert Warmuth, 1997
|
||||||
Pavel Machek, 1998
|
Pavel Machek, 1998
|
||||||
Roland Illig <roland.illig@gmx.de>, 2004, 2005
|
Roland Illig <roland.illig@gmx.de>, 2004, 2005
|
||||||
Slava Zanko <slavazanko@google.com>, 2009
|
Slava Zanko <slavazanko@google.com>, 2009, 2013
|
||||||
Andrew Borodin <aborodin@vmail.ru>, 2009
|
Andrew Borodin <aborodin@vmail.ru>, 2009
|
||||||
Ilia Maslakov <il.smind@gmail.com>, 2009
|
Ilia Maslakov <il.smind@gmail.com>, 2009
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ mcview_display_hex (mcview_t * view)
|
|||||||
* text column.
|
* text column.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
screen_dimen row, col;
|
screen_dimen row;
|
||||||
off_t from;
|
off_t from;
|
||||||
int c;
|
int c;
|
||||||
mark_t boldflag = MARK_NORMAL;
|
mark_t boldflag = MARK_NORMAL;
|
||||||
@ -152,7 +152,9 @@ mcview_display_hex (mcview_t * view)
|
|||||||
|
|
||||||
for (row = 0; mcview_get_byte (view, from, NULL) == TRUE && row < height; row++)
|
for (row = 0; mcview_get_byte (view, from, NULL) == TRUE && row < height; row++)
|
||||||
{
|
{
|
||||||
|
screen_dimen col = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
col = 0;
|
col = 0;
|
||||||
|
|
||||||
/* Print the hex offset */
|
/* Print the hex offset */
|
||||||
@ -173,17 +175,22 @@ mcview_display_hex (mcview_t * view)
|
|||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
if (view->utf8)
|
if (view->utf8)
|
||||||
{
|
{
|
||||||
char corr_buf[UTF8_CHAR_LEN + 1];
|
int cw = 1;
|
||||||
int cnt, cw = 1;
|
|
||||||
gboolean read_res = TRUE;
|
gboolean read_res = TRUE;
|
||||||
|
|
||||||
ch = mcview_get_utf (view, from, &cw, &read_res);
|
ch = mcview_get_utf (view, from, &cw, &read_res);
|
||||||
if (!read_res)
|
if (!read_res)
|
||||||
break;
|
break;
|
||||||
/* char width is greater 0 bytes */
|
/* char width is greater 0 bytes */
|
||||||
if (cw != 0)
|
if (cw != 0)
|
||||||
{
|
{
|
||||||
|
int cnt;
|
||||||
|
char corr_buf[UTF8_CHAR_LEN + 1];
|
||||||
struct hexedit_change_node *corr = curr;
|
struct hexedit_change_node *corr = curr;
|
||||||
int res = g_unichar_to_utf8 (ch, (char *) corr_buf);
|
int res;
|
||||||
|
|
||||||
|
res = g_unichar_to_utf8 (ch, (char *) corr_buf);
|
||||||
|
|
||||||
for (cnt = 0; cnt < cw; cnt++)
|
for (cnt = 0; cnt < cw; cnt++)
|
||||||
{
|
{
|
||||||
if (curr != NULL && from + cnt == curr->offset)
|
if (curr != NULL && from + cnt == curr->offset)
|
||||||
|
Loading…
Reference in New Issue
Block a user