diff options
author | Stanislav Brabec <utx@penguin.cz> | 2009-03-02 17:39:45 +0000 |
---|---|---|
committer | utx@penguin.cz <utx@penguin.cz> | 2009-03-02 17:42:41 +0000 |
commit | 6be41f1374dc9bf7f53673273d8b02bfbfe6a02e (patch) | |
tree | b5fa1b53885c2814b379e2bc6cb8db9c2afe418b | |
parent | 7b0e17165cbd5ba742b68f5d8654a3e29623edad (diff) |
mc-4.6.2: More fixes: cursor on tab, UTF-8 regexp, ftpfs, Esc(.
-rw-r--r-- | packages/mc/mc-4.6.2/01_ftpfs_symlink.patch | 32 | ||||
-rw-r--r-- | packages/mc/mc-4.6.2/02_ignore_ftp_chmod_error.patch | 11 | ||||
-rw-r--r-- | packages/mc/mc-4.6.2/99_regexp-replace-fixed.patch | 312 | ||||
-rw-r--r-- | packages/mc/mc-4.6.2/99b_fix-regex-pattern-lengths.patch | 53 | ||||
-rw-r--r-- | packages/mc/mc-4.6.2/mc-cursor-appearance.patch | 52 | ||||
-rw-r--r-- | packages/mc/mc-4.6.2/mc-esc-seq.patch | 11 | ||||
-rw-r--r-- | packages/mc/mc_4.6.2.bb | 14 |
7 files changed, 480 insertions, 5 deletions
diff --git a/packages/mc/mc-4.6.2/01_ftpfs_symlink.patch b/packages/mc/mc-4.6.2/01_ftpfs_symlink.patch new file mode 100644 index 0000000000..f05a424cac --- /dev/null +++ b/packages/mc/mc-4.6.2/01_ftpfs_symlink.patch @@ -0,0 +1,32 @@ +--- mc-4.6.2/vfs/direntry.c ++++ mc-4.6.2/vfs/direntry.c +@@ -251,7 +251,13 @@ + char * const pathref = g_strdup (a_path); + char *path = pathref; + +- canonicalize_pathname (path); ++ if (strncmp(me->name, "ftpfs", 5) != 0) ++ canonicalize_pathname (path); ++ else { ++ char *p = path + strlen (path) - 1; ++ while (p > path && *p == PATH_SEP) ++ *p-- = 0; ++ } + + while (root) { + while (*path == PATH_SEP) /* Strip leading '/' */ +@@ -324,7 +330,13 @@ + if (root->super->root != root) + vfs_die ("We have to use _real_ root. Always. Sorry."); + +- canonicalize_pathname (path); ++ if (strncmp (me->name, "ftpfs", 5) != 0) ++ canonicalize_pathname (path); ++ else { ++ char *p = path + strlen (path) - 1; ++ while (p > path && *p == PATH_SEP) ++ *p-- = 0; ++ } + + if (!(flags & FL_DIR)) { + char *dirname, *name, *save; diff --git a/packages/mc/mc-4.6.2/02_ignore_ftp_chmod_error.patch b/packages/mc/mc-4.6.2/02_ignore_ftp_chmod_error.patch new file mode 100644 index 0000000000..6ad176dfa1 --- /dev/null +++ b/packages/mc/mc-4.6.2/02_ignore_ftp_chmod_error.patch @@ -0,0 +1,11 @@ +--- mc-4.6.2/vfs/ftpfs.c ++++ mc-4.6.2/vfs/ftpfs.c +@@ -1529,7 +1529,7 @@ + char buf[BUF_SMALL]; + + g_snprintf(buf, sizeof(buf), "SITE CHMOD %4.4o /%%s", mode & 07777); +- return ftpfs_send_command(me, path, buf, OPT_FLUSH); ++ return ftpfs_send_command(me, path, buf, OPT_FLUSH | OPT_IGNORE_ERROR); + } + + static int ftpfs_chown (struct vfs_class *me, const char *path, int owner, int group) diff --git a/packages/mc/mc-4.6.2/99_regexp-replace-fixed.patch b/packages/mc/mc-4.6.2/99_regexp-replace-fixed.patch new file mode 100644 index 0000000000..612d77736b --- /dev/null +++ b/packages/mc/mc-4.6.2/99_regexp-replace-fixed.patch @@ -0,0 +1,312 @@ +--- mc-4.6.2/edit/editcmd.c ++++ mc-4.6.2/edit/editcmd.c +@@ -2103,6 +2103,33 @@ + edit_error_dialog (_("Error"), _(" Invalid regular expression, or scanf expression with too many conversions ")); + } + ++int mc_isdigit(mc_wchar_t c) ++{ ++#ifndef UTF8 ++ return isdigit(c); ++#else /* UTF8 */ ++ return iswdigit(c); ++#endif /* UTF8 */ ++} ++ ++mc_wchar_t * mc_memmove(mc_wchar_t *to, mc_wchar_t *from, size_t size) ++{ ++#ifndef UTF8 ++ return memmove(to, from, size); ++#else /* UTF8 */ ++ return wmemmove(to, from, size); ++#endif /* UTF8 */ ++} ++ ++mc_wchar_t * mc_strchr(mc_wchar_t *str, mc_wchar_t c) ++{ ++#ifndef UTF8 ++ return strchr(str, c); ++#else /* UTF8 */ ++ return wcschr(str, c); ++#endif /* UTF8 */ ++} ++ + /* call with edit = 0 before shutdown to close memory leaks */ + void + edit_replace_cmd (WEdit *edit, int again) +@@ -2119,6 +2146,8 @@ + int replace_continue; + int treplace_prompt = 0; + long times_replaced = 0, last_search; ++ mc_wchar_t *repl_templ; ++ mc_wchar_t *repl_str; + int argord[NUM_REPL_ARGS]; + + if (!edit) { +@@ -2172,7 +2201,68 @@ + + } + +- { ++#ifndef UTF8 ++ repl_templ = g_strdup(input2); ++#else /* UTF8 */ ++ repl_templ = mbstr_to_wchar(input2); ++#endif /* UTF8 */ ++ ++ if (replace_regexp) { ++ /* ++ * edit replace template - convert subpattern references (\1) to ++ * snprintf_p arguments (%s) and fill "argord" array to match captured ++ * subpatterns ++ */ ++ int ao; ++ int ord; ++ mc_wchar_t *s; ++ mc_wchar_t *param; ++ mc_wchar_t *endptr; ++#ifndef UTF8 ++#define MC_CHAR(c) ((mc_wchar_t) c) ++#else /* UTF8 */ ++#define MC_CHAR(c) (L##c) ++#endif /* UTF8 */ ++ ++ endptr = mc_strchr(repl_templ, MC_CHAR('\0')); ++ s = repl_templ; ++ ao = 0; ++ while ((s = mc_strchr(s, MC_CHAR('\\')))) { ++ param = s; ++ s++; ++ if (!s) break; ++ /* implement \n \r and \t escape sequences in replace string */ ++ if (*s == MC_CHAR('n')) { ++ *s = MC_CHAR('\n'); ++ } else if (*s == MC_CHAR('r')) { ++ *s = MC_CHAR('\r'); ++ } else if (*s == MC_CHAR('t')) { ++ *s = MC_CHAR('\t'); ++ } ++ if (!mc_isdigit(*s)) { ++ mc_memmove(param, s, endptr - s + 1); ++ continue; ++ } ++ ord = 0; ++ while (mc_isdigit(*s)) { ++ ord *= 10; ++ ord += *s - MC_CHAR('0'); ++ s++; ++ } ++ if ((ord > 0) && (ord <= NUM_REPL_ARGS)) { ++ argord[ao++] = ord - 1; ++ *param++ = MC_CHAR('%'); ++ *param++ = MC_CHAR('s'); ++ mc_memmove(param, s, endptr - s + 1); ++ s = param; ++ } ++ } ++ while (ao < NUM_REPL_ARGS) { ++ argord[ao] = ao; ++ ao++; ++ } ++ ++ } else { + const char *s; + int ord; + size_t i; +@@ -2203,6 +2293,12 @@ + && !replace_backwards) + edit->search_start++; + ++ if (replace_scanf || replace_regexp) { ++ repl_str = g_malloc(((MAX_REPL_LEN + 2)+1) * sizeof(mc_wchar_t)); ++ } else { ++ repl_str = repl_templ; ++ } ++ + do { + int len = 0; + long new_start; +@@ -2227,8 +2323,47 @@ + + replace_yes = 1; + ++ if (replace_scanf || replace_regexp) { ++ int ret = 0; ++ ++ /* we need to fill in sargs just like with scanf */ ++ if (replace_regexp) { ++ int k, j; ++ for (k = 1; k < NUM_REPL_ARGS && pmatch[k].rm_eo >= 0; ++ k++) { ++ mc_wchar_t *t; ++ ++ if (pmatch[k].rm_eo - pmatch[k].rm_so > 255) { ++ ret = -1; ++ break; ++ } ++ t = (mc_wchar_t *) &sargs[k - 1][0]; ++ for (j = 0; j < pmatch[k].rm_eo - pmatch[k].rm_so && ++ j < 255; j++, t++) ++ *t = edit_get_byte (edit, edit->search_start - ++ pmatch[0].rm_so + pmatch[k].rm_so + j); ++ *t = '\0'; ++ } ++ for (; k <= NUM_REPL_ARGS; k++) ++ sargs[k - 1][0] = 0; ++ } ++ if (ret >= 0) ++ ret = snprintf_p (repl_str, MAX_REPL_LEN + 2, repl_templ, ++ PRINTF_ARGS); ++ if (ret < 0) { ++ edit_error_dialog (_(" Replace "), ++ ret == -2 ++ ? _(" Error in replacement format string. ") ++ : _(" Replacement too long. ")); ++ treplace_prompt = 0; ++ replace_yes = 0; ++ replace_continue = 0; ++ } ++ } ++ + if (treplace_prompt) { + int l; ++ char *displ_repl_str; + l = edit->curs_row - edit->num_widget_lines / 3; + if (l > 0) + edit_scroll_downward (edit, l); +@@ -2242,7 +2377,15 @@ + /*so that undo stops at each query */ + edit_push_key_press (edit); + +- switch (edit_replace_prompt (edit, input2, /* and prompt 2/3 down */ ++#ifndef UTF8 ++ displ_repl_str = g_strdup(repl_str); ++#else /* UTF8 */ ++ displ_repl_str = wchar_to_mbstr(repl_str); ++ /* wchar_to_mbstr(str) returns NULL when length of str == 0 */ ++ if (!displ_repl_str) displ_repl_str = g_strdup(""); ++#endif /* UTF8 */ ++ convert_to_display (displ_repl_str); ++ switch (edit_replace_prompt (edit, displ_repl_str, /* and prompt 2/3 down */ + (edit->num_widget_columns - + CONFIRM_DLG_WIDTH) / 2, + edit->num_widget_lines * 2 / +@@ -2264,99 +2407,15 @@ + replace_continue = 0; + break; + } ++ g_free(displ_repl_str); + } + if (replace_yes) { /* delete then insert new */ +-#ifdef UTF8 +- mc_wchar_t *winput2 = mbstr_to_wchar(input2); +-#endif /* UTF8 */ +- if (replace_scanf) { +- mc_wchar_t repl_str[MAX_REPL_LEN + 2]; +- int ret = 0; +- +- /* we need to fill in sargs just like with scanf */ +- if (replace_regexp) { +- int k, j; +- for (k = 1; +- k < NUM_REPL_ARGS && pmatch[k].rm_eo >= 0; +- k++) { +-#ifndef UTF8 +- unsigned char *t; +-#else /* UTF8 */ +- mc_wchar_t *t; +-#endif +- +- if (pmatch[k].rm_eo - pmatch[k].rm_so > 255) { +- ret = -1; +- break; +- } +-#ifndef UTF8 +- t = (unsigned char *) &sargs[k - 1][0]; +-#else /* UTF8 */ +- t = (mc_wchar_t *) &sargs[k - 1][0]; +-#endif /* UTF8 */ +- for (j = 0; +- j < pmatch[k].rm_eo - pmatch[k].rm_so +- && j < 255; j++, t++) +- *t = edit_get_byte (edit, +- edit-> +- search_start +- - +- pmatch +- [0]. +- rm_so + +- pmatch +- [k]. +- rm_so + +- j); +- *t = '\0'; +- } +- for (; k <= NUM_REPL_ARGS; k++) +- sargs[k - 1][0] = 0; +- } +- if (!ret) +- ret = +-#ifndef UTF8 +- snprintf_p (repl_str, MAX_REPL_LEN + 2, input2, +-#else /* UTF8 */ +- snprintf_p (repl_str, MAX_REPL_LEN + 2, winput2, +-#endif /* UTF8 */ +- PRINTF_ARGS); +- if (ret >= 0) { +- times_replaced++; +- while (i--) +- edit_delete (edit); +-#ifndef UTF8 +- while (repl_str[++i]) +- edit_insert (edit, repl_str[i]); +-#else /* UTF8 */ +- while (winput2[++i]) +- edit_insert (edit, winput2[i]); +-#endif /* UTF8 */ +- } else { +- edit_error_dialog (_(" Replace "), +- ret == +- -2 ? +- _ +- (" Error in replacement format string. ") +- : _(" Replacement too long. ")); +- replace_continue = 0; +- } +- } else { +- times_replaced++; +- while (i--) +- edit_delete (edit); +-#ifndef UTF8 +- while (input2[++i]) +- edit_insert (edit, input2[i]); +-#else /* UTF8 */ +- while (winput2[++i]) +- edit_insert (edit, winput2[i]); +-#endif /* UTF8 */ +- } ++ times_replaced++; ++ while (i--) ++ edit_delete (edit); ++ while (repl_str[++i]) ++ edit_insert (edit, repl_str[i]); + edit->found_len = i; +-#ifdef UTF8 +- g_free (winput2); +-#endif /* UTF8 */ + } + /* so that we don't find the same string again */ + if (replace_backwards) { +@@ -2385,6 +2444,12 @@ + } + } while (replace_continue); + ++ /* cleanup */ ++ if (replace_scanf || replace_regexp) { ++ g_free(repl_str); ++ } ++ g_free(repl_templ); ++ + edit->force = REDRAW_COMPLETELY; + edit_scroll_screen_over_cursor (edit); + cleanup: diff --git a/packages/mc/mc-4.6.2/99b_fix-regex-pattern-lengths.patch b/packages/mc/mc-4.6.2/99b_fix-regex-pattern-lengths.patch new file mode 100644 index 0000000000..580c8345dd --- /dev/null +++ b/packages/mc/mc-4.6.2/99b_fix-regex-pattern-lengths.patch @@ -0,0 +1,53 @@ +--- mc-4.6.2/edit/editcmd.c ++++ mc-4.6.2/edit/editcmd.c +@@ -1511,6 +1511,32 @@ + sargs[argord[8]], sargs[argord[9]], sargs[argord[10]], sargs[argord[11]], \ + sargs[argord[12]], sargs[argord[13]], sargs[argord[14]], sargs[argord[15]] + ++#ifdef UTF8 ++size_t ++real_mbstrlen (const char *str) ++{ ++ if (SLsmg_Is_Unicode) { ++ size_t width = 0; ++ ++ for (; *str; str++) { ++ wchar_t c; ++ size_t len; ++ ++ len = mbrtowc (&c, str, MB_CUR_MAX, NULL); ++ ++ if (len == (size_t)(-1) || len == (size_t)(-2)) break; ++ ++ if (len > 0) { ++ width ++; ++ str += len-1; ++ } ++ } ++ ++ return width; ++ } else ++ return strlen (str); ++} ++#endif + + /* This function is a modification of mc-3.2.10/src/view.c:regexp_view_search() */ + /* returns -3 on error in pattern, -1 on not found, found_len = 0 if either */ +@@ -1582,7 +1608,7 @@ + continue; + tmp = string[pmatch[i].rm_so]; + string[pmatch[i].rm_so] = 0; +- new_o = mbstrlen(string); ++ new_o = real_mbstrlen(string); + string[pmatch[i].rm_so] = tmp; + pmatch[i].rm_so = new_o; + +@@ -1590,7 +1616,7 @@ + continue; + tmp = string[pmatch[i].rm_eo]; + string[pmatch[i].rm_eo] = 0; +- new_o = mbstrlen(string); ++ new_o = real_mbstrlen(string); + string[pmatch[i].rm_eo] = tmp; + pmatch[i].rm_eo = new_o; + } diff --git a/packages/mc/mc-4.6.2/mc-cursor-appearance.patch b/packages/mc/mc-4.6.2/mc-cursor-appearance.patch new file mode 100644 index 0000000000..2fc94ff0e6 --- /dev/null +++ b/packages/mc/mc-4.6.2/mc-cursor-appearance.patch @@ -0,0 +1,52 @@ +--- mc-4.6.2/edit/editdraw.c ++++ mc-4.6.2/edit/editdraw.c +@@ -356,8 +356,13 @@ + if (use_colors && visible_tabs) { + c = (p->style & ~MOD_CURSOR) | MOD_WHITESPACE; + if (i > 2) { +- p->ch = '<'; +- p->style |= MOD_WHITESPACE; ++ if (p->style & MOD_CURSOR) { ++ p->ch = ' '; ++ } ++ else { ++ p->ch = '<'; ++ p->style |= MOD_WHITESPACE; ++ } + p++; + while (--i > 1) { + p->style = c; +@@ -380,8 +385,13 @@ + p++; + } + } else if (use_colors && visible_tws && q >= tws) { +- p->style |= MOD_WHITESPACE; +- p->ch = '.'; ++ if (p->style & MOD_CURSOR) { ++ p->ch = ' '; ++ } ++ else { ++ p->style |= MOD_WHITESPACE; ++ p->ch = '.'; ++ } + p++; + c = p->style & ~MOD_CURSOR; + while (--i) { +@@ -390,7 +400,7 @@ + p++; + } + } else { +- p->ch |= ' '; ++ p->ch = ' '; + c = p->style & ~MOD_CURSOR; + p++; + while (--i) { +@@ -401,7 +411,7 @@ + } + break; + case ' ': +- if (use_colors && visible_tws && q >= tws) { ++ if (use_colors && visible_tws && q >= tws && !(p->style & MOD_CURSOR)) { + p->ch = '.'; + p->style |= MOD_WHITESPACE; + p++; diff --git a/packages/mc/mc-4.6.2/mc-esc-seq.patch b/packages/mc/mc-4.6.2/mc-esc-seq.patch new file mode 100644 index 0000000000..b9ec04a75a --- /dev/null +++ b/packages/mc/mc-4.6.2/mc-esc-seq.patch @@ -0,0 +1,11 @@ +--- mc-4.6.2/src/util.c ++++ mc-4.6.2/src/util.c +@@ -1205,6 +1205,8 @@ + /* strchr() matches trailing binary 0 */ + while (*(++r) && strchr ("0123456789;?", *r)); + } ++ else if (*r == '(') ++ r++; + + /* + * Now we are at the last character of the sequence. diff --git a/packages/mc/mc_4.6.2.bb b/packages/mc/mc_4.6.2.bb index ea44320e26..9310857b66 100644 --- a/packages/mc/mc_4.6.2.bb +++ b/packages/mc/mc_4.6.2.bb @@ -1,10 +1,8 @@ require mc.inc -PR = "r1" +PR = "r2" HOMEPAGE = "http://www.midnight-commander.org/" -# UTF-8 fixes copied from openSUSE Factory: -# (2009-02-12 by nadvornik@suse.cz) -# mc-utf8-look-and-feel.patch: debian fix for utf8 +# most of these fixes were copied from openSUSE Factory. SRC_URI = "http://www.midnight-commander.org/downloads/${P}.tar.gz \ file://mhl-stdbool.patch;patch=1 \ file://mc-utf8.patch;patch=1 \ @@ -16,8 +14,14 @@ SRC_URI = "http://www.midnight-commander.org/downloads/${P}.tar.gz \ file://mc-utf8-nlink.patch;patch=1 \ file://mc-utf8-look-and-feel.patch;patch=1 \ file://mc-utf8-slang-codeset.patch;patch=1 \ + file://99_regexp-replace-fixed.patch;patch=1 \ + file://99b_fix-regex-pattern-lengths.patch;patch=1 \ file://multi-press-f-keys.patch;patch=1 \ - file://cross-compile.patch;patch=1" + file://cross-compile.patch;patch=1 \ + file://01_ftpfs_symlink.patch;patch=1 \ + file://02_ignore_ftp_chmod_error.patch;patch=1 \ + file://mc-cursor-appearance.patch;patch=1 \ + file://mc-esc-seq.patch;patch=1" EXTRA_OECONF = "--libexecdir=${libdir} --without-x --without-samba \ --without-nfs --without-gpm-mouse --enable-charset" |