summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Khon <fjoe@FreeBSD.org>2005-08-30 15:45:52 +0000
committerMax Khon <fjoe@FreeBSD.org>2005-08-30 15:45:52 +0000
commit0c5af188b95d574a03de92c0f58e9e6cb6ab08ee (patch)
tree9e9985d4e56208f7de3106abe654cc3b03c71ac6
parent- Update to 2.6.7 (diff)
Update to 4.6.1.
Submitted by: Alex Samorukov
-rw-r--r--misc/mc/Makefile7
-rw-r--r--misc/mc/distinfo4
-rw-r--r--misc/mc/files/patch-doc-ru-Makefile.in8
-rw-r--r--misc/mc/files/patch-edit-editcmd.c232
-rw-r--r--misc/mc/files/patch-edit-syntax.c218
-rw-r--r--misc/mc/files/patch-lib-cedit.menu11
-rw-r--r--misc/mc/files/patch-lib-mc.ext.in11
-rw-r--r--misc/mc/files/patch-lib-mc.menu37
-rw-r--r--misc/mc/files/patch-mc.175
-rw-r--r--misc/mc/files/patch-po1021
-rw-r--r--misc/mc/files/patch-slang-sltermin.c18
-rw-r--r--misc/mc/files/patch-src-background.c11
-rw-r--r--misc/mc/files/patch-src-cmd.c11
-rw-r--r--misc/mc/files/patch-src-command.c11
-rw-r--r--misc/mc/files/patch-src-complete.c30
-rw-r--r--misc/mc/files/patch-src-cons.handler.c725
-rw-r--r--misc/mc/files/patch-src-dir.c53
-rw-r--r--misc/mc/files/patch-src-ext.c50
-rw-r--r--misc/mc/files/patch-src-file.c31
-rw-r--r--misc/mc/files/patch-src-find.c97
-rw-r--r--misc/mc/files/patch-src-info.c20
-rw-r--r--misc/mc/files/patch-src-main.c11
-rw-r--r--misc/mc/files/patch-src-man2hlp.c12
-rw-r--r--misc/mc/files/patch-src-profile.c12
-rw-r--r--misc/mc/files/patch-src-screen.c52
-rw-r--r--misc/mc/files/patch-src-subshell.c21
-rw-r--r--misc/mc/files/patch-src-user.c183
-rw-r--r--misc/mc/files/patch-src-util.c29
-rw-r--r--misc/mc/files/patch-src-util.h11
-rw-r--r--misc/mc/files/patch-src-utilunix.c40
-rw-r--r--misc/mc/files/patch-src-view.c116
-rw-r--r--misc/mc/files/patch-src-widget.c24
-rw-r--r--misc/mc/files/patch-src-wtools.c12
-rw-r--r--misc/mc/files/patch-vfs-cpio.c141
-rw-r--r--misc/mc/files/patch-vfs-direntry.c102
-rw-r--r--misc/mc/files/patch-vfs-extfs329
-rw-r--r--misc/mc/files/patch-vfs-extfs-a.in83
-rw-r--r--misc/mc/files/patch-vfs-extfs-apt.in102
-rw-r--r--misc/mc/files/patch-vfs-extfs-deb.in113
-rw-r--r--misc/mc/files/patch-vfs-extfs-deba.in165
-rw-r--r--misc/mc/files/patch-vfs-extfs-debd.in148
-rw-r--r--misc/mc/files/patch-vfs-extfs-dpkg.in74
-rw-r--r--misc/mc/files/patch-vfs-extfs.c26
-rw-r--r--misc/mc/files/patch-vfs-fish.c21
-rw-r--r--misc/mc/files/patch-vfs-ftpfs-bug372752
-rw-r--r--misc/mc/files/patch-vfs-ftpfs.c131
-rw-r--r--misc/mc/files/patch-vfs-mcfs.c27
-rw-r--r--misc/mc/files/patch-vfs-mcserv.c11
-rw-r--r--misc/mc/files/patch-vfs-names.c28
-rw-r--r--misc/mc/files/patch-vfs-samba-lib-util.c35
-rw-r--r--misc/mc/files/patch-vfs-smbfs.c12
-rw-r--r--misc/mc/files/patch-vfs-tar.c49
-rw-r--r--misc/mc/files/patch-vfs-vfs.c12
-rw-r--r--misc/mc/pkg-plist39
54 files changed, 77 insertions, 4827 deletions
diff --git a/misc/mc/Makefile b/misc/mc/Makefile
index c6fb811aba8b..33632eac644c 100644
--- a/misc/mc/Makefile
+++ b/misc/mc/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= mc
-PORTVERSION= 4.6.0
-PORTREVISION= 15
+PORTVERSION= 4.6.1
CATEGORIES= misc shells
MASTER_SITES= ${MASTER_SITE_SUNSITE}
MASTER_SITE_SUBDIR= utils/file/managers/mc/
@@ -80,13 +79,13 @@ CONFIGURE_ARGS+=--without-subshell
.if defined(WITH_PERL_MODULES) || !(defined(WITHOUT_PERL_MODULES) || defined(MINIMAL))
.if ${PERL_LEVEL} < 500800
-RUN_DEPENDS= ${SITE_PERL}/File/Temp.pm:${PORTSDIR}/devel/p5-File-Temp
+RUN_DEPENDS+= ${SITE_PERL}/File/Temp.pm:${PORTSDIR}/devel/p5-File-Temp
.endif
.endif
MAN1= mc.1 mcedit.1 mcview.1
_MAN1= mc.1
-_MANLANG= es hu it pl ru.KOI8-R
+_MANLANG= es hu it pl sr
.for lang in ${_MANLANG}
_MANPAGES+= ${_MAN1:S%^%${MAN1PREFIX}/man/${lang}/man1/%}
.endfor
diff --git a/misc/mc/distinfo b/misc/mc/distinfo
index b7822caabde8..0e058db6c0ff 100644
--- a/misc/mc/distinfo
+++ b/misc/mc/distinfo
@@ -1,2 +1,2 @@
-MD5 (mc-4.6.0.tar.gz) = 70804dc9e2049e24f294ff7090a82a12
-SIZE (mc-4.6.0.tar.gz) = 3727676
+MD5 (mc-4.6.1.tar.gz) = 18b20db6e40480a53bac2870c56fc3c4
+SIZE (mc-4.6.1.tar.gz) = 3928370
diff --git a/misc/mc/files/patch-doc-ru-Makefile.in b/misc/mc/files/patch-doc-ru-Makefile.in
index cd07f512120f..54cb9728baa1 100644
--- a/misc/mc/files/patch-doc-ru-Makefile.in
+++ b/misc/mc/files/patch-doc-ru-Makefile.in
@@ -1,11 +1,11 @@
---- doc/ru/Makefile.in.orig Thu Feb 6 00:09:08 2003
-+++ doc/ru/Makefile.in Tue Jun 15 03:14:17 2004
-@@ -174,7 +174,7 @@
+--- doc/ru/Makefile.in.orig Tue Aug 2 21:12:42 2005
++++ doc/ru/Makefile.in Tue Aug 2 21:14:25 2005
+@@ -206,7 +206,7 @@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
-mandir = @mandir@/ru
+mandir = @mandir@/ru.KOI8-R
+ mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
- program_transform_name = @program_transform_name@
diff --git a/misc/mc/files/patch-edit-editcmd.c b/misc/mc/files/patch-edit-editcmd.c
deleted file mode 100644
index e2205fc617e9..000000000000
--- a/misc/mc/files/patch-edit-editcmd.c
+++ /dev/null
@@ -1,232 +0,0 @@
---- edit/editcmd.c.orig Thu Dec 19 19:01:34 2002
-+++ edit/editcmd.c Tue Jun 15 03:16:08 2004
-@@ -1546,51 +1546,56 @@
-
- #define is_digit(x) ((x) >= '0' && (x) <= '9')
-
--#define snprintf(v) { \
-+#define snprint(v) { \
- *p1++ = *p++; \
-- *p1++ = '%'; \
-- *p1++ = 'n'; \
- *p1 = '\0'; \
-- sprintf(s,q1,v,&n); \
-+ n = snprintf(s,e-s,q1,v); \
-+ if (n >= e - s) goto nospc; \
- s += n; \
- }
-
- /* this function uses the sprintf command to do a vprintf */
- /* it takes pointers to arguments instead of the arguments themselves */
--static int sprintf_p (char *str, const char *fmt,...)
-- __attribute__ ((format (printf, 2, 3)));
-+/* The return value is the number of bytes written excluding '\0'
-+ if successfull, -1 if the resulting string would be too long and
-+ -2 if the format string is errorneous. */
-+static int snprintf_p (char *str, size_t size, const char *fmt,...)
-+ __attribute__ ((format (printf, 3, 4)));
-
--static int sprintf_p (char *str, const char *fmt,...)
-+static int snprintf_p (char *str, size_t size, const char *fmt,...)
- {
- va_list ap;
-- int n;
-- char *q, *p, *s = str;
-- char q1[32];
-+ size_t n;
-+ char *q, *p, *s = str, *e = str + size;
-+ char q1[40];
- char *p1;
-+ int nargs = 0;
-
- va_start (ap, fmt);
- p = q = (char *) fmt;
-
- while ((p = strchr (p, '%'))) {
- n = p - q;
-- strncpy (s, q, n); /* copy stuff between format specifiers */
-+ if (n >= e - s)
-+ goto nospc;
-+ memcpy (s, q, n); /* copy stuff between format specifiers */
- s += n;
-- *s = 0;
- q = p;
- p1 = q1;
- *p1++ = *p++;
- if (*p == '%') {
- p++;
- *s++ = '%';
-+ if (s == e)
-+ goto nospc;
- q = p;
- continue;
- }
-- if (*p == 'n') {
-- p++;
--/* do nothing */
-- q = p;
-- continue;
-- }
-+ if (*p == 'n')
-+ goto err;
-+ /* We were passed only 16 arguments. */
-+ if (++nargs == 16)
-+ goto err;
- if (*p == '#')
- *p1++ = *p++;
- if (*p == '0')
-@@ -1604,8 +1609,10 @@
- strcpy (p1, MY_itoa (*va_arg (ap, int *))); /* replace field width with a number */
- p1 += strlen (p1);
- } else {
-- while (is_digit (*p))
-+ while (is_digit (*p) && p1 < q1 + 20)
- *p1++ = *p++;
-+ if (is_digit (*p))
-+ goto err;
- }
- if (*p == '.')
- *p1++ = *p++;
-@@ -1614,37 +1621,49 @@
- strcpy (p1, MY_itoa (*va_arg (ap, int *))); /* replace precision with a number */
- p1 += strlen (p1);
- } else {
-- while (is_digit (*p))
-+ while (is_digit (*p) && p1 < q1 + 32)
- *p1++ = *p++;
-+ if (is_digit (*p))
-+ goto err;
- }
- /* flags done, now get argument */
- if (*p == 's') {
-- snprintf (va_arg (ap, char *));
-+ snprint (va_arg (ap, char *));
- } else if (*p == 'h') {
- if (strchr ("diouxX", *p))
-- snprintf (*va_arg (ap, short *));
-+ snprint (*va_arg (ap, short *));
- } else if (*p == 'l') {
- *p1++ = *p++;
- if (strchr ("diouxX", *p))
-- snprintf (*va_arg (ap, long *));
-+ snprint (*va_arg (ap, long *));
- } else if (strchr ("cdiouxX", *p)) {
-- snprintf (*va_arg (ap, int *));
-+ snprint (*va_arg (ap, int *));
- } else if (*p == 'L') {
- *p1++ = *p++;
- if (strchr ("EefgG", *p))
-- snprintf (*va_arg (ap, double *)); /* should be long double */
-+ snprint (*va_arg (ap, double *)); /* should be long double */
- } else if (strchr ("EefgG", *p)) {
-- snprintf (*va_arg (ap, double *));
-+ snprint (*va_arg (ap, double *));
- } else if (strchr ("DOU", *p)) {
-- snprintf (*va_arg (ap, long *));
-+ snprint (*va_arg (ap, long *));
- } else if (*p == 'p') {
-- snprintf (*va_arg (ap, void **));
-- }
-+ snprint (*va_arg (ap, void **));
-+ } else
-+ goto err;
- q = p;
- }
- va_end (ap);
-- sprintf (s, q); /* print trailing leftover */
-- return s - str + strlen (s);
-+ n = strlen (q);
-+ if (n >= e - s)
-+ return -1;
-+ memcpy (s, q, n + 1);
-+ return s + n - str;
-+nospc:
-+ va_end (ap);
-+ return -1;
-+err:
-+ va_end (ap);
-+ return -2;
- }
-
- static void regexp_error (WEdit *edit)
-@@ -1737,7 +1756,7 @@
- for (i = 0; i < NUM_REPL_ARGS; i++) {
- if (s != (char *) 1 && *s) {
- ord = atoi (s);
-- if ((ord > 0) && (ord < NUM_REPL_ARGS))
-+ if ((ord > 0) && (ord <= NUM_REPL_ARGS))
- argord[i] = ord - 1;
- else
- argord[i] = i;
-@@ -1821,6 +1840,7 @@
- if (replace_yes) { /* delete then insert new */
- if (replace_scanf || replace_regexp) {
- char repl_str[MAX_REPL_LEN + 2];
-+ int ret = 0;
-
- /* we need to fill in sargs just like with scanf */
- if (replace_regexp) {
-@@ -1829,6 +1849,11 @@
- k < NUM_REPL_ARGS && pmatch[k].rm_eo >= 0;
- k++) {
- unsigned char *t;
-+
-+ if (pmatch[k].rm_eo - pmatch[k].rm_so > 255) {
-+ ret = -1;
-+ break;
-+ }
- t = (unsigned char *) &sargs[k - 1][0];
- for (j = 0;
- j < pmatch[k].rm_eo - pmatch[k].rm_so
-@@ -1849,7 +1874,9 @@
- for (; k <= NUM_REPL_ARGS; k++)
- sargs[k - 1][0] = 0;
- }
-- if (sprintf_p (repl_str, exp2, PRINTF_ARGS) >= 0) {
-+ if (!ret)
-+ ret = snprintf_p (repl_str, MAX_REPL_LEN + 2, exp2, PRINTF_ARGS);
-+ if (ret >= 0) {
- times_replaced++;
- while (i--)
- edit_delete (edit);
-@@ -1857,8 +1884,9 @@
- edit_insert (edit, repl_str[i]);
- } else {
- edit_error_dialog (_(" Replace "),
-- _
-- (" Error in replacement format string. "));
-+ ret == -2
-+ ? _(" Error in replacement format string. ")
-+ : _(" Replacement too long. "));
- replace_continue = 0;
- }
- } else {
-@@ -2711,7 +2739,7 @@
- int word_len = 0, i, num_compl = 0, max_len;
- long word_start = 0;
- char *bufpos;
-- char match_expr[MAX_REPL_LEN];
-+ char *match_expr;
- struct selection compl[MAX_WORD_COMPLETIONS]; /* completions */
-
- /* don't want to disturb another search */
-@@ -2728,9 +2756,7 @@
- /* prepare match expression */
- bufpos = &edit->buffers1[word_start >> S_EDIT_BUF_SIZE]
- [word_start & M_EDIT_BUF_SIZE];
-- strncpy (match_expr, bufpos, word_len);
-- match_expr[word_len] = '\0';
-- strcat (match_expr, "[a-zA-Z_0-9]+");
-+ match_expr = g_strdup_printf ("%.*s[a-zA-Z_0-9]+", word_len, bufpos);
-
- /* init search: backward, regexp, whole word, case sensitive */
- edit_set_search_parameters (0, 1, 1, 1, 1);
-@@ -2762,6 +2788,8 @@
- }
-
- /* release memory before return */
-+ g_free (match_expr);
-+
- for (i = 0; i < num_compl; i++)
- g_free (compl[i].text);
-
diff --git a/misc/mc/files/patch-edit-syntax.c b/misc/mc/files/patch-edit-syntax.c
deleted file mode 100644
index 72e067958343..000000000000
--- a/misc/mc/files/patch-edit-syntax.c
+++ /dev/null
@@ -1,218 +0,0 @@
---- edit/syntax.c.orig Mon Dec 16 00:55:53 2002
-+++ edit/syntax.c Tue Jun 15 03:15:09 2004
-@@ -99,7 +99,8 @@
- for (p = (unsigned char *) text, q = p + strlen ((char *) p); p < q; p++, i++) {
- switch (*p) {
- case '\001':
-- p++;
-+ if (++p > q)
-+ return -1;
- for (;;) {
- c = edit_get_byte (edit, i);
- if (!*p)
-@@ -114,7 +115,8 @@
- }
- break;
- case '\002':
-- p++;
-+ if (++p > q)
-+ return -1;
- j = 0;
- for (;;) {
- c = edit_get_byte (edit, i);
-@@ -150,12 +152,13 @@
- }
- break;
- case '\003':
-- p++;
-+ if (++p > q)
-+ return -1;
- c = -1;
- for (;; i++) {
- d = c;
- c = edit_get_byte (edit, i);
-- for (j = 0; p[j] != '\003'; j++)
-+ for (j = 0; p[j] != '\003' && p[j]; j++)
- if (c == p[j])
- goto found_char2;
- break;
-@@ -163,20 +166,23 @@
- j = c; /* dummy command */
- }
- i--;
-- while (*p != '\003')
-+ while (*p != '\003' && p <= q)
- p++;
-+ if (p > q)
-+ return -1;
- if (p[1] == d)
- i--;
- break;
- case '\004':
-- p++;
-+ if (++p > q)
-+ return -1;
- c = edit_get_byte (edit, i);
-- for (; *p != '\004'; p++)
-+ for (; *p != '\004' && *p; p++)
- if (c == *p)
- goto found_char3;
- return -1;
- found_char3:
-- for (; *p != '\004'; p++);
-+ for (; *p != '\004' && *p; p++);
- break;
- default:
- if (*p != edit_get_byte (edit, i))
-@@ -534,14 +540,14 @@
- if (!*fg)
- fg = 0;
- if (fg) {
-- strcpy (f, fg);
-+ g_strlcpy (f, fg, sizeof (f));
- p = strchr (f, '/');
- if (p)
- *p = '\0';
- fg = f;
- }
- if (bg) {
-- strcpy (b, bg);
-+ g_strlcpy (b, bg, sizeof (b));
- p = strchr (b, '/');
- if (p)
- *p = '\0';
-@@ -588,13 +594,16 @@
- int num_words = -1, num_contexts = -1;
- int argc, result = 0;
- int i, j;
-+ int alloc_contexts = MAX_CONTEXTS,
-+ alloc_words_per_context = MAX_WORDS_PER_CONTEXT,
-+ max_alloc_words_per_context = MAX_WORDS_PER_CONTEXT;
-
- args[0] = 0;
-
- strcpy (whole_left, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_01234567890");
- strcpy (whole_right, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_01234567890");
-
-- r = edit->rules = g_malloc0 (MAX_CONTEXTS * sizeof (struct context_rule *));
-+ r = edit->rules = g_malloc (alloc_contexts * sizeof (struct context_rule *));
-
- for (;;) {
- char **a;
-@@ -637,13 +646,13 @@
- check_a;
- if (!strcmp (*a, "left")) {
- a++;
-- strcpy (whole_left, *a);
-+ g_strlcpy (whole_left, *a, sizeof (whole_left));
- } else if (!strcmp (*a, "right")) {
- a++;
-- strcpy (whole_right, *a);
-+ g_strlcpy (whole_right, *a, sizeof (whole_right));
- } else {
-- strcpy (whole_left, *a);
-- strcpy (whole_right, *a);
-+ g_strlcpy (whole_left, *a, sizeof (whole_left));
-+ g_strlcpy (whole_right, *a, sizeof (whole_right));
- }
- a++;
- check_not_a;
-@@ -659,6 +668,8 @@
- c->right = g_strdup (" ");
- num_contexts = 0;
- } else {
-+ /* Terminate previous context. */
-+ r[num_contexts - 1]->keyword[num_words] = NULL;
- c = r[num_contexts] = g_malloc0 (sizeof (struct context_rule));
- if (!strcmp (*a, "exclusive")) {
- a++;
-@@ -693,10 +704,7 @@
- c->first_left = *c->left;
- c->first_right = *c->right;
- }
-- c->keyword = g_malloc0 (MAX_WORDS_PER_CONTEXT * sizeof (struct key_word *));
--#if 0
-- c->max_words = MAX_WORDS_PER_CONTEXT;
--#endif
-+ c->keyword = g_malloc (alloc_words_per_context * sizeof (struct key_word *));
- num_words = 1;
- c->keyword[0] = g_malloc0 (sizeof (struct key_word));
- fg = *a;
-@@ -705,12 +713,20 @@
- bg = *a;
- if (*a)
- a++;
-- strcpy (last_fg, fg ? fg : "");
-- strcpy (last_bg, bg ? bg : "");
-+ g_strlcpy (last_fg, fg ? fg : "", sizeof (last_fg));
-+ g_strlcpy (last_bg, bg ? bg : "", sizeof (last_bg));
- c->keyword[0]->color = this_try_alloc_color_pair (fg, bg);
- c->keyword[0]->keyword = g_strdup (" ");
- check_not_a;
-- num_contexts++;
-+
-+ alloc_words_per_context = MAX_WORDS_PER_CONTEXT;
-+ if (++num_contexts >= alloc_contexts) {
-+ struct context_rule **tmp;
-+
-+ alloc_contexts += 128;
-+ tmp = g_realloc (r, alloc_contexts * sizeof (struct context_rule *));
-+ r = tmp;
-+ }
- } else if (!strcmp (args[0], "spellcheck")) {
- if (!c) {
- result = line;
-@@ -757,7 +773,18 @@
- bg = last_bg;
- k->color = this_try_alloc_color_pair (fg, bg);
- check_not_a;
-- num_words++;
-+
-+ if (++num_words >= alloc_words_per_context) {
-+ struct key_word **tmp;
-+
-+ alloc_words_per_context += 1024;
-+
-+ if (alloc_words_per_context > max_alloc_words_per_context)
-+ max_alloc_words_per_context = alloc_words_per_context;
-+
-+ tmp = g_realloc (c->keyword, alloc_words_per_context * sizeof (struct key_word *));
-+ c->keyword = tmp;
-+ }
- } else if (*(args[0]) == '#') {
- /* do nothing for comment */
- } else if (!strcmp (args[0], "file")) {
-@@ -771,6 +798,12 @@
- free_args (args);
- syntax_g_free (l);
-
-+ /* Terminate context array. */
-+ if (num_contexts > 0) {
-+ r[num_contexts - 1]->keyword[num_words] = NULL;
-+ r[num_contexts] = NULL;
-+ }
-+
- if (!edit->rules[0])
- syntax_g_free (edit->rules);
-
-@@ -783,7 +816,10 @@
- }
-
- {
-- char first_chars[MAX_WORDS_PER_CONTEXT + 2], *p;
-+ char *first_chars, *p;
-+
-+ first_chars = g_malloc (max_alloc_words_per_context + 2);
-+
- for (i = 0; edit->rules[i]; i++) {
- c = edit->rules[i];
- p = first_chars;
-@@ -794,6 +830,8 @@
- c->keyword_first_chars = g_malloc0 (strlen (first_chars) + 2);
- strcpy (c->keyword_first_chars, first_chars);
- }
-+
-+ g_free (first_chars);
- }
-
- return result;
diff --git a/misc/mc/files/patch-lib-cedit.menu b/misc/mc/files/patch-lib-cedit.menu
deleted file mode 100644
index b4f221ea93d5..000000000000
--- a/misc/mc/files/patch-lib-cedit.menu
+++ /dev/null
@@ -1,11 +0,0 @@
---- lib/cedit.menu.orig Sun Aug 25 00:39:08 2002
-+++ lib/cedit.menu Tue Jun 15 03:15:09 2004
-@@ -449,7 +449,7 @@
-
- m view `man'
- MAN=%{Enter name of man:}
-- TMPFILE=/tmp/mcview.$MAN.$$
-+ TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/mcview.$MAN.$$` || exit 1
- man -Pcat $MAN >$TMPFILE
- mcview $TMPFILE
- rm -f $TMPFILE
diff --git a/misc/mc/files/patch-lib-mc.ext.in b/misc/mc/files/patch-lib-mc.ext.in
deleted file mode 100644
index 55ae9f40c0b5..000000000000
--- a/misc/mc/files/patch-lib-mc.ext.in
+++ /dev/null
@@ -1,11 +0,0 @@
---- lib/mc.ext.in.orig Sun Jun 27 00:55:29 2004
-+++ lib/mc.ext.in Sun Jun 27 00:56:01 2004
-@@ -388,7 +388,7 @@
- # Open=%cd %p#utar
- View=%view{ascii} bzip -dc %f 2>/dev/null | tar tvvf -
-
--regex/\.tar\.bz2$
-+regex/\.t(bz|ar\.bz2)$
- Open=%cd %p#utar
- View=%view{ascii} bzip2 -dc %f 2>/dev/null | tar tvvf -
-
diff --git a/misc/mc/files/patch-lib-mc.menu b/misc/mc/files/patch-lib-mc.menu
deleted file mode 100644
index 375b8117e5ce..000000000000
--- a/misc/mc/files/patch-lib-mc.menu
+++ /dev/null
@@ -1,37 +0,0 @@
---- lib/mc.menu.orig Sun Dec 8 07:12:19 2002
-+++ lib/mc.menu Tue Jun 15 03:15:09 2004
-@@ -14,9 +14,10 @@
-
-
- 0 Edit a bug report and send it to root
-- ${EDITOR-vi} /tmp/mail.$$
-- test -r /tmp/mail.$$ && mail root < /tmp/mail.$$
-- rm -f /tmp/mail.$$
-+ I=`mktemp ${MC_TMPDIR:-/tmp}/mail.XXXXXX` || exit 1
-+ ${EDITOR-vi} $I
-+ test -r $I && mail root < $I
-+ rm -f $I
-
- =+ f \.1$ | f \.3$ | f \.4$ | f \.5$ | f \.6$ | f \.7$ | f \.8$ | f \.man$ & t r
- 1 Display the file with roff -man
-@@ -112,8 +113,9 @@
- CHECK=`awk '{print $1 ; exit}' %f` 2>/dev/null
- case $CHECK in
- Newsgroups:|Path:)
-- cp %f /tmp/%f.$$ && sed '/^'"$CHECK"' /,/^$/d' /tmp/%f.$$ > %f
-- [ "$?" = "0" ] && rm /tmp/%f.$$
-+ I=`mktemp ${MC_TMPDIR:-/tmp}/news.XXXXXX` || exit 1
-+ cp %f $I && sed '/^'"$CHECK"' /,/^$/d' $I > %f
-+ [ "$?" = "0" ] && rm $I
- echo %f: header removed
- ;;
- *)
-@@ -126,7 +128,7 @@
- set %t
- while [ -n "$1" ]; do
- CHECK=`awk '{print $1 ; exit}' $1` 2>/dev/null
-- WFILE=/tmp/${1}.$$
-+ WFILE=`mktemp ${MC_TMPDIR:-/tmp}/news.XXXXXX` || exit 1
- case $CHECK in
- Newsgroups:|Path:)
- cp $1 $WFILE && sed '/^'"$CHECK"' /,/^$/d' $WFILE > $1
diff --git a/misc/mc/files/patch-mc.1 b/misc/mc/files/patch-mc.1
deleted file mode 100644
index 53d1715bc516..000000000000
--- a/misc/mc/files/patch-mc.1
+++ /dev/null
@@ -1,75 +0,0 @@
---- doc/es/mc.1.in.orig Wed Feb 5 21:54:31 2003
-+++ doc/es/mc.1.in Tue Jun 15 03:15:09 2004
-@@ -1361,8 +1361,10 @@
- od -c %f
-
- B Edita un informe de errores y lo envía al superusuario
-- vi /tmp/mail.$$
-- mail -s "Error Midnight Commander" root < /tmp/mail.$$
-+ I=`mktemp ${MC_TMPDIR:-/tmp}/mail.XXXXXX` || exit 1
-+ vi $I
-+ mail -s "Error Midnight Commander" root < $I
-+ rm -f $I
-
- M Lee al correo
- emacs -f rmail
---- doc/hu/mc.1.in.orig Thu Jan 16 16:30:55 2003
-+++ doc/hu/mc.1.in Tue Jun 15 03:15:09 2004
-@@ -1381,8 +1381,10 @@
- od -c %f
-
- B A hiba leírás szerkesztése és elküldése a root-nak
-- vi /tmp/mail.$$
-- mail -s "Midnight Commander bug" root < /tmp/mail.$$
-+ I=`mktemp ${MC_TMPDIR:-/tmp}/mail.XXXXXX` || exit 1
-+ vi $I
-+ mail -s "Midnight Commander bug" root < $I
-+ rm -f $I
-
- M Levél olvasás
- emacs -f rmail
---- doc/it/mc.1.in.orig Sun Jan 19 23:11:06 2003
-+++ doc/it/mc.1.in Tue Jun 15 03:15:09 2004
-@@ -1379,8 +1379,10 @@
- od -c %f
-
- B Modifica un rapporto bachi e lo spedisce a root
-- vi /tmp/mail.$$
-- mail -s "Midnight Commander bug" root < /tmp/mail.$$
-+ I=`mktemp ${MC_TMPDIR:-/tmp}/mail.XXXXXX` || exit 1
-+ vi $I
-+ mail -s "Midnight Commander bug" root < $I
-+ rm -f $I
-
- M Legge la posta
- emacs -f rmail
---- doc/mc.1.in.orig Wed Feb 5 21:54:31 2003
-+++ doc/mc.1.in Tue Jun 15 03:15:09 2004
-@@ -1385,8 +1385,10 @@
- od -c %f
-
- B Edit a bug report and send it to root
-- vi /tmp/mail.$$
-- mail -s "Midnight Commander bug" root < /tmp/mail.$$
-+ I=`mktemp ${MC_TMPDIR:-/tmp}/mail.XXXXXX` || exit 1
-+ vi $I
-+ mail -s "Midnight Commander bug" root < $I
-+ rm -f $I
-
- M Read mail
- emacs -f rmail
---- doc/ru/mc.1.in.orig Tue Feb 4 03:59:14 2003
-+++ doc/ru/mc.1.in Tue Jun 15 03:15:09 2004
-@@ -1557,8 +1557,10 @@
- od -c %f
-
- B Edit a bug report and send it to root
-- vi /tmp/mail.$$
-- mail -s "Midnight Commander bug" root < /tmp/mail.$$
-+ I=`mktemp ${MC_TMPDIR:-/tmp}/mail.XXXXXX` || exit 1
-+ vi $I
-+ mail -s "Midnight Commander bug" root < $I
-+ rm -f $I
-
- M Read mail
- emacs -f rmail
diff --git a/misc/mc/files/patch-po b/misc/mc/files/patch-po
deleted file mode 100644
index dab6d924887f..000000000000
--- a/misc/mc/files/patch-po
+++ /dev/null
@@ -1,1021 +0,0 @@
---- po/az.po.orig Thu Feb 6 00:09:44 2003
-+++ po/az.po Tue Jun 15 03:15:09 2004
-@@ -2411,13 +2411,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " ( %d blok )"
-+msgid " (%ld block)"
-+msgstr " ( %ld blok )"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " ( %d blok )"
-+msgid " (%ld blocks)"
-+msgstr " ( %ld blok )"
-
- #: src/info.c:179
- #, c-format
-@@ -3656,8 +3656,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/be.po.orig Thu Feb 6 00:09:44 2003
-+++ po/be.po Tue Jun 15 03:15:09 2004
-@@ -2404,13 +2404,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d áë¸ęŕ˘)"
-+msgid " (%ld block)"
-+msgstr " (%ld áë¸ęŕ˘)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d áë¸ęŕ˘)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld áë¸ęŕ˘)"
-
- #: src/info.c:179
- #, c-format
-@@ -3630,8 +3630,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Çđóő 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Çđóő 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/bg.po.orig Thu Feb 6 00:09:45 2003
-+++ po/bg.po Tue Jun 15 03:15:09 2004
-@@ -2406,13 +2406,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d йНОк)"
-+msgid " (%ld block)"
-+msgstr " (%ld йНОк)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d йНОка)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld йНОка)"
-
- #: src/info.c:179
- #, c-format
-@@ -3649,8 +3649,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Отместване 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Отместване 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/ca.po.orig Thu Feb 6 00:09:45 2003
-+++ po/ca.po Tue Jun 15 03:15:09 2004
-@@ -2416,13 +2416,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d bloc)"
-+msgid " (%ld block)"
-+msgstr " (%ld bloc)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blocs)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blocs)"
-
- #: src/info.c:179
- #, c-format
-@@ -3670,8 +3670,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Desplaçament 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Desplaçament 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/cs.po.orig Thu Feb 6 00:09:45 2003
-+++ po/cs.po Tue Jun 15 03:15:09 2004
-@@ -2407,13 +2407,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blok)"
-+msgid " (%ld block)"
-+msgstr " (%ld blok)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d bloků)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld bloků)"
-
- #: src/info.c:179
- #, c-format
-@@ -3643,8 +3643,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Posun 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Posun 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/da.po.orig Thu Feb 6 00:09:46 2003
-+++ po/da.po Tue Jun 15 03:15:09 2004
-@@ -1,8 +1,7 @@
--# Danish translation of Midnight Commander
--# Copyright (C) 1998 Free Software Foundation, Inc.
--# Kenneth Christiansen <kenneth@ripen.dk>, 1999-2000
--# Birger Langkjer <birger.langkjer@image.dk>, 1999.
--# Keld Simonsen <keld@dkuug.dk>, 2000.
-+# Danish translation of Midnight Commander Copyright (C) 1998 Free Software
-+# Foundation, Inc. Kenneth Christiansen <kenneth@ripen.dk>, 1999-2000 Birger
-+# Langkjer <birger.langkjer@image.dk>, 1999. Keld Simonsen <keld@dkuug.dk>,
-+# 2000.
- #
- # Note: MC bestĺr af konsol- (mc) og gtkdel (gmc)
- # Genveje i konsolen er '&+stort bogstav', resten
-@@ -2416,13 +2415,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blok)"
-+msgid " (%ld block)"
-+msgstr " (%ld blok)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blokke)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blokke)"
-
- #: src/info.c:179
- #, c-format
-@@ -3661,8 +3660,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Afstand 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Afstand 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/de.po.orig Thu Feb 6 00:09:46 2003
-+++ po/de.po Tue Jun 15 03:15:09 2004
-@@ -2415,13 +2415,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d Block)"
-+msgid " (%ld block)"
-+msgstr " (%ld Block)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr "(%d Blöcke)"
-+msgid " (%ld blocks)"
-+msgstr "(%ld Blöcke)"
-
- #: src/info.c:179
- #, c-format
-@@ -3664,8 +3664,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/el.po.orig Thu Feb 6 00:09:46 2003
-+++ po/el.po Tue Jun 15 03:15:09 2004
-@@ -2304,12 +2304,12 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
-+msgid " (%ld block)"
- msgstr ""
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
-+msgid " (%ld blocks)"
- msgstr ""
-
- #: src/info.c:179
-@@ -3480,7 +3480,7 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
- msgstr ""
-
- #: src/view.c:826
---- po/es.po.orig Thu Feb 6 00:09:46 2003
-+++ po/es.po Tue Jun 15 03:15:09 2004
-@@ -2403,13 +2403,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d bloque)"
-+msgid " (%ld block)"
-+msgstr " (%ld bloque)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d bloques)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld bloques)"
-
- #: src/info.c:179
- #, c-format
-@@ -3638,8 +3638,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/eu.po.orig Thu Feb 6 00:09:46 2003
-+++ po/eu.po Tue Jun 15 03:15:09 2004
-@@ -2415,13 +2415,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d bloke)"
-+msgid " (%ld block)"
-+msgstr " (%ld bloke)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr "(%d bloke)"
-+msgid " (%ld blocks)"
-+msgstr "(%ld bloke)"
-
- #: src/info.c:179
- #, c-format
-@@ -3665,8 +3665,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Desplazamendua 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Desplazamendua 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/fi.po.orig Thu Feb 6 00:09:47 2003
-+++ po/fi.po Tue Jun 15 03:15:09 2004
-@@ -2364,12 +2364,12 @@
-
- #: src/info.c:173
- #, fuzzy, c-format
--msgid " (%d block)"
-+msgid " (%ld block)"
- msgstr " Järjestä valinta "
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
-+msgid " (%ld blocks)"
- msgstr ""
-
- #: src/info.c:179
-@@ -3556,8 +3556,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Siirros 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Siirros 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/fr.po.orig Thu Feb 6 00:09:47 2003
-+++ po/fr.po Tue Jun 15 03:15:09 2004
-@@ -2411,13 +2411,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d bloc)"
-+msgid " (%ld block)"
-+msgstr " (%ld bloc)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blocs)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blocs)"
-
- #: src/info.c:179
- #, c-format
-@@ -3663,8 +3663,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Décalage 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Décalage 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/hu.po.orig Thu Feb 6 00:09:47 2003
-+++ po/hu.po Tue Jun 15 03:15:09 2004
-@@ -2444,13 +2444,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blokk)"
-+msgid " (%ld block)"
-+msgstr " (%ld blokk)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blokk)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blokk)"
-
- #: src/info.c:179
- #, c-format
-@@ -3685,8 +3685,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Pozíció: 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Pozíció: 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/it.po.orig Thu Feb 6 00:09:47 2003
-+++ po/it.po Tue Jun 15 03:15:09 2004
-@@ -2409,13 +2409,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blocchi)"
-+msgid " (%ld block)"
-+msgstr " (%ld blocchi)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blocchi)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blocchi)"
-
- #: src/info.c:179
- #, c-format
-@@ -3644,8 +3644,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset: 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset: 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/ja.po.orig Thu Feb 6 00:09:48 2003
-+++ po/ja.po Tue Jun 15 03:15:09 2004
-@@ -2410,13 +2410,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%dĽÖĽíĽĂĽŻ)"
-+msgid " (%ld block)"
-+msgstr " (%ldĽÖĽíĽĂĽŻ)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%dĽÖĽíĽĂĽŻ)"
-+msgid " (%ld blocks)"
-+msgstr " (%ldĽÖĽíĽĂĽŻ)"
-
- #: src/info.c:179
- #, c-format
-@@ -3654,8 +3654,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "ĽŞĽŐĽťĽĂĽČ 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "ĽŞĽŐĽťĽĂĽČ 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/ko.po.orig Thu Feb 6 00:09:48 2003
-+++ po/ko.po Tue Jun 15 03:15:09 2004
-@@ -2399,13 +2399,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d ą¸żŞ)"
-+msgid " (%ld block)"
-+msgstr " (%ld ą¸żŞ)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d ą¸żŞ)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld ą¸żŞ)"
-
- #: src/info.c:179
- #, c-format
-@@ -3631,8 +3631,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "żÉźÂ 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "żÉźÂ 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/lv.po.orig Thu Feb 6 00:09:48 2003
-+++ po/lv.po Tue Jun 15 03:15:09 2004
-@@ -2411,13 +2411,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d bloks)"
-+msgid " (%ld block)"
-+msgstr " (%ld bloks)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d bloki)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld bloki)"
-
- #: src/info.c:179
- #, c-format
-@@ -3661,8 +3661,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Nobîde 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Nobîde 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/nl.po.orig Thu Feb 6 00:09:48 2003
-+++ po/nl.po Tue Jun 15 03:15:09 2004
-@@ -2406,13 +2406,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blokken)"
-+msgid " (%ld block)"
-+msgstr " (%ld blokken)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr "(%d blokken)"
-+msgid " (%ld blocks)"
-+msgstr "(%ld blokken)"
-
- #: src/info.c:179
- #, c-format
-@@ -3640,8 +3640,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/no.po.orig Thu Feb 6 00:09:49 2003
-+++ po/no.po Tue Jun 15 03:15:09 2004
-@@ -2405,13 +2405,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blokk)"
-+msgid " (%ld block)"
-+msgstr " (%ld blokk)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blokker)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blokker)"
-
- #: src/info.c:179
- #, c-format
-@@ -3640,8 +3640,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/pl.po.orig Thu Feb 6 00:09:49 2003
-+++ po/pl.po Tue Jun 15 03:15:09 2004
-@@ -2410,13 +2410,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blok)"
-+msgid " (%ld block)"
-+msgstr " (%ld blok)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d bloków)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld bloków)"
-
- #: src/info.c:179
- #, c-format
-@@ -3642,8 +3642,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Przesunięcie 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Przesunięcie 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/pt.po.orig Thu Feb 6 00:09:49 2003
-+++ po/pt.po Tue Jun 15 03:15:09 2004
-@@ -2410,13 +2410,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d bloco)"
-+msgid " (%ld block)"
-+msgstr " (%ld bloco)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blocos)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blocos)"
-
- #: src/info.c:179
- #, c-format
-@@ -3657,8 +3657,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/pt_BR.po.orig Thu Feb 6 00:09:49 2003
-+++ po/pt_BR.po Tue Jun 15 03:15:09 2004
-@@ -2429,13 +2429,13 @@
-
- #: src/info.c:173
- #, fuzzy, c-format
--msgid " (%d block)"
--msgstr " (%d blocos)"
-+msgid " (%ld block)"
-+msgstr " (%ld blocos)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blocos)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blocos)"
-
- #: src/info.c:179
- #, c-format
-@@ -3691,8 +3691,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Deslocamento 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Deslocamento 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/ro.po.orig Thu Feb 6 00:09:50 2003
-+++ po/ro.po Tue Jun 15 03:15:09 2004
-@@ -2403,13 +2403,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blocuri)"
-+msgid " (%ld block)"
-+msgstr " (%ld blocuri)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blocuri)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blocuri)"
-
- #: src/info.c:179
- #, c-format
-@@ -3638,8 +3638,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/ru.po.orig Thu Feb 6 00:09:50 2003
-+++ po/ru.po Tue Jun 15 03:15:09 2004
-@@ -2411,13 +2411,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d ÂĚĎË)"
-+msgid " (%ld block)"
-+msgstr " (%ld ÂĚĎË)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d ÂĚĎËĎ×)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld ÂĚĎËĎ×)"
-
- #: src/info.c:179
- #, c-format
-@@ -3644,8 +3644,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "óÍĹÝĹÎÉĹ 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "óÍĹÝĹÎÉĹ 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/sk.po.orig Thu Feb 6 00:09:50 2003
-+++ po/sk.po Tue Jun 15 03:15:09 2004
-@@ -2402,13 +2402,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blok)"
-+msgid " (%ld block)"
-+msgstr " (%ld blok)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blokov)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blokov)"
-
- #: src/info.c:179
- #, c-format
-@@ -3634,8 +3634,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/sl.po.orig Thu Feb 6 00:09:50 2003
-+++ po/sl.po Tue Jun 15 03:15:09 2004
-@@ -2405,13 +2405,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blokov)"
-+msgid " (%ld block)"
-+msgstr " (%ld blokov)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blokov)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blokov)"
-
- #: src/info.c:179
- #, c-format
-@@ -3640,8 +3640,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/sv.po.orig Thu Feb 6 00:09:51 2003
-+++ po/sv.po Tue Jun 15 03:15:09 2004
-@@ -2434,13 +2434,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d block)"
-+msgid " (%ld block)"
-+msgstr " (%ld block)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d block)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld block)"
-
- #: src/info.c:179
- #, c-format
-@@ -3678,8 +3678,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- # svängelska?
- #: src/view.c:826
---- po/ta.po.orig Thu Feb 6 00:09:51 2003
-+++ po/ta.po Tue Jun 15 03:15:09 2004
-@@ -2307,12 +2307,12 @@
-
- #: src/info.c:173
- #, fuzzy, c-format
--msgid " (%d block)"
-+msgid " (%ld block)"
- msgstr " ŚžĄĚž˘¨Â ĹĄ˘¨şÂĄěĚ "
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
-+msgid " (%ld blocks)"
- msgstr ""
-
- #: src/info.c:179
-@@ -3483,7 +3483,7 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
- msgstr ""
-
- #: src/view.c:826
---- po/tr.po.orig Thu Feb 6 00:09:51 2003
-+++ po/tr.po Tue Jun 15 03:15:09 2004
-@@ -2409,13 +2409,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blok)"
-+msgid " (%ld block)"
-+msgstr " (%ld blok)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d blok)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld blok)"
-
- #: src/info.c:179
- #, c-format
-@@ -3655,8 +3655,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "Offset 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/uk.po.orig Thu Feb 6 00:09:51 2003
-+++ po/uk.po Tue Jun 15 03:15:09 2004
-@@ -2399,13 +2399,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d ÂĚĎË)"
-+msgid " (%ld block)"
-+msgstr " (%ld ÂĚĎË)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d ÂĚĎËŚ×)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld ÂĚĎËŚ×)"
-
- #: src/info.c:179
- #, c-format
-@@ -3632,8 +3632,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "úÍŚÝĹÎÎŃ 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "úÍŚÝĹÎÎŃ 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/wa.po.orig Thu Feb 6 00:09:52 2003
-+++ po/wa.po Tue Jun 15 03:15:09 2004
-@@ -2425,13 +2425,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d blok)"
-+msgid " (%ld block)"
-+msgstr " (%ld blok)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d bloks)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld bloks)"
-
- #: src/info.c:179
- #, c-format
-@@ -3650,7 +3650,7 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
-+msgid "Offset 0x%08lx"
- msgstr ""
-
- #: src/view.c:826
---- po/zh_CN.po.orig Thu Feb 6 00:09:52 2003
-+++ po/zh_CN.po Tue Jun 15 03:15:09 2004
-@@ -2396,13 +2396,13 @@
-
- #: src/info.c:173
- #, c-format
--msgid " (%d block)"
--msgstr " (%d 个块)"
-+msgid " (%ld block)"
-+msgstr " (%ld 个块)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d 个块)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld 个块)"
-
- #: src/info.c:179
- #, c-format
-@@ -3629,8 +3629,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "偏移 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "偏移 0x%08lx"
-
- #: src/view.c:826
- #, c-format
---- po/zh_TW.po.orig Thu Feb 6 00:09:52 2003
-+++ po/zh_TW.po Tue Jun 15 03:15:09 2004
-@@ -2407,13 +2407,13 @@
-
- #: src/info.c:173
- #, fuzzy, c-format
--msgid " (%d block)"
--msgstr " (%d ­Ó°Ďśô)"
-+msgid " (%ld block)"
-+msgstr " (%ld ­Ó°Ďśô)"
-
- #: src/info.c:173
- #, c-format
--msgid " (%d blocks)"
--msgstr " (%d ­Ó°Ďśô)"
-+msgid " (%ld blocks)"
-+msgstr " (%ld ­Ó°Ďśô)"
-
- #: src/info.c:179
- #, c-format
-@@ -3655,8 +3655,8 @@
-
- #: src/view.c:824
- #, c-format
--msgid "Offset 0x%08x"
--msgstr "°ž˛ž­Č 0x%08x"
-+msgid "Offset 0x%08lx"
-+msgstr "°ž˛ž­Č 0x%08lx"
-
- #: src/view.c:826
- #, c-format
diff --git a/misc/mc/files/patch-slang-sltermin.c b/misc/mc/files/patch-slang-sltermin.c
deleted file mode 100644
index 73b194aea903..000000000000
--- a/misc/mc/files/patch-slang-sltermin.c
+++ /dev/null
@@ -1,18 +0,0 @@
---- slang/sltermin.c.orig Mon Oct 7 18:08:16 2002
-+++ slang/sltermin.c Tue Jun 15 03:15:09 2004
-@@ -267,9 +267,12 @@
-
- if (NULL != (home = getenv ("HOME")))
- {
-- strncpy (home_ti, home, sizeof (home_ti) - 11);
-- home_ti [sizeof(home_ti) - 11] = 0;
-- strcat (home_ti, "/.terminfo");
-+ size_t len = strlen (home);
-+
-+ if (len > sizeof (home_ti) - sizeof ("/.terminfo"))
-+ len = sizeof (home_ti) - sizeof ("/.terminfo");
-+ memcpy (home_ti, home, len);
-+ memcpy (home_ti + len, "/.terminfo", sizeof ("/.terminfo"));
- Terminfo_Dirs [0] = home_ti;
- }
-
diff --git a/misc/mc/files/patch-src-background.c b/misc/mc/files/patch-src-background.c
deleted file mode 100644
index 95e20450fdbe..000000000000
--- a/misc/mc/files/patch-src-background.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/background.c.orig Sat Sep 28 12:10:29 2002
-+++ src/background.c Tue Jun 15 03:17:55 2004
-@@ -142,7 +142,7 @@
- close (1);
- close (2);
-
-- if ((nullfd = open ("/dev/null", O_RDONLY)) != -1){
-+ if ((nullfd = open ("/dev/null", O_RDWR)) != -1){
- while (dup2 (nullfd, 0) == -1 && errno == EINTR)
- ;
- while (dup2 (nullfd, 1) == -1 && errno == EINTR)
diff --git a/misc/mc/files/patch-src-cmd.c b/misc/mc/files/patch-src-cmd.c
deleted file mode 100644
index f92c6ca97c31..000000000000
--- a/misc/mc/files/patch-src-cmd.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/cmd.c.orig Wed Feb 5 21:54:33 2003
-+++ src/cmd.c Tue Jun 15 03:15:09 2004
-@@ -1132,7 +1132,7 @@
-
- q = g_strdup_printf (_(" Symlink `%s\' points to: "), name_trunc (p, 32));
-
-- i = readlink (p, buffer, MC_MAXPATHLEN);
-+ i = readlink (p, buffer, MC_MAXPATHLEN - 1);
- if (i > 0) {
- buffer [i] = 0;
- dest = input_expand_dialog (_(" Edit symlink "), q, buffer);
diff --git a/misc/mc/files/patch-src-command.c b/misc/mc/files/patch-src-command.c
deleted file mode 100644
index 1dc7e17c8f64..000000000000
--- a/misc/mc/files/patch-src-command.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/command.c.orig Thu Nov 14 13:25:19 2002
-+++ src/command.c Tue Jun 15 03:15:09 2004
-@@ -258,7 +258,7 @@
- WInput *
- command_new (int y, int x, int cols)
- {
-- WInput *cmd = g_new (WInput, 1);
-+ WInput *cmd;
-
- cmd = input_new (y, x, DEFAULT_COLOR, cols, "", "cmdline");
-
diff --git a/misc/mc/files/patch-src-complete.c b/misc/mc/files/patch-src-complete.c
deleted file mode 100644
index 6bcb16098ecd..000000000000
--- a/misc/mc/files/patch-src-complete.c
+++ /dev/null
@@ -1,30 +0,0 @@
---- src/complete.c.orig Wed Nov 13 08:56:41 2002
-+++ src/complete.c Tue Jun 15 03:15:09 2004
-@@ -270,7 +270,7 @@
- *temp = '$';
- if (isbrace)
- temp [1] = '{';
-- strncpy (temp + 1 + isbrace, *env_p, p - *env_p);
-+ memcpy (temp + 1 + isbrace, *env_p, p - *env_p);
- if (isbrace)
- strcpy (temp + 2 + (p - *env_p), "}");
- else
-@@ -605,8 +605,7 @@
- matches = i;
- match_list [matches + 1] = NULL;
- match_list[0] = g_malloc (low + 1);
-- strncpy (match_list[0], match_list[1], low);
-- match_list[0][low] = 0;
-+ g_strlcpy (match_list[0], match_list[1], low + 1);
- }
- } else { /* There were no matches. */
- g_free (match_list);
-@@ -806,7 +805,7 @@
- *(p++) = *(q++);
- *p = 0;
- }
-- strncpy (in->buffer + start, text, len - start + end);
-+ memcpy (in->buffer + start, text, len - start + end);
- in->point += len;
- update_input (in, 1);
- end += len;
diff --git a/misc/mc/files/patch-src-cons.handler.c b/misc/mc/files/patch-src-cons.handler.c
deleted file mode 100644
index ae2e1b659a59..000000000000
--- a/misc/mc/files/patch-src-cons.handler.c
+++ /dev/null
@@ -1,725 +0,0 @@
---- src/cons.handler.c.orig Mon Sep 23 13:43:23 2002
-+++ src/cons.handler.c Tue Jun 15 03:14:17 2004
-@@ -15,8 +15,6 @@
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
--/* The cons saver can't have a pid of 1, used to prevent bunches of */
--/*#ifdef linux */
- #include <config.h>
-
- #ifdef HAVE_UNISTD_H
-@@ -24,6 +22,21 @@
- #endif
- #include <sys/types.h>
- #include <signal.h>
-+#include <stdio.h>
-+
-+#ifdef SCO_FLAVOR
-+#include <sys/types.h>
-+#include <sys/vid.h>
-+#include <sys/console.h>
-+#include <sys/vtkd.h>
-+#include <memory.h>
-+#include <signal.h>
-+#endif /* SCO_FLAVOR */
-+
-+#ifdef __FreeBSD__
-+#include <sys/consio.h>
-+#include <sys/ioctl.h>
-+#endif /* __FreeBSD__ */
-
- #include "global.h"
- #include "tty.h"
-@@ -31,30 +44,28 @@
-
- signed char console_flag = 0;
-
--#if defined(linux) || defined(__linux__)
--#include "main.h"
-+#ifdef __linux__
-+
-+/* The cons saver can't have a pid of 1, used to prevent bunches of
-+ * #ifdef linux */
-
--int cons_saver_pid = 1;
--static int pipefd1 [2] = {-1, -1}, pipefd2 [2] = {-1, -1};
-+int cons_saver_pid = 1;
-+static int pipefd1[2] = { -1, -1 };
-+static int pipefd2[2] = { -1, -1 };
-
--void show_console_contents (int starty, unsigned char begin_line, unsigned char end_line)
-+static void
-+show_console_contents_linux (int starty, unsigned char begin_line,
-+ unsigned char end_line)
- {
- unsigned char message = 0;
- unsigned short bytes = 0;
- int i;
-
-- standend ();
--
-- if (look_for_rxvt_extensions ()) {
-- show_rxvt_contents (starty, begin_line, end_line);
-- return;
-- }
--
- /* Is tty console? */
- if (!console_flag)
- return;
- /* Paranoid: Is the cons.saver still running? */
-- if (cons_saver_pid < 1 || kill (cons_saver_pid, SIGCONT)){
-+ if (cons_saver_pid < 1 || kill (cons_saver_pid, SIGCONT)) {
- cons_saver_pid = 0;
- console_flag = 0;
- return;
-@@ -75,9 +86,9 @@
- read (pipefd2[0], &bytes, 2);
-
- /* Read the bytes and output them */
-- for (i = 0; i < bytes; i++){
-+ for (i = 0; i < bytes; i++) {
- if ((i % COLS) == 0)
-- move (starty+(i/COLS), 0);
-+ move (starty + (i / COLS), 0);
- read (pipefd2[0], &message, 1);
- addch (message);
- }
-@@ -86,16 +97,15 @@
- read (pipefd2[0], &message, 1);
- }
-
--void handle_console (unsigned char action)
-+static void
-+handle_console_linux (unsigned char action)
- {
- char *tty_name;
- char *mc_conssaver;
- int status;
-
-- switch (action){
-+ switch (action) {
- case CONSOLE_INIT:
-- if (look_for_rxvt_extensions ())
-- return;
- /* Close old pipe ends in case it is the 2nd time we run cons.saver */
- close (pipefd1[1]);
- close (pipefd2[0]);
-@@ -104,7 +114,7 @@
- pipe (pipefd2);
- /* Get the console saver running */
- cons_saver_pid = fork ();
-- if (cons_saver_pid < 0){
-+ if (cons_saver_pid < 0) {
- /* Cannot fork */
- /* Delete pipes */
- close (pipefd1[1]);
-@@ -112,14 +122,14 @@
- close (pipefd2[1]);
- close (pipefd2[0]);
- console_flag = 0;
-- } else if (cons_saver_pid > 0){
-+ } else if (cons_saver_pid > 0) {
- /* Parent */
- /* Close the extra pipe ends */
- close (pipefd1[0]);
- close (pipefd2[1]);
- /* Was the child successful? */
- read (pipefd2[0], &console_flag, 1);
-- if (!console_flag){
-+ if (!console_flag) {
- close (pipefd1[1]);
- close (pipefd2[0]);
- waitpid (cons_saver_pid, &status, 0);
-@@ -152,33 +162,31 @@
- close (1);
- close (0);
- _exit (3);
-- } /* if (cons_saver_pid ...) */
-+ } /* if (cons_saver_pid ...) */
- break;
-
- case CONSOLE_DONE:
- case CONSOLE_SAVE:
- case CONSOLE_RESTORE:
-- if (look_for_rxvt_extensions ())
-- return;
- /* Is tty console? */
- if (!console_flag)
- return;
- /* Paranoid: Is the cons.saver still running? */
-- if (cons_saver_pid < 1 || kill (cons_saver_pid, SIGCONT)){
-+ if (cons_saver_pid < 1 || kill (cons_saver_pid, SIGCONT)) {
- cons_saver_pid = 0;
- console_flag = 0;
- return;
- }
- /* Send command to the console handler */
- write (pipefd1[1], &action, 1);
-- if (action != CONSOLE_DONE){
-+ if (action != CONSOLE_DONE) {
- /* Wait the console handler to do its job */
- read (pipefd2[0], &console_flag, 1);
- }
-- if (action == CONSOLE_DONE || !console_flag){
-+ if (action == CONSOLE_DONE || !console_flag) {
- /* We are done -> Let's clean up */
-- close (pipefd1 [1]);
-- close (pipefd2 [0]);
-+ close (pipefd1[1]);
-+ close (pipefd2[0]);
- waitpid (cons_saver_pid, &status, 0);
- console_flag = 0;
- }
-@@ -186,221 +194,371 @@
- }
- }
-
--#endif /* #ifdef linux */
-+#elif defined(SCO_FLAVOR)
-
--#ifdef SCO_FLAVOR
- /*
- ** SCO console save/restore handling routines
- ** Copyright (C) 1997 Alex Tkachenko <alex@bcs.zaporizhzhe.ua>
- */
-
--#include <stdio.h>
--#include <sys/types.h>
--#include <sys/vid.h>
--#include <sys/console.h>
--#include <sys/vtkd.h>
--#include <memory.h>
--#include <signal.h>
--#include "tty.h"
--#include "util.h"
- #include "color.h"
--#include "cons.saver.h"
-
- static int FD_OUT = 2;
-
--static unsigned short* vidbuf = NULL;
--static unsigned short* screen = NULL;
-+static unsigned short *vidbuf = NULL;
-+static unsigned short *screen = NULL;
- static int height = 0, width = 0, saved_attr = 0;
- static int mode = 0;
-
--#define SIG_ACQUIRE 21 /* originally: handset, line status change (?) */
-+#define SIG_ACQUIRE 21 /* originally: handset, line status change (?) */
-
- static int
--vt_active()
-+vt_active ()
-+{
-+ struct vid_info vi;
-+ int adapter = ioctl (FD_OUT, CONS_CURRENT, 0);
-+
-+ vi.size = sizeof (struct vid_info);
-+ ioctl (FD_OUT, CONS_GETINFO, &(vi));
-+ return (vi.m_num == ioctl (FD_OUT, CONSADP, adapter));
-+}
-+
-+static void
-+console_acquire_vt ()
- {
-- struct vid_info vi;
-- int adapter = ioctl(FD_OUT, CONS_CURRENT, 0);
-+ struct vt_mode smode;
-
-- vi.size = sizeof(struct vid_info);
-- ioctl(FD_OUT, CONS_GETINFO, &(vi));
-- return (vi.m_num == ioctl(FD_OUT,CONSADP,adapter));
-+ signal (SIG_ACQUIRE, SIG_DFL);
-+ smode.mode = VT_AUTO;
-+ smode.waitv = smode.relsig = smode.acqsig = smode.frsig = 0;
-+ ioctl (FD_OUT, VT_SETMODE, &smode);
-+ ioctl (FD_OUT, VT_RELDISP, VT_ACKACQ);
-+}
-+
-+static void
-+console_shutdown ()
-+{
-+ if (!console_flag) {
-+ return;
-+ }
-+ if (screen != NULL) {
-+ g_free (screen);
-+ }
-+ console_flag = 0;
- }
-
- static void
--console_acquire_vt()
-+console_save ()
- {
-+ struct m6845_info mi;
-+
-+ if (!console_flag) {
-+ return;
-+ }
-+
-+ if (!vt_active ()) {
- struct vt_mode smode;
-
-- signal(SIG_ACQUIRE, SIG_DFL);
-- smode.mode = VT_AUTO;
-- smode.waitv = smode.relsig = smode.acqsig = smode.frsig = 0;
-- ioctl(FD_OUT, VT_SETMODE, &smode);
-- ioctl(FD_OUT, VT_RELDISP, VT_ACKACQ);
-+ /*
-+ ** User switched out of our vt. Let's wait until we get SIG_ACQUIRE,
-+ ** otherwise we could save wrong screen image
-+ */
-+ signal (SIG_ACQUIRE, console_acquire_vt);
-+ smode.mode = VT_PROCESS;
-+ smode.waitv = 0;
-+ smode.waitv = smode.relsig = smode.acqsig = smode.frsig =
-+ SIG_ACQUIRE;
-+ ioctl (FD_OUT, VT_SETMODE, &smode);
-+
-+ pause ();
-+ }
-+
-+ saved_attr = ioctl (FD_OUT, GIO_ATTR, 0);
-+
-+ vidbuf = (unsigned short *) ioctl (FD_OUT, MAPCONS, 0);
-+
-+ mi.size = sizeof (struct m6845_info);
-+ ioctl (FD_OUT, CONS_6845INFO, &mi);
-+
-+ {
-+ unsigned short *start = vidbuf + mi.screen_top;
-+ memcpy (screen, start, width * height * 2);
-+ }
-+
-+ write (FD_OUT, "\0337", 2); /* save cursor position */
- }
-
- static void
--console_shutdown()
-+console_restore ()
- {
-- if (!console_flag)
-- {
-- return;
-- }
-- if (screen != NULL)
-- {
-- g_free (screen);
-- }
-- console_flag = 0;
-+ struct m6845_info mi;
-+ unsigned short *start;
-+
-+ if (!console_flag) {
-+ return;
-+ }
-+
-+ write (FD_OUT, "\033[2J", 4);
-+
-+ mi.size = sizeof (struct m6845_info);
-+ ioctl (FD_OUT, CONS_6845INFO, &mi);
-+
-+ start = vidbuf + mi.screen_top;
-+ memcpy (start, screen, width * height * 2);
-+ write (FD_OUT, "\0338", 2); /* restore cursor position */
- }
-
- static void
--console_save()
-+console_init ()
- {
-- struct m6845_info mi;
-+ struct vid_info vi;
-+ int adapter = ioctl (FD_OUT, CONS_CURRENT, 0);
-
-- if (!console_flag)
-- {
-+ console_flag = 0;
-+
-+ if (adapter != -1) {
-+ vi.size = sizeof (struct vid_info);
-+ ioctl (FD_OUT, CONS_GETINFO, &(vi));
-+
-+ if (vt_active ()) {
-+ console_flag = 1;
-+
-+ height = vi.mv_rsz;
-+ width = vi.mv_csz;
-+
-+ screen = (unsigned short *) g_malloc (height * width * 2);
-+ if (screen == NULL) {
-+ console_shutdown ();
- return;
-+ }
-+ console_save ();
-+ mode = ioctl (FD_OUT, CONS_GET, 0);
-+ ioctl (FD_OUT, MODESWITCH | mode, 0);
-+ console_restore ();
- }
-+ }
-+}
-
-- if (!vt_active())
-- {
-- struct vt_mode smode;
--
-- /*
-- ** User switched out of our vt. Let's wait until we get SIG_ACQUIRE,
-- ** otherwise we could save wrong screen image
-- */
-- signal(SIG_ACQUIRE, console_acquire_vt);
-- smode.mode = VT_PROCESS;
-- smode.waitv = 0;
-- smode.waitv = smode.relsig = smode.acqsig = smode.frsig = SIG_ACQUIRE;
-- ioctl(FD_OUT, VT_SETMODE, &smode);
-+static void
-+handle_console_sco (unsigned char action)
-+{
-+ switch (action) {
-+ case CONSOLE_INIT:
-+ console_init ();
-+ break;
-
-- pause();
-- }
-+ case CONSOLE_DONE:
-+ console_shutdown ();
-+ break;
-+
-+ case CONSOLE_SAVE:
-+ console_save ();
-+ break;
-+
-+ case CONSOLE_RESTORE:
-+ console_restore ();
-+ break;
-+ default:
-+ /* Nothing */ ;
-+ }
-+}
-
-- saved_attr = ioctl(FD_OUT, GIO_ATTR, 0);
-+static void
-+show_console_contents_sco (int starty, unsigned char begin_line,
-+ unsigned char end_line)
-+{
-+ register int i, len = (end_line - begin_line) * width;
-
-- vidbuf = (unsigned short*) ioctl(FD_OUT, MAPCONS, 0);
-+ attrset (DEFAULT_COLOR);
-+ for (i = 0; i < len; i++) {
-+ if ((i % width) == 0)
-+ move (starty + (i / width), 0);
-+ addch ((unsigned char) screen[width * starty + i]);
-+ }
-+}
-
-- mi.size = sizeof(struct m6845_info);
-- ioctl(FD_OUT, CONS_6845INFO, &mi);
-+#elif defined(__FreeBSD__)
-
-- {
-- unsigned short* start = vidbuf + mi.screen_top;
-- memcpy(screen, start, width * height * 2);
-- }
-+/*
-+ * FreeBSD support copyright (C) 2003 Alexander Serkov <serkov@ukrpost.net>.
-+ * Support for screenmaps by Max Khon <fjoe@FreeBSD.org>
-+ */
-+
-+#define FD_OUT 1
-+
-+static struct scrshot screen_shot;
-+static struct vid_info screen_info;
-
-- write(FD_OUT,"\0337",2); /* save cursor position */
-+static void
-+console_init (void)
-+{
-+ if (console_flag)
-+ return;
-+
-+ screen_info.size = sizeof (screen_info);
-+ if (ioctl (FD_OUT, CONS_GETINFO, &screen_info) == -1)
-+ return;
-+
-+ memset (&screen_shot, 0, sizeof (screen_shot));
-+ screen_shot.xsize = screen_info.mv_csz;
-+ screen_shot.ysize = screen_info.mv_rsz;
-+ if ((screen_shot.buf =
-+ g_malloc (screen_info.mv_csz * screen_info.mv_rsz * 2)) == NULL)
-+ return;
-+
-+ console_flag = 1;
- }
-
- static void
--console_restore()
-+set_attr (unsigned attr)
- {
-- struct m6845_info mi;
-- unsigned short* start;
-+ /*
-+ * Convert color indices returned by SCRSHOT (red=4, green=2, blue=1)
-+ * to indices for ANSI sequences (red=1, green=2, blue=4).
-+ */
-+ static const int color_map[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
-+ char cmd[17];
-+ int bc, tc;
-+
-+ tc = attr & 0xF;
-+ bc = (attr >> 4) & 0xF;
-+
-+ strcpy (cmd, "\x1B[");
-+ strcat (cmd, (bc & 8) ? "5;" : "25;");
-+ strcat (cmd, (tc & 8) ? "1;" : "22;");
-+ strcat (cmd, "3%d;4%dm");
-+ printf (cmd, color_map[tc & 7], color_map[bc & 7]);
-+}
-+
-+#define cursor_to(x, y) do { \
-+ printf("\x1B[%d;%df", (y) + 1, (x) + 1); \
-+ fflush(stdout); \
-+} while (0)
-
-- if (!console_flag)
-- {
-- return;
-- }
-+static void
-+console_restore (void)
-+{
-+ int i, last;
-
-- write (FD_OUT, "\033[2J", 4);
-+ if (!console_flag)
-+ return;
-
-- mi.size = sizeof(struct m6845_info);
-- ioctl(FD_OUT, CONS_6845INFO, &mi);
-+ cursor_to (0, 0);
-
-- start = vidbuf + mi.screen_top;
-- memcpy(start, screen, width * height * 2);
-- write(FD_OUT,"\0338",2); /* restore cursor position */
-+ /* restoring all content up to cursor position */
-+ last = screen_info.mv_row * screen_info.mv_csz + screen_info.mv_col;
-+ for (i = 0; i < last; ++i) {
-+ set_attr ((screen_shot.buf[i] >> 8) & 0xFF);
-+ putc (screen_shot.buf[i] & 0xFF, stdout);
-+ }
-+
-+ /* restoring cursor color */
-+ set_attr ((screen_shot.buf[last] >> 8) & 0xFF);
-+
-+ fflush (stdout);
- }
-
- static void
--console_init()
-+console_shutdown (void)
- {
-- struct vid_info vi;
-- int adapter = ioctl(FD_OUT, CONS_CURRENT, 0);
-+ if (!console_flag)
-+ return;
-
-- console_flag = 0;
-+ g_free (screen_shot.buf);
-
-- if (adapter != -1)
-- {
-- vi.size = sizeof(struct vid_info);
-- ioctl(FD_OUT, CONS_GETINFO, &(vi));
--
-- if (vt_active())
-- {
-- console_flag = 1;
--
-- height = vi.mv_rsz;
-- width = vi.mv_csz;
--
-- screen = (unsigned short*) g_malloc (height * width * 2);
-- if (screen == NULL)
-- {
-- console_shutdown();
-- return;
-- }
-- console_save();
-- mode = ioctl(FD_OUT, CONS_GET, 0);
-- ioctl(FD_OUT, MODESWITCH | mode, 0);
-- console_restore();
-- }
-- }
-+ console_flag = 0;
- }
-
--void
--handle_console (unsigned char action)
-+static void
-+console_save (void)
- {
-- if (look_for_rxvt_extensions ())
-- return;
-- switch (action){
-- case CONSOLE_INIT:
-- console_init();
-- break;
--
-- case CONSOLE_DONE:
-- console_shutdown();
-- break;
--
-- case CONSOLE_SAVE:
-- console_save();
-- break;
--
-- case CONSOLE_RESTORE:
-- console_restore();
-- break;
-- default:
-- /* Nothing */;
-+ int i;
-+ scrmap_t map;
-+ scrmap_t revmap;
-+
-+ if (!console_flag)
-+ return;
-+
-+ /* screen_info.size is already set in console_init() */
-+ if (ioctl (FD_OUT, CONS_GETINFO, &screen_info) == -1) {
-+ console_shutdown ();
-+ return;
-+ }
-+
-+ /* handle console resize */
-+ if (screen_info.mv_csz != screen_shot.xsize
-+ || screen_info.mv_rsz != screen_shot.ysize) {
-+ console_shutdown ();
-+ console_init ();
-+ }
-+
-+ if (ioctl (FD_OUT, CONS_SCRSHOT, &screen_shot) == -1) {
-+ console_shutdown ();
-+ return;
-+ }
-+
-+ if (ioctl (FD_OUT, GIO_SCRNMAP, &map) == -1) {
-+ console_shutdown ();
-+ return;
-+ }
-+
-+ for (i = 0; i < 256; i++) {
-+ char *p = memchr (map.scrmap, i, 256);
-+ revmap.scrmap[i] = p ? p - map.scrmap : i;
-+ }
-+
-+ for (i = 0; i < screen_shot.xsize * screen_shot.ysize; i++) {
-+ screen_shot.buf[i] =
-+ (screen_shot.buf[i] & 0xff00) | (unsigned char) revmap.
-+ scrmap[screen_shot.buf[i] & 0xff];
- }
- }
-
--void
--show_console_contents (int starty, unsigned char begin_line, unsigned char end_line)
-+static void
-+show_console_contents_freebsd (int starty, unsigned char begin_line,
-+ unsigned char end_line)
- {
-- register int i, len = (end_line - begin_line) * width;
-+ int col, line;
-+ char c;
-
-- if (look_for_rxvt_extensions ()) {
-- show_rxvt_contents (starty, begin_line, end_line);
-- return;
-- }
-- attrset(DEFAULT_COLOR);
-- for (i = 0; i < len; i++)
-- {
-- if ((i % width) == 0)
-- move (starty+(i/width), 0);
-- addch ((unsigned char)screen[width*starty + i]);
-+ if (!console_flag)
-+ return;
-+
-+ for (line = begin_line; line <= end_line; line++) {
-+ move (starty + line - begin_line, 0);
-+ for (col = 0; col < min (COLS, screen_info.mv_csz); col++) {
-+ c = screen_shot.buf[line * screen_info.mv_csz + col] & 0xFF;
-+ addch (c);
- }
-+ }
- }
-
--#endif /* SCO_FLAVOR */
-+static void
-+handle_console_freebsd (unsigned char action)
-+{
-+ switch (action) {
-+ case CONSOLE_INIT:
-+ console_init ();
-+ break;
-
-+ case CONSOLE_DONE:
-+ console_shutdown ();
-+ break;
-
--#if !defined(linux) && !defined(__linux__) && !defined(SCO_FLAVOR)
-+ case CONSOLE_SAVE:
-+ console_save ();
-+ break;
-
--#include "tty.h"
-+ case CONSOLE_RESTORE:
-+ console_restore ();
-+ break;
-+ }
-+}
-+#endif /* __FreeBSD__ */
-
--void show_console_contents (int starty, unsigned char begin_line, unsigned char end_line)
-+void
-+show_console_contents (int starty, unsigned char begin_line,
-+ unsigned char end_line)
- {
- standend ();
-
-@@ -408,14 +566,28 @@
- show_rxvt_contents (starty, begin_line, end_line);
- return;
- }
-+#ifdef __linux__
-+ show_console_contents_linux (starty, begin_line, end_line);
-+#elif defined (__FreeBSD__)
-+ show_console_contents_freebsd (starty, begin_line, end_line);
-+#elif defined (SCO_FLAVOR)
-+ show_console_contents_sco (starty, begin_line, end_line);
-+#else
- console_flag = 0;
-+#endif
- }
-
--void handle_console (unsigned char action)
-+void
-+handle_console (unsigned char action)
- {
-- look_for_rxvt_extensions ();
--}
--
--#endif /* !defined(linux) && !defined(__linux__) && !defined(SCO_FLAVOR) */
--
-+ if (look_for_rxvt_extensions ())
-+ return;
-
-+#ifdef __linux__
-+ handle_console_linux (action);
-+#elif defined (__FreeBSD__)
-+ handle_console_freebsd (action);
-+#elif defined (SCO_FLAVOR)
-+ handle_console_sco (action);
-+#endif
-+}
diff --git a/misc/mc/files/patch-src-dir.c b/misc/mc/files/patch-src-dir.c
deleted file mode 100644
index e9a97a35aefa..000000000000
--- a/misc/mc/files/patch-src-dir.c
+++ /dev/null
@@ -1,53 +0,0 @@
---- src/dir.c.orig Tue Jan 21 06:41:45 2003
-+++ src/dir.c Tue Jun 15 03:15:09 2004
-@@ -503,9 +503,11 @@
- }
-
- if (next_free) {
-+ char *path = vfs_canon (".");
- /* Add ".." except the root directory */
-- if (strcmp (vfs_canon ("."), "/") != 0)
-+ if (strcmp (path, "/") != 0)
- add_dotdot_to_list (list, next_free++);
-+ g_free (path);
- do_sort (list, sort, next_free - 1, reverse, case_sensitive);
- } else {
- tree_store_end_check ();
-@@ -576,7 +578,7 @@
- int i, status, link_to_dir, stale_link;
- struct stat buf;
- int marked_cnt;
-- GHashTable *marked_files = g_hash_table_new (g_str_hash, g_str_equal);
-+ GHashTable *marked_files;
-
- tree_store_start_check_cwd ();
- dirp = mc_opendir (".");
-@@ -587,6 +589,7 @@
- return set_zero_dir (list);
- }
-
-+ marked_files = g_hash_table_new (g_str_hash, g_str_equal);
- alloc_dir_copy (list->size);
- for (marked_cnt = i = 0; i < count; i++) {
- dir_copy.list[i].fnamelen = list->list[i].fnamelen;
-@@ -622,6 +625,7 @@
- clean_dir (&dir_copy, count);
- */
- tree_store_end_check ();
-+ g_hash_table_destroy (marked_files);
- return next_free;
- }
-
-@@ -655,9 +659,11 @@
- tree_store_end_check ();
- g_hash_table_destroy (marked_files);
- if (next_free) {
-+ char *path = vfs_canon (".");
- /* Add ".." except the root directory */
-- if (strcmp (vfs_canon ("."), "/") != 0)
-+ if (strcmp (path, "/") != 0)
- add_dotdot_to_list (list, next_free++);
-+ g_free (path);
- do_sort (list, sort, next_free - 1, rev, case_sensitive);
- } else
- next_free = set_zero_dir (list);
diff --git a/misc/mc/files/patch-src-ext.c b/misc/mc/files/patch-src-ext.c
deleted file mode 100644
index b20292d2b8e7..000000000000
--- a/misc/mc/files/patch-src-ext.c
+++ /dev/null
@@ -1,50 +0,0 @@
---- src/ext.c.orig Thu Nov 14 13:25:19 2002
-+++ src/ext.c Tue Jun 15 03:15:09 2004
-@@ -450,7 +450,7 @@
-
- if (content_string && content_string[0]
- && regexp_match (ptr, content_string + content_shift,
-- match_normal)) {
-+ match_regex)) {
- found = 1;
- }
-
-@@ -477,7 +477,6 @@
- int found = 0;
- int error_flag = 0;
- int ret = 0;
-- int old_patterns;
- struct stat mystat;
- int view_at_line_number;
- char *include_target;
-@@ -559,8 +558,6 @@
- }
- mc_stat (filename, &mystat);
-
-- old_patterns = easy_patterns;
-- easy_patterns = 0; /* Real regular expressions are needed :) */
- include_target = NULL;
- include_target_len = 0;
- for (p = data; *p; p++) {
-@@ -593,11 +590,11 @@
- /* Do not transform shell patterns, you can use shell/ for
- * that
- */
-- if (regexp_match (p, filename, match_normal))
-+ if (regexp_match (p, filename, match_regex))
- found = 1;
- } else if (!strncmp (p, "directory/", 10)) {
- if (S_ISDIR (mystat.st_mode)
-- && regexp_match (p + 10, filename, match_normal))
-+ && regexp_match (p + 10, filename, match_regex))
- found = 1;
- } else if (!strncmp (p, "shell/", 6)) {
- p += 6;
-@@ -683,7 +680,6 @@
- break;
- }
- }
-- easy_patterns = old_patterns;
- if (error_flag)
- return -1;
- return ret;
diff --git a/misc/mc/files/patch-src-file.c b/misc/mc/files/patch-src-file.c
deleted file mode 100644
index 75db157dfd51..000000000000
--- a/misc/mc/files/patch-src-file.c
+++ /dev/null
@@ -1,31 +0,0 @@
---- src/file.c.orig Fri Dec 27 01:04:10 2002
-+++ src/file.c Tue Jun 15 03:15:09 2004
-@@ -366,7 +366,7 @@
- dst_is_symlink = 0;
-
- retry_src_readlink:
-- len = mc_readlink (src_path, link_target, MC_MAXPATHLEN);
-+ len = mc_readlink (src_path, link_target, MC_MAXPATHLEN - 1);
- if (len < 0) {
- return_status =
- file_error (_(" Cannot read source link \"%s\" \n %s "),
-@@ -715,6 +715,7 @@
- gettimeofday (&tv_current, NULL);
-
- if (n_read > 0) {
-+ char *t = buf;
- n_read_total += n_read;
-
- /* Windows NT ftp servers report that files have no
-@@ -729,9 +730,10 @@
-
- /* dst_write */
- while ((n_written =
-- mc_write (dest_desc, buf, n_read)) < n_read) {
-+ mc_write (dest_desc, t, n_read)) < n_read) {
- if (n_written > 0) {
- n_read -= n_written;
-+ t += n_written;
- continue;
- }
- return_status =
diff --git a/misc/mc/files/patch-src-find.c b/misc/mc/files/patch-src-find.c
deleted file mode 100644
index 072b11eb452e..000000000000
--- a/misc/mc/files/patch-src-find.c
+++ /dev/null
@@ -1,97 +0,0 @@
---- src/find.c.orig Tue Dec 24 17:28:26 2002
-+++ src/find.c Tue Jun 15 03:15:09 2004
-@@ -312,7 +312,7 @@
- dir_stack *new;
-
- new = g_new (dir_stack, 1);
-- new->name = g_strdup (dir);
-+ new->name = concat_dir_and_file (dir, "");
- new->prev = dir_stack_base;
- dir_stack_base = new;
- }
-@@ -338,17 +338,9 @@
- {
- char *tmp_name;
- static char *dirname;
-- int i;
-
-- if (dir [0] == PATH_SEP && dir [1] == PATH_SEP)
-+ while (dir [0] == PATH_SEP && dir [1] == PATH_SEP)
- dir++;
-- i = strlen (dir);
-- if (i){
-- if (dir [i - 1] != PATH_SEP){
-- dir [i] = PATH_SEP;
-- dir [i + 1] = 0;
-- }
-- }
-
- if (old_dir){
- if (strcmp (old_dir, dir)){
-@@ -401,7 +393,7 @@
- char ch = 0;
- int i = 0;
-
-- do {
-+ for (;;) {
- if (*pos >= *n_read){
- *pos = 0;
- if ((*n_read = mc_read (file_fd, buf, buf_size)) <= 0)
-@@ -420,10 +412,12 @@
- if (i >= buffer_size - 1){
- buffer = g_realloc (buffer, buffer_size += 80);
- }
-+ /* Strip newline to fix $ matching */
-+ if (ch == '\n')
-+ break;
-
- buffer [i++] = ch;
--
-- } while (ch != '\n');
-+ }
-
- *has_newline = ch ? 1 : 0;
-
-@@ -502,7 +496,7 @@
- {
- static struct dirent *dp = 0;
- static DIR *dirp = 0;
-- static char directory [MC_MAXPATHLEN+2];
-+ static char *directory;
- struct stat tmp_stat;
- static int pos;
- static int subdirs_left = 0;
-@@ -513,6 +507,10 @@
- mc_closedir (dirp);
- dirp = 0;
- }
-+ if (directory) {
-+ g_free (directory);
-+ directory = NULL;
-+ }
- dp = 0;
- return 1;
- }
-@@ -550,8 +548,9 @@
- break;
- }
-
-- strcpy (directory, tmp);
-- g_free (tmp);
-+ if (directory)
-+ g_free (directory);
-+ directory = tmp;
-
- if (verbose){
- char buffer [BUF_SMALL];
-@@ -582,8 +581,8 @@
- tmp_name = concat_dir_and_file (directory, dp->d_name);
-
- if (subdirs_left){
-- mc_lstat (tmp_name, &tmp_stat);
-- if (S_ISDIR (tmp_stat.st_mode)){
-+ if (!mc_lstat (tmp_name, &tmp_stat)
-+ && S_ISDIR (tmp_stat.st_mode)){
- push_directory (tmp_name);
- subdirs_left--;
- }
diff --git a/misc/mc/files/patch-src-info.c b/misc/mc/files/patch-src-info.c
deleted file mode 100644
index 73c9ff177761..000000000000
--- a/misc/mc/files/patch-src-info.c
+++ /dev/null
@@ -1,20 +0,0 @@
---- src/info.c.orig Wed Jan 29 04:58:22 2003
-+++ src/info.c Tue Jun 15 03:15:09 2004
-@@ -123,7 +123,7 @@
- size_trunc_len (buffer1, 5, myfs_stats.avail, 1);
- size_trunc_len (buffer2, 5, myfs_stats.total, 1);
- printw (_("Free space: %s (%d%%) of %s"), buffer1, myfs_stats.total ?
-- 100 * myfs_stats.avail / myfs_stats.total : 0, buffer2);
-+ (int) (100.0 * myfs_stats.avail / myfs_stats.total) : 0, buffer2);
- } else
- addstr (_("No space information"));
-
-@@ -170,7 +170,7 @@
- printw (_("Size: %s"), buffer);
- #ifdef HAVE_ST_BLOCKS
- printw ((buf.st_blocks==1) ?
-- _(" (%d block)") : _(" (%d blocks)"), buf.st_blocks);
-+ _(" (%ld block)") : _(" (%ld blocks)"), (long) buf.st_blocks);
- #endif
- }
-
diff --git a/misc/mc/files/patch-src-main.c b/misc/mc/files/patch-src-main.c
deleted file mode 100644
index b37514ff48a4..000000000000
--- a/misc/mc/files/patch-src-main.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/main.c.orig Wed Feb 5 21:54:34 2003
-+++ src/main.c Tue Jun 15 03:15:09 2004
-@@ -1300,7 +1300,7 @@
- concat_dir_and_file (panel->cwd, selection (panel)->fname);
- int i;
-
-- i = mc_readlink (p, buffer, MC_MAXPATHLEN);
-+ i = mc_readlink (p, buffer, MC_MAXPATHLEN - 1);
- g_free (p);
- if (i > 0) {
- buffer[i] = 0;
diff --git a/misc/mc/files/patch-src-man2hlp.c b/misc/mc/files/patch-src-man2hlp.c
deleted file mode 100644
index 16f2758c1d5f..000000000000
--- a/misc/mc/files/patch-src-man2hlp.c
+++ /dev/null
@@ -1,12 +0,0 @@
---- src/man2hlp.c.orig Tue Jan 21 05:23:42 2003
-+++ src/man2hlp.c Tue Jun 15 03:15:09 2004
-@@ -611,8 +611,7 @@
- /* Bold text or italics text */
- if (buffer[0] == '.' && (buffer[1] == 'I' || buffer[1] == 'B'))
- for (buffer += 2; *buffer == ' ' || *buffer == '\t'; buffer++);
-- strncpy (old, buffer, sizeof (old) - 1);
-- old[sizeof (old) - 1] = 0;
-+ g_strlcpy (old, buffer, sizeof (old));
- link_flag = 3;
- break;
- case 3:
diff --git a/misc/mc/files/patch-src-profile.c b/misc/mc/files/patch-src-profile.c
deleted file mode 100644
index 41b9d389c3b5..000000000000
--- a/misc/mc/files/patch-src-profile.c
+++ /dev/null
@@ -1,12 +0,0 @@
---- src/profile.c.orig Mon Jan 20 20:33:02 2003
-+++ src/profile.c Tue Jun 15 03:15:09 2004
-@@ -325,8 +325,7 @@
-
- s = GetSetProfileChar (set, AppName, KeyName, Default, FileName);
- if (!set){
-- ReturnedString [Size-1] = 0;
-- strncpy (ReturnedString, s, Size-1);
-+ g_strlcpy (ReturnedString, s, Size);
- }
- return 1;
- }
diff --git a/misc/mc/files/patch-src-screen.c b/misc/mc/files/patch-src-screen.c
deleted file mode 100644
index da4cbad9f71b..000000000000
--- a/misc/mc/files/patch-src-screen.c
+++ /dev/null
@@ -1,52 +0,0 @@
---- src/screen.c.orig Wed Jan 29 04:58:22 2003
-+++ src/screen.c Tue Jun 15 03:22:46 2004
-@@ -672,7 +672,7 @@
- int len;
-
- link = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname);
-- len = mc_readlink (link, link_target, MC_MAXPATHLEN);
-+ len = mc_readlink (link, link_target, MC_MAXPATHLEN - 1);
- g_free (link);
- if (len > 0){
- link_target[len] = 0;
-@@ -1045,7 +1045,7 @@
- int spaces, extra;
- int side, width;
-
-- char *txt, buffer[30]; /*Hope that this is enough ;-) */
-+ char *txt;
- if (!panel->split)
- adjust_top_file (panel);
-
-@@ -1071,18 +1071,14 @@
- txt = format->title;
-
- header_len = strlen (txt);
-- if (header_len > format->field_len){
-- strcpy (buffer, txt);
-- txt = buffer;
-- txt [format->field_len] = 0;
-- header_len = strlen (txt);
-- }
-+ if (header_len > format->field_len)
-+ header_len = format->field_len;
-
- attrset (MARKED_COLOR);
- spaces = (format->field_len - header_len) / 2;
- extra = (format->field_len - header_len) % 2;
-- printw ("%*s%-s%*s", spaces, "",
-- txt, spaces+extra, "");
-+ printw ("%*s%.*s%*s", spaces, "",
-+ header_len, txt, spaces+extra, "");
- width -= 2 * spaces + extra + header_len;
- } else {
- attrset (NORMAL_COLOR);
-@@ -2021,7 +2017,7 @@
- int i;
- struct stat mybuf;
-
-- i = readlink (selection (panel)->fname, buffer, MC_MAXPATHLEN);
-+ i = readlink (selection (panel)->fname, buffer, MC_MAXPATHLEN - 1);
- if (i < 0)
- return;
- if (mc_stat (selection (panel)->fname, &mybuf) < 0)
diff --git a/misc/mc/files/patch-src-subshell.c b/misc/mc/files/patch-src-subshell.c
deleted file mode 100644
index 7f4565e3b7db..000000000000
--- a/misc/mc/files/patch-src-subshell.c
+++ /dev/null
@@ -1,21 +0,0 @@
---- src/subshell.c.orig Sat Jan 25 03:37:28 2003
-+++ src/subshell.c Tue Jun 15 03:15:09 2004
-@@ -710,7 +710,9 @@
- }
-
- g_free (subshell_prompt);
-+ g_free (pty_buffer);
- subshell_prompt = NULL;
-+ pty_buffer = NULL;
-
- return quit;
- }
-@@ -1166,6 +1168,8 @@
- #elif IS_AIX
- strcpy (pty_name, "/dev/ptc");
- pty_master = open (pty_name, O_RDWR);
-+#elif defined(__FreeBSD__)
-+ pty_master = posix_openpt(O_RDWR);
- #else
- strcpy (pty_name, "/dev/ptmx");
- pty_master = open (pty_name, O_RDWR);
diff --git a/misc/mc/files/patch-src-user.c b/misc/mc/files/patch-src-user.c
deleted file mode 100644
index 259640750a81..000000000000
--- a/misc/mc/files/patch-src-user.c
+++ /dev/null
@@ -1,183 +0,0 @@
---- src/user.c.orig Fri Nov 29 09:03:53 2002
-+++ src/user.c Tue Jun 15 03:15:09 2004
-@@ -138,19 +138,14 @@
- }
-
- /* Copy the variable name */
-- var_name = g_malloc (dots - p);
-- strncpy (var_name, p+4, dots-2 - (p+3));
-- var_name [dots-2 - (p+3)] = 0;
--
-+ var_name = g_strndup (p + 4, dots - p - 5);
- value = getenv (var_name);
- g_free (var_name);
- if (value){
- *v = g_strdup (value);
- return q-p;
- }
-- var_name = g_malloc (q - dots + 1);
-- strncpy (var_name, dots, q - dots + 1);
-- var_name [q-dots] = 0;
-+ var_name = g_strndup (dots, q - dots);
- *v = var_name;
- return q-p;
- }
-@@ -300,13 +295,15 @@
-
- /* Copies a whitespace separated argument from p to arg. Returns the
- point after argument. */
--static char *extract_arg (char *p, char *arg)
-+static char *extract_arg (char *p, char *arg, size_t size)
- {
- while (*p && (*p == ' ' || *p == '\t' || *p == '\n'))
- p++;
- /* support quote space .mnu */
-- while (*p && (*p != ' ' || *(p-1) == '\\') && *p != '\t' && *p != '\n')
-+ while (size > 1 && *p && (*p != ' ' || *(p-1) == '\\') && *p != '\t' && *p != '\n') {
- *arg++ = *p++;
-+ size--;
-+ }
- *arg = 0;
- if (!*p || *p == '\n')
- p --;
-@@ -389,29 +386,29 @@
- p--;
- break;
- case 'f': /* file name pattern */
-- p = extract_arg (p, arg);
-+ p = extract_arg (p, arg, sizeof (arg));
- *condition = panel && regexp_match (arg, panel->dir.list [panel->selected].fname, match_file);
- break;
- case 'y': /* syntax pattern */
- if (edit_widget && edit_widget->syntax_type) {
-- p = extract_arg (p, arg);
-+ p = extract_arg (p, arg, sizeof (arg));
- *condition = panel &&
- regexp_match (arg, edit_widget->syntax_type, match_normal);
- }
- break;
- case 'd':
-- p = extract_arg (p, arg);
-+ p = extract_arg (p, arg, sizeof (arg));
- *condition = panel && regexp_match (arg, panel->cwd, match_file);
- break;
- case 't':
-- p = extract_arg (p, arg);
-+ p = extract_arg (p, arg, sizeof (arg));
- *condition = panel && test_type (panel, arg);
- break;
- case 'x': /* executable */
- {
- struct stat status;
-
-- p = extract_arg (p, arg);
-+ p = extract_arg (p, arg, sizeof (arg));
- if (stat (arg, &status) == 0)
- *condition = is_exe (status.st_mode);
- else
-@@ -431,50 +428,43 @@
- static void
- debug_out (char *start, char *end, int cond)
- {
-- static char msg [256];
-+ static char *msg;
- int len;
-
- if (start == NULL && end == NULL){
-- if (cond == 0){
-- /* Init */
-- msg [0] = 0;
-- } else {
-- /* Show output */
-- if (!debug_flag)
-- return;
-+ /* Show output */
-+ if (debug_flag && msg) {
- len = strlen (msg);
- if (len)
- msg [len - 1] = 0;
- message (0, _(" Debug "), "%s", msg);
-- debug_flag = 0;
- }
-+ debug_flag = 0;
-+ g_free (msg);
-+ msg = NULL;
- } else {
-+ char *type, *p;
-+
- /* Save debug info for later output */
- if (!debug_flag)
- return;
- /* Save the result of the condition */
- if (debug_error){
-- strcat (msg, _(" ERROR: "));
-+ type = _(" ERROR: ");
- debug_error = 0;
- }
- else if (cond)
-- strcat (msg, _(" True: "));
-+ type = _(" True: ");
- else
-- strcat (msg, _(" False: "));
-- /* Copy condition statement */
-- len = strlen (msg);
-- if (end == NULL){
-- /* Copy one character */
-- msg [len] = *start;
-- msg [len + 1] = 0;
-- } else {
-- /* Copy many characters */
-- while (start < end){
-- msg [len++] = *start++;
-- }
-- msg [len] = 0;
-- }
-- strcat (msg, " \n");
-+ type = _(" False: ");
-+ /* This is for debugging, don't need to be super efficient. */
-+ if (end == NULL)
-+ p = g_strdup_printf ("%s%s%c \n", msg ? msg : "", type, *start);
-+ else
-+ p = g_strdup_printf ("%s%s%.*s \n", msg ? msg : "", type,
-+ (int) (end - start), start);
-+ g_free (msg);
-+ msg = p;
- }
- }
-
-@@ -486,8 +476,6 @@
- char operator;
- char *debug_start, *debug_end;
-
-- /* Init debugger */
-- debug_out (NULL, NULL, 0);
- /* Repeat till end of line */
- while (*p && *p != '\n') {
- /* support quote space .mnu */
-@@ -578,6 +566,8 @@
- break;
- while (*commands == ' ' || *commands == '\t')
- commands++;
-+ if (*commands == '0')
-+ break;
- }
- col++;
- if (*commands == '\n')
-@@ -734,7 +724,7 @@
- } else if (*p == '+'){
- if (*(p+1) == '='){
- /* Combined adding and default */
-- p = test_line (edit_widget, p, &accept_entry);
-+ p = test_line (edit_widget, p + 1, &accept_entry);
- if (selected == 0 && accept_entry)
- selected = menu_lines;
- } else {
-@@ -744,7 +734,7 @@
- } else if (*p == '='){
- if (*(p+1) == '+'){
- /* Combined adding and default */
-- p = test_line (edit_widget, p, &accept_entry);
-+ p = test_line (edit_widget, p + 1, &accept_entry);
- if (selected == 0 && accept_entry)
- selected = menu_lines;
- } else {
diff --git a/misc/mc/files/patch-src-util.c b/misc/mc/files/patch-src-util.c
deleted file mode 100644
index b45eb0239144..000000000000
--- a/misc/mc/files/patch-src-util.c
+++ /dev/null
@@ -1,29 +0,0 @@
---- src/util.c.orig Wed Jan 29 04:58:23 2003
-+++ src/util.c Tue Jun 15 03:15:09 2004
-@@ -498,7 +498,7 @@
- char *new_pattern;
- int was_wildcard = 0;
-
-- if (easy_patterns){
-+ if ((match_type != match_regex) && easy_patterns){
- new_pattern = g_malloc (MC_MAXPATHLEN);
- d = new_pattern;
- if (match_type == match_file)
-@@ -848,7 +848,7 @@
- return NULL;
- }
-
-- strncpy (buffer, p, len);
-+ memcpy (buffer, p, len);
- g_free (p);
-
- return buffer;
-@@ -1063,7 +1063,7 @@
- if (!S_ISLNK (mybuf.st_mode))
- strcpy (r, p + 1);
- else {
-- len = mc_readlink (path, buf2, MC_MAXPATHLEN);
-+ len = mc_readlink (path, buf2, MC_MAXPATHLEN - 1);
- if (len < 0) {
- g_free (buf);
- g_free (buf2);
diff --git a/misc/mc/files/patch-src-util.h b/misc/mc/files/patch-src-util.h
deleted file mode 100644
index 9d3ca4ba75ee..000000000000
--- a/misc/mc/files/patch-src-util.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/util.h.orig Tue Jan 28 03:07:29 2003
-+++ src/util.h Tue Jun 15 03:15:09 2004
-@@ -62,7 +62,7 @@
- #define icase_search(T,D) _icase_search((T), (D), NULL)
-
- /* Matching */
--enum { match_file, match_normal };
-+enum { match_file, match_normal, match_regex };
- extern int easy_patterns;
- char *convert_pattern (char *pattern, int match_type, int do_group);
- int regexp_match (char *pattern, char *string, int match_type);
diff --git a/misc/mc/files/patch-src-utilunix.c b/misc/mc/files/patch-src-utilunix.c
deleted file mode 100644
index f0e2e2349174..000000000000
--- a/misc/mc/files/patch-src-utilunix.c
+++ /dev/null
@@ -1,40 +0,0 @@
---- src/utilunix.c.orig Thu Dec 26 20:47:46 2002
-+++ src/utilunix.c Tue Jun 15 03:15:09 2004
-@@ -280,9 +280,7 @@
- if (!p){
- passwd = getpwnam (directory);
- } else {
-- name = g_malloc (p - directory + 1);
-- strncpy (name, directory, p - directory);
-- name [p - directory] = 0;
-+ name = g_strndup (directory, p - directory);
- passwd = getpwnam (name);
- g_free (name);
- }
-@@ -298,7 +296,7 @@
-
- /*
- * Return the directory where mc should keep its temporary files.
-- * This directory is (in Bourne shell terms) "${TMPDIR=/tmp}-$USER"
-+ * This directory is (in Bourne shell terms) "${TMPDIR=/tmp}/mc-$USER"
- * When called the first time, the directory is created if needed.
- * The first call should be done early, since we are using fprintf()
- * and not message() to report possible problems.
-@@ -372,6 +370,7 @@
- if (fallback_ok) {
- fprintf (stderr, _("Temporary files will be created in %s\n"),
- sys_tmp);
-+ error = NULL;
- } else {
- fprintf (stderr, _("Temporary files will not be created\n"));
- tmpdir = "/dev/null/";
-@@ -380,6 +379,9 @@
- fprintf (stderr, "%s\n", _("Press any key to continue..."));
- getc (stdin);
- }
-+
-+ if (!error)
-+ setenv ("MC_TMPDIR", tmpdir, 1);
-
- return tmpdir;
- }
diff --git a/misc/mc/files/patch-src-view.c b/misc/mc/files/patch-src-view.c
deleted file mode 100644
index 1556a9862f98..000000000000
--- a/misc/mc/files/patch-src-view.c
+++ /dev/null
@@ -1,116 +0,0 @@
---- src/view.c.orig Fri Dec 27 12:48:33 2002
-+++ src/view.c Tue Jun 15 03:15:09 2004
-@@ -74,6 +74,10 @@
- # define IFAIX(x)
- #endif
-
-+#if GLIB_MAJOR_VERSION < 2
-+# define g_try_malloc g_malloc
-+#endif
-+
- #define vwidth (view->widget.cols - (view->have_frame ? 2 : 0))
- #define vheight (view->widget.lines - (view->have_frame ? 2 : 0))
-
-@@ -308,7 +312,7 @@
- view->block_ptr = g_realloc (view->block_ptr,
- sizeof (block_ptr_t) * page);
- for (i = view->blocks; i < page; i++) {
-- char *p = g_malloc (VIEW_PAGE_SIZE);
-+ char *p = g_try_malloc (VIEW_PAGE_SIZE);
- view->block_ptr[i].data = p;
- if (!p)
- return '\n';
-@@ -336,7 +340,7 @@
- }
- view->blocks = page;
- }
-- if (byte_index > view->bytes_read) {
-+ if (byte_index >= view->bytes_read) {
- return -1;
- } else
- return view->block_ptr[page - 1].data[offset];
-@@ -573,9 +577,11 @@
- return init_growing_view (view, 0, view->filename);
- }
- #ifdef HAVE_MMAP
-- view->data =
-- mc_mmap (0, view->s.st_size, PROT_READ, MAP_FILE | MAP_SHARED,
-- view->file, 0);
-+ if ((size_t) view->s.st_size == view->s.st_size)
-+ view->data = mc_mmap (0, view->s.st_size, PROT_READ,
-+ MAP_FILE | MAP_SHARED, view->file, 0);
-+ else
-+ view->data = (caddr_t) -1;
- if ((caddr_t) view->data != (caddr_t) - 1) {
- /* mmap worked */
- view->first = 0;
-@@ -589,7 +595,11 @@
- * file into memory (alex@bcs.zaporizhzhe.ua). Also, mmap can fail
- * for any reason, so we use this as fallback (pavel@ucw.cz) */
-
-- view->data = (unsigned char *) g_malloc (view->s.st_size);
-+ if ((gulong) view->s.st_size == view->s.st_size)
-+ view->data = (unsigned char *) g_try_malloc (view->s.st_size);
-+ else
-+ view->data = NULL;
-+
- if (view->data == NULL
- || mc_lseek (view->file, 0, SEEK_SET) != 0
- || mc_read (view->file, view->data,
-@@ -821,7 +831,7 @@
- if (w > 46) {
- widget_move (view, view->have_frame, 24 + view->have_frame);
- if (view->hex_mode)
-- printw (_("Offset 0x%08x"), view->edit_cursor);
-+ printw (_("Offset 0x%08lx"), view->edit_cursor);
- else
- printw (_("Col %d"), -view->start_col);
- }
-@@ -1513,33 +1523,41 @@
- long i = 0;
- int prev = 0;
-
-+ if (!pos && direction == -1)
-+ return 0;
-+
- /* skip over all the possible zeros in the file */
- while ((ch = get_byte (view, pos)) == 0) {
-+ if (!pos && direction == -1)
-+ return 0;
- pos += direction;
- i++;
- }
- *skipped = i;
-
-- if (pos) {
-- prev = get_byte (view, pos - 1);
-+ if (!i && (pos || direction == -1)) {
-+ prev = get_byte (view, pos - direction);
- if ((prev == -1) || (prev == '\n'))
- prev = 0;
- }
-
-- for (i = 0; ch != -1; ch = get_byte (view, pos)) {
-+ for (i = 1; ch != -1; ch = get_byte (view, pos)) {
-
-- if (i == usable_size) {
-+ if (i >= usable_size) {
- buffer = grow_string_buffer (buffer, &buffer_size);
- usable_size = buffer_size - 2;
- }
-
-+ buffer[i++] = ch;
-+ if (!pos && direction == -1)
-+ break;
-+
- pos += direction;
-- i++;
-
- if (ch == '\n' || !ch) {
-+ i--;
- break;
- }
-- buffer[i] = ch;
- }
- if (buffer) {
- buffer[0] = prev;
diff --git a/misc/mc/files/patch-src-widget.c b/misc/mc/files/patch-src-widget.c
deleted file mode 100644
index 578da4fcbff5..000000000000
--- a/misc/mc/files/patch-src-widget.c
+++ /dev/null
@@ -1,24 +0,0 @@
---- src/widget.c.orig Thu Dec 26 05:15:48 2002
-+++ src/widget.c Tue Jun 15 03:15:09 2004
-@@ -607,7 +607,7 @@
- if (!g->shown)
- printw ("%*s", gauge_len, "");
- else {
-- long percentage, columns;
-+ int percentage, columns;
- long total = g->max, done = g->current;
-
- if (total <= 0 || done < 0) {
-@@ -1255,10 +1255,11 @@
- {
- int first = min (x_first, x_last);
- int last = max (x_first, x_last);
-+ size_t len = strlen (&in->buffer [last]) + 1;
-
- in->point = first;
- in->mark = first;
-- strcpy (&in->buffer [first], &in->buffer [last]);
-+ memmove (&in->buffer [first], &in->buffer [last], len);
- in->need_push = 1;
- }
-
diff --git a/misc/mc/files/patch-src-wtools.c b/misc/mc/files/patch-src-wtools.c
deleted file mode 100644
index 4a85fdde2e52..000000000000
--- a/misc/mc/files/patch-src-wtools.c
+++ /dev/null
@@ -1,12 +0,0 @@
---- src/wtools.c.orig Thu Nov 14 13:25:19 2002
-+++ src/wtools.c Tue Jun 15 03:15:09 2004
-@@ -412,8 +412,7 @@
- /* we need a unique name for tkname because widget.c:history_tool()
- needs a unique name for each dialog - using the header is ideal */
-
-- strncpy (tk_name + 3, header, 60);
-- tk_name[63] = '\0';
-+ g_strlcpy (tk_name + 3, header, 61);
- quick_widgets[2].tkname = tk_name;
-
- len = max (strlen (header), msglen (text, &lines)) + 4;
diff --git a/misc/mc/files/patch-vfs-cpio.c b/misc/mc/files/patch-vfs-cpio.c
deleted file mode 100644
index cf7b72b1beea..000000000000
--- a/misc/mc/files/patch-vfs-cpio.c
+++ /dev/null
@@ -1,141 +0,0 @@
---- vfs/cpio.c.orig Sun Dec 8 07:12:28 2002
-+++ vfs/cpio.c Tue Jun 15 03:15:09 2004
-@@ -103,9 +103,9 @@
-
- static struct defer_inode * defer_find(struct defer_inode *l, struct defer_inode *i)
- {
-- if(!l) return NULL;
-- return l->inumber == i->inumber && l->device == i->device ? l :
-- defer_find(l->next, i);
-+ while (l && (l->inumber != i->inumber || l->device != i->device))
-+ l = l->next;
-+ return l;
- }
-
- static int cpio_skip_padding(vfs_s_super *super)
-@@ -127,8 +127,14 @@
-
- static void cpio_free_archive(vfs *me, vfs_s_super *super)
- {
-+ struct defer_inode *l, *lnext;
- if(super->u.cpio.fd != -1)
-- mc_close(super->u.cpio.fd);
-+ mc_close(super->u.cpio.fd), super->u.cpio.fd = -1;
-+ for (l = super->u.cpio.defered; l; l = lnext) {
-+ lnext = l->next;
-+ g_free (l);
-+ }
-+ super->u.cpio.defered = NULL;
- }
-
- static int cpio_open_cpio_file(vfs *me, vfs_s_super *super, char *name)
-@@ -246,26 +252,34 @@
- #define HEAD_LENGTH (26)
- static int cpio_read_bin_head(vfs *me, vfs_s_super *super)
- {
-- struct old_cpio_header buf;
-+ union {
-+ struct old_cpio_header buf;
-+ short shorts[HEAD_LENGTH >> 1];
-+ } u;
- int len;
- char *name;
- struct stat stat;
-
-- if((len = mc_read(super->u.cpio.fd, (char *)&buf, HEAD_LENGTH)) < HEAD_LENGTH)
-+ if((len = mc_read(super->u.cpio.fd, (char *)&u.buf, HEAD_LENGTH)) < HEAD_LENGTH)
- return STATUS_EOF;
- CPIO_POS(super) += len;
- if(super->u.cpio.type == CPIO_BINRE) {
- int i;
- for(i = 0; i < (HEAD_LENGTH >> 1); i++)
-- ((short *)&buf)[i] = GUINT16_SWAP_LE_BE(((short *)&buf)[i]);
-+ u.shorts[i] = GUINT16_SWAP_LE_BE(u.shorts[i]);
- }
-- g_assert(buf.c_magic == 070707);
-+ g_assert(u.buf.c_magic == 070707);
-
-- name = g_malloc(buf.c_namesize);
-- if((len = mc_read(super->u.cpio.fd, name, buf.c_namesize)) < buf.c_namesize){
-+ if (u.buf.c_namesize == 0 || u.buf.c_namesize > MC_MAXPATHLEN) {
-+ message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"), super->name);
-+ return STATUS_FAIL;
-+ }
-+ name = g_malloc(u.buf.c_namesize);
-+ if((len = mc_read(super->u.cpio.fd, name, u.buf.c_namesize)) < u.buf.c_namesize){
- g_free(name);
- return STATUS_EOF;
- }
-+ name[u.buf.c_namesize - 1] = '\0';
- CPIO_POS(super) += len;
- cpio_skip_padding(super);
-
-@@ -274,15 +288,15 @@
- return STATUS_TRAIL;
- }
-
-- stat.st_dev = buf.c_dev;
-- stat.st_ino = buf.c_ino;
-- stat.st_mode = buf.c_mode;
-- stat.st_nlink = buf.c_nlink;
-- stat.st_uid = buf.c_uid;
-- stat.st_gid = buf.c_gid;
-- stat.st_rdev = buf.c_rdev;
-- stat.st_size = (buf.c_filesizes[0] << 16) | buf.c_filesizes[1];
-- stat.st_atime = stat.st_mtime = stat.st_ctime = (buf.c_mtimes[0] << 16) | buf.c_mtimes[1];
-+ stat.st_dev = u.buf.c_dev;
-+ stat.st_ino = u.buf.c_ino;
-+ stat.st_mode = u.buf.c_mode;
-+ stat.st_nlink = u.buf.c_nlink;
-+ stat.st_uid = u.buf.c_uid;
-+ stat.st_gid = u.buf.c_gid;
-+ stat.st_rdev = u.buf.c_rdev;
-+ stat.st_size = (u.buf.c_filesizes[0] << 16) | u.buf.c_filesizes[1];
-+ stat.st_atime = stat.st_mtime = stat.st_ctime = (u.buf.c_mtimes[0] << 16) | u.buf.c_mtimes[1];
-
- return cpio_create_entry(me, super, &stat, name);
- }
-@@ -310,11 +324,16 @@
- return STATUS_FAIL;
- }
-
-+ if (hd.c_namesize == 0 || hd.c_namesize > MC_MAXPATHLEN) {
-+ message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"), super->name);
-+ return STATUS_FAIL;
-+ }
- name = g_malloc(hd.c_namesize);
- if((len = mc_read(super->u.cpio.fd, name, hd.c_namesize)) < hd.c_namesize) {
- g_free (name);
- return STATUS_EOF;
- }
-+ name[hd.c_namesize - 1] = '\0';
- CPIO_POS(super) += len;
- cpio_skip_padding(super);
-
-@@ -365,11 +384,16 @@
- (super->u.cpio.type == CPIO_CRC && hd.c_magic != 070702))
- return STATUS_FAIL;
-
-+ if (hd.c_namesize == 0 || hd.c_namesize > MC_MAXPATHLEN) {
-+ message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"), super->name);
-+ return STATUS_FAIL;
-+ }
- name = g_malloc(hd.c_namesize);
- if((len = mc_read(super->u.cpio.fd, name, hd.c_namesize)) < hd.c_namesize){
- g_free (name);
- return STATUS_EOF;
- }
-+ name[hd.c_namesize - 1] = '\0';
- CPIO_POS(super) += len;
- cpio_skip_padding(super);
-
-@@ -430,7 +454,8 @@
- message_3s(1, MSG_ERROR, _("Inconsistent hardlinks of\n%s\nin cpio archive\n%s"),
- name, super->name);
- inode = NULL;
-- }
-+ } else if (!inode->st.st_size)
-+ inode->st.st_size = stat->st_size;
- }
- }
-
diff --git a/misc/mc/files/patch-vfs-direntry.c b/misc/mc/files/patch-vfs-direntry.c
deleted file mode 100644
index 8b8c7b7ed7c5..000000000000
--- a/misc/mc/files/patch-vfs-direntry.c
+++ /dev/null
@@ -1,102 +0,0 @@
---- vfs/direntry.c.orig Thu Dec 26 08:21:43 2002
-+++ vfs/direntry.c Tue Jun 15 03:15:09 2004
-@@ -217,13 +217,11 @@
- vfs_s_entry *
- vfs_s_find_entry_tree (vfs *me, vfs_s_inode *root, char *path, int follow, int flags)
- {
-- unsigned int pseg;
-+ size_t pseg;
- vfs_s_entry *ent = NULL;
-- char p[MC_MAXPATHLEN] = "";
-+ char p[MC_MAXPATHLEN] = "", *t = p;
-
- while (root){
-- int t;
--
- while (*path == PATH_SEP) /* Strip leading '/' */
- path++;
-
-@@ -233,9 +231,14 @@
- for (pseg = 0; path[pseg] && path[pseg] != PATH_SEP; pseg++)
- ;
-
-- strcat (p, PATH_SEP_STR);
-- strncpy (p + (t = strlen (p)), path, pseg);
-- p[t + pseg] = '\0';
-+ if (t + pseg + sizeof (PATH_SEP_STR) > p + sizeof (p))
-+ ERRNOR (ENOMEM, NULL);
-+
-+ memcpy (t, PATH_SEP_STR, sizeof (PATH_SEP_STR) - 1);
-+ t += sizeof (PATH_SEP_STR) - 1;
-+ memcpy (t, path, pseg);
-+ t += pseg;
-+ *t = '\0';
-
- for (ent = root->subdir; ent != NULL; ent = ent->next)
- if (strlen (ent->name) == pseg && (!strncmp (ent->name, path, pseg)))
-@@ -375,21 +378,31 @@
-
- /* Convert absolute paths to relative ones */
- if (*linkname == PATH_SEP) {
-- char *p, *q;
-+ char *p, *q, *r, *end;
-
- for (p = path, q = entry->ino->linkname; *p == *q; p++, q++);
- while (*(--q) != PATH_SEP);
- q++;
-+ r = buf;
-+ end = buf + MC_MAXPATHLEN;
- for (;; p++) {
- p = strchr (p, PATH_SEP);
- if (!p) {
-- strcat (buf, q);
-+ size_t len = strlen (q);
-+
-+ if (r + len >= end)
-+ break;
-+
-+ memcpy (r, q, len + 1);
-+ linkname = buf;
- break;
- }
-- strcat (buf, "..");
-- strcat (buf, PATH_SEP_STR);
-+
-+ if (r + sizeof (".." PATH_SEP_STR) > end)
-+ break;
-+ memcpy (r, ".." PATH_SEP_STR, sizeof (".." PATH_SEP_STR) - 1);
-+ r += sizeof (".." PATH_SEP_STR) - 1;
- }
-- linkname = buf;
- }
-
- return (MEDATA->find_entry) (me, entry->dir, linkname, follow - 1, 0);
-@@ -622,8 +635,7 @@
- return NULL;
-
- if (info->cur->name) {
-- strncpy(dir.dent.d_name, info->cur->name, MC_MAXPATHLEN);
-- dir.dent.d_name[MC_MAXPATHLEN] = 0;
-+ g_strlcpy(dir.dent.d_name, info->cur->name, MC_MAXPATHLEN);
- } else {
- vfs_die("Null in structure-cannot happen");
- }
-@@ -729,8 +741,7 @@
- if (ino->linkname == NULL)
- ERRNOR (EFAULT, -1);
-
-- strncpy (buf, ino->linkname, size);
-- *(buf+size-1) = 0;
-+ g_strlcpy (buf, ino->linkname, size);
- return strlen (buf);
- }
-
-@@ -1037,7 +1048,7 @@
- struct vfs_s_inode *ino;
- char buf[MC_MAXPATHLEN];
-
-- strncpy (buf, path, MC_MAXPATHLEN);
-+ g_strlcpy (buf, path, MC_MAXPATHLEN);
- ino = vfs_s_inode_from_path (me, path, FL_FOLLOW | FL_NONE);
-
- if (!ino->localname)
diff --git a/misc/mc/files/patch-vfs-extfs b/misc/mc/files/patch-vfs-extfs
deleted file mode 100644
index 80a869ab9714..000000000000
--- a/misc/mc/files/patch-vfs-extfs
+++ /dev/null
@@ -1,329 +0,0 @@
---- vfs/extfs/rpm.orig Sun Dec 29 15:19:39 2002
-+++ vfs/extfs/rpm Tue Jun 15 03:25:41 2004
-@@ -1,14 +1,17 @@
- #! /bin/sh
- #
- # Written by Erik Troan (ewt@redhat.com) 1996
--# Jakub Jelinek (jj@sunsite.mff.cuni.cz) 1996
-+# Jakub Jelinek (jj@sunsite.mff.cuni.cz) 1996, 2004
- # Tomasz Kłoczko (kloczek@rudy.mif.pg.gda.pl) 1997
- # minor changes by Wojtek Pilorz (wpilorz@bdk.lublin.pl) 1997
- # minor changes by Michele Marziani (marziani@fe.infn.it) 1997
- # bug files by Marc Merlin (marcsoft@merlins.org) 1998
- # locale bugfix by Michal Svec (rebel@penguin.cz) 2000
--# (C) 1996 The Free Software Foundation.
-+# Whitespace(s) & single quote(s) in filename workaround
-+# by Andrew V. Samoilov <sav@bcs.zp.ua> 2004
-+# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=64007
- #
-+# (C) 1996-2004 The Free Software Foundation.
- #
-
- # override any locale for dates
-@@ -22,6 +25,10 @@
- RPM="rpm"
- fi
- RPM2CPIO="rpm2cpio"
-+SED=sed
-+# Surround the whole filename with single quotes and handle specially
-+# \', ' and \ at the end of the string.
-+SEDCMD="s/\\(\\\\\\?\\)'/'\\1\\1\\\\''/g;s/\\\\\$/'\\\\\\\\'/;s/^/'/;s/\$/'/"
-
- mcrpmfs_list ()
- {
-@@ -31,12 +38,13 @@
- if test -z "$MCFASTRPM"; then
- MCFASTRPM=$MCFASTRPM_DFLT
- fi
-+ f="`echo "$1" | $SED "$SEDCMD"`"
- FILEPREF="-r--r--r-- 1 root root "
-- DESC=`$RPM -qip "$1" 2>/dev/null` || {
-+ DESC=`$RPM -qip "$f" 2>/dev/null` || {
- echo "$FILEPREF 0 "`date +"%b %d %H:%M"`" ERROR"
- exit 1
- }
-- DATE=`$RPM -qp --qf "%{BUILDTIME:date}\n" "$1" | cut -c 5-11,21-24`
-+ DATE=`$RPM -qp --qf "%{BUILDTIME:date}\n" "$f" | cut -c 5-11,21-24`
- HEADERSIZE=`echo "$DESC" | wc -c`
- echo "-r--r--r-- 1 root root $HEADERSIZE $DATE HEADER"
- echo "-r-xr-xr-x 1 root root 39 $DATE INSTALL"
-@@ -47,25 +55,25 @@
- echo "$FILEPREF 0 $DATE INFO/BUILDHOST"
- echo "$FILEPREF 0 $DATE INFO/SOURCERPM"
- if test "$MCFASTRPM" = 0 ; then
-- test "`$RPM -qp --qf \"%{DISTRIBUTION}\" \"$1\"`" = "(none)" ||
-+ test "`$RPM -qp --qf \"%{DISTRIBUTION}\" \"$f\"`" = "(none)" ||
- echo "$FILEPREF 0 $DATE INFO/DISTRIBUTION"
-- test "`$RPM -qp --qf \"%{VENDOR}\" \"$1\"`" = "(none)" ||
-+ test "`$RPM -qp --qf \"%{VENDOR}\" \"$f\"`" = "(none)" ||
- echo "$FILEPREF 0 $DATE INFO/VENDOR"
-- test "`$RPM -qp --qf \"%{DESCRIPTION}\" \"$1\"`" = "(none)" ||
-+ test "`$RPM -qp --qf \"%{DESCRIPTION}\" \"$f\"`" = "(none)" ||
- echo "$FILEPREF 0 $DATE INFO/DESCRIPTION"
-- test "`$RPM -qp --qf \"%{SUMMARY}\" \"$1\"`" = "(none)" ||
-+ test "`$RPM -qp --qf \"%{SUMMARY}\" \"$f\"`" = "(none)" ||
- echo "$FILEPREF 0 $DATE INFO/SUMMARY"
-- if test "`$RPM -qp --qf \"%{RPMTAG_PREIN}%{RPMTAG_POSTIN}%{RPMTAG_PREUN}%{RPMTAG_POSTUN}%{VERIFYSCRIPT}\" \"$1\"`" != "(none)(none)(none)(none)(none)"; then
-+ if test "`$RPM -qp --qf \"%{RPMTAG_PREIN}%{RPMTAG_POSTIN}%{RPMTAG_PREUN}%{RPMTAG_POSTUN}%{VERIFYSCRIPT}\" \"$f\"`" != "(none)(none)(none)(none)(none)"; then
- echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS"
-- test "`$RPM -qp --qf \"%{RPMTAG_PREIN}\" \"$1\"`" = '(none)' ||
-+ test "`$RPM -qp --qf \"%{RPMTAG_PREIN}\" \"$f\"`" = '(none)' ||
- echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREIN"
-- test "`$RPM -qp --qf \"%{RPMTAG_POSTIN}\" \"$1\"`" = '(none)' ||
-+ test "`$RPM -qp --qf \"%{RPMTAG_POSTIN}\" \"$f\"`" = '(none)' ||
- echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTIN"
-- test "`$RPM -qp --qf \"%{RPMTAG_PREUN}\" \"$1\"`" = '(none)' ||
-+ test "`$RPM -qp --qf \"%{RPMTAG_PREUN}\" \"$f\"`" = '(none)' ||
- echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREUN"
-- test "`$RPM -qp --qf \"%{RPMTAG_POSTUN}\" \"$1\"`" = '(none)' ||
-+ test "`$RPM -qp --qf \"%{RPMTAG_POSTUN}\" \"$f\"`" = '(none)' ||
- echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTUN"
-- test "`$RPM -qp --qf \"%{VERIFYSCRIPT}\" \"$1\"`" = '(none)' ||
-+ test "`$RPM -qp --qf \"%{VERIFYSCRIPT}\" \"$f\"`" = '(none)' ||
- echo "$FILEPREF 0 $DATE INFO/SCRIPTS/VERIFYSCRIPT"
- echo "$FILEPREF 0 $DATE INFO/SCRIPTS/ALL"
- fi
-@@ -83,15 +91,15 @@
- echo "$FILEPREF 0 $DATE INFO/SCRIPTS/ALL"
- fi
- if test "$MCFASTRPM" = 0 ; then
-- test "`$RPM -qp --qf \"%{PACKAGER}\" \"$1\"`" = "(none)" ||
-+ test "`$RPM -qp --qf \"%{PACKAGER}\" \"$f\"`" = "(none)" ||
- echo "$FILEPREF 0 $DATE INFO/PACKAGER"
-- test "`$RPM -qp --qf \"%{URL}\" \"$1\"`" = "(none)" ||
-+ test "`$RPM -qp --qf \"%{URL}\" \"$f\"`" = "(none)" ||
- echo "$FILEPREF 0 $DATE INFO/URL"
-- test "`$RPM -qp --qf \"%{SERIAL}\" \"$1\"`" = "(none)" ||
-+ test "`$RPM -qp --qf \"%{SERIAL}\" \"$f\"`" = "(none)" ||
- echo "$FILEPREF 0 $DATE INFO/SERIAL"
-- test "`$RPM -qp --qf \"%{COPYRIGHT}\" \"$1\"`" = "(none)" ||
-+ test "`$RPM -qp --qf \"%{COPYRIGHT}\" \"$f\"`" = "(none)" ||
- echo "$FILEPREF 0 $DATE INFO/COPYRIGHT"
-- test "`$RPM -qp --qf \"%{LICENSE}\" \"$1\"`" = "(none)" ||
-+ test "`$RPM -qp --qf \"%{LICENSE}\" \"$f\"`" = "(none)" ||
- echo "$FILEPREF 0 $DATE INFO/LICENSE"
- else
- echo "$FILEPREF 0 $DATE INFO/PACKAGER"
-@@ -105,13 +113,13 @@
- echo "$FILEPREF 0 $DATE INFO/OS"
- echo "$FILEPREF 0 $DATE INFO/SIZE"
- if test "$MCFASTRPM" != 0 ; then
-- $RPM -qp --qf "[%{REQUIRENAME}\n]" "$1" | grep "(none)" > /dev/null ||
-+ $RPM -qp --qf "[%{REQUIRENAME}\n]" "$f" | grep "(none)" > /dev/null ||
- echo "$FILEPREF 0 $DATE INFO/REQUIRENAME"
-- $RPM -qp --qf "[%{OBSOLETES}\n]" "$1" | grep "(none)" > /dev/null ||
-+ $RPM -qp --qf "[%{OBSOLETES}\n]" "$f" | grep "(none)" > /dev/null ||
- echo "$FILEPREF 0 $DATE INFO/OBSOLETES"
-- $RPM -qp --qf "[%{PROVIDES}\n]" "$1" | grep "(none)" > /dev/null ||
-+ $RPM -qp --qf "[%{PROVIDES}\n]" "$f" | grep "(none)" > /dev/null ||
- echo "$FILEPREF 0 $DATE INFO/PROVIDES"
-- test "`$RPM -qp --qf \"%{CHANGELOGTEXT}\" \"$1\"`" = "(none)" ||
-+ test "`$RPM -qp --qf \"%{CHANGELOGTEXT}\" \"$f\"`" = "(none)" ||
- echo "$FILEPREF 0 $DATE INFO/CHANGELOG"
- else
- echo "$FILEPREF 0 $DATE INFO/REQUIRENAME"
-@@ -120,61 +128,55 @@
- echo "$FILEPREF 0 $DATE INFO/CHANGELOG"
- fi
-
-- $RPM2CPIO "$1" | cpio -tv --quiet
- echo "$FILEPREF 0 $DATE CONTENTS.cpio"
- }
-
- mcrpmfs_copyout ()
- {
-+ f="`echo "$1" | $SED "$SEDCMD"`"
- case "$2" in
-- HEADER) $RPM -qip "$1" > "$3"; exit 0;;
-+ HEADER) $RPM -qip "$f" > "$3"; exit 0;;
- INSTALL) echo "# Run this to install this RPM package" > "$3"; exit 0;;
- UPGRADE) echo "# Run this to upgrade this RPM package" > "$3"; exit 0;;
-- ERROR) $RPM -qip "$1" > /dev/null 2> "$3"; exit 0;;
-- INFO/NAME-VERSION-RELEASE) $RPM -qp --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" "$1" > "$3"; exit 0;;
-- INFO/RELEASE) $RPM -qp --qf "%{RELEASE}\n" "$1" > "$3"; exit 0;;
-- INFO/GROUP) $RPM -qp --qf "%{GROUP}\n" "$1" > "$3"; exit 0;;
-- INFO/DISTRIBUTION) $RPM -qp --qf "%{DISTRIBUTION}\n" "$1" > "$3"; exit 0;;
-- INFO/VENDOR) $RPM -qp --qf "%{VENDOR}\n" "$1" > "$3"; exit 0;;
-- INFO/BUILDHOST) $RPM -qp --qf "%{BUILDHOST}\n" "$1" > "$3"; exit 0;;
-- INFO/SOURCERPM) $RPM -qp --qf "%{SOURCERPM}\n" "$1" > "$3"; exit 0;;
-- INFO/DESCRIPTION) $RPM -qp --qf "%{DESCRIPTION}\n" "$1" > "$3"; exit 0;;
-- INFO/PACKAGER) $RPM -qp --qf "%{PACKAGER}\n" "$1" > "$3"; exit 0;;
-- INFO/URL) $RPM -qp --qf "%{URL}\n" "$1" >"$3"; exit 0;;
-- INFO/BUILDTIME) $RPM -qp --qf "%{BUILDTIME:date}\n" "$1" >"$3"; exit 0;;
-- INFO/SERIAL) $RPM -qp --qf "%{SERIAL}\n" "$1" >"$3"; exit 0;;
-- INFO/COPYRIGHT) $RPM -qp --qf "%{COPYRIGHT}\n" "$1" >"$3"; exit 0;;
-- INFO/RPMVERSION) $RPM -qp --qf "%{RPMVERSION}\n" "$1" >"$3"; exit 0;;
-- INFO/REQUIRENAME) $RPM -qp --qf "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]" "$1" >"$3"; exit 0;;
-- INFO/PROVIDES) $RPM -qp --qf "[%{PROVIDES}\n]" "$1" >"$3"; exit 0;;
-- INFO/SCRIPTS/PREIN) $RPM -qp --qf "%{RPMTAG_PREIN}\n" "$1" >"$3"; exit 0;;
-- INFO/SCRIPTS/POSTIN) $RPM -qp --qf "%{RPMTAG_POSTIN}\n" "$1" >"$3"; exit 0;;
-- INFO/SCRIPTS/PREUN) $RPM -qp --qf "%{RPMTAG_PREUN}\n" "$1" >"$3"; exit 0;;
-- INFO/SCRIPTS/POSTUN) $RPM -qp --qf "%{RPMTAG_POSTUN}\n" "$1" >"$3"; exit 0;;
-- INFO/SCRIPTS/VERIFYSCRIPT) $RPM -qp --qf "%{VERIFYSCRIPT}\n" "$1" >"$3"; exit 0;;
-- INFO/SCRIPTS/ALL) $RPM -qp --scripts "$1" > "$3"; exit 0;;
-- INFO/SUMMARY) $RPM -qp --qf "%{SUMMARY}\n" "$1" > "$3"; exit 0;;
-- INFO/OS) $RPM -qp --qf "%{OS}\n" "$1" > "$3"; exit 0;;
-- INFO/CHANGELOG) $RPM -qp --qf "[* %{CHANGELOGTIME:date} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n" "$1" > "$3"; exit 0;;
-- INFO/SIZE) $RPM -qp --qf "%{SIZE} bytes\n" "$1" > "$3"; exit 0;;
-+ ERROR) $RPM -qip "$f" > /dev/null 2> "$3"; exit 0;;
-+ INFO/NAME-VERSION-RELEASE) $RPM -qp --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" "$f" > "$3"; exit 0;;
-+ INFO/RELEASE) $RPM -qp --qf "%{RELEASE}\n" "$f" > "$3"; exit 0;;
-+ INFO/GROUP) $RPM -qp --qf "%{GROUP}\n" "$f" > "$3"; exit 0;;
-+ INFO/DISTRIBUTION) $RPM -qp --qf "%{DISTRIBUTION}\n" "$f" > "$3"; exit 0;;
-+ INFO/VENDOR) $RPM -qp --qf "%{VENDOR}\n" "$f" > "$3"; exit 0;;
-+ INFO/BUILDHOST) $RPM -qp --qf "%{BUILDHOST}\n" "$f" > "$3"; exit 0;;
-+ INFO/SOURCERPM) $RPM -qp --qf "%{SOURCERPM}\n" "$f" > "$3"; exit 0;;
-+ INFO/DESCRIPTION) $RPM -qp --qf "%{DESCRIPTION}\n" "$f" > "$3"; exit 0;;
-+ INFO/PACKAGER) $RPM -qp --qf "%{PACKAGER}\n" "$f" > "$3"; exit 0;;
-+ INFO/URL) $RPM -qp --qf "%{URL}\n" "$f" >"$3"; exit 0;;
-+ INFO/BUILDTIME) $RPM -qp --qf "%{BUILDTIME:date}\n" "$f" >"$3"; exit 0;;
-+ INFO/SERIAL) $RPM -qp --qf "%{SERIAL}\n" "$f" >"$3"; exit 0;;
-+ INFO/COPYRIGHT) $RPM -qp --qf "%{COPYRIGHT}\n" "$f" >"$3"; exit 0;;
-+ INFO/RPMVERSION) $RPM -qp --qf "%{RPMVERSION}\n" "$f" >"$3"; exit 0;;
-+ INFO/REQUIRENAME) $RPM -qp --qf "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]" "$f" >"$3"; exit 0;;
-+ INFO/PROVIDES) $RPM -qp --qf "[%{PROVIDES}\n]" "$f" >"$3"; exit 0;;
-+ INFO/SCRIPTS/PREIN) $RPM -qp --qf "%{RPMTAG_PREIN}\n" "$f" >"$3"; exit 0;;
-+ INFO/SCRIPTS/POSTIN) $RPM -qp --qf "%{RPMTAG_POSTIN}\n" "$f" >"$3"; exit 0;;
-+ INFO/SCRIPTS/PREUN) $RPM -qp --qf "%{RPMTAG_PREUN}\n" "$f" >"$3"; exit 0;;
-+ INFO/SCRIPTS/POSTUN) $RPM -qp --qf "%{RPMTAG_POSTUN}\n" "$f" >"$3"; exit 0;;
-+ INFO/SCRIPTS/VERIFYSCRIPT) $RPM -qp --qf "%{VERIFYSCRIPT}\n" "$f" >"$3"; exit 0;;
-+ INFO/SCRIPTS/ALL) $RPM -qp --scripts "$f" > "$3"; exit 0;;
-+ INFO/SUMMARY) $RPM -qp --qf "%{SUMMARY}\n" "$f" > "$3"; exit 0;;
-+ INFO/OS) $RPM -qp --qf "%{OS}\n" "$f" > "$3"; exit 0;;
-+ INFO/CHANGELOG) $RPM -qp --qf "[* %{CHANGELOGTIME:date} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n" "$f" > "$3"; exit 0;;
-+ INFO/SIZE) $RPM -qp --qf "%{SIZE} bytes\n" "$f" > "$3"; exit 0;;
- CONTENTS.cpio) $RPM2CPIO "$1" > "$3"; exit 0;;
- *)
-- TMPDIR=/tmp/mctmpdir.$$
-- mkdir $TMPDIR || exit 1
-- cd $TMPDIR
-- # Files in RPM version 4 and above start with "./" - try both
-- $RPM2CPIO "$1" | cpio -iumd --quiet "$2" "./$2" >/dev/null
-- mv "$2" "$3" 2>/dev/null
-- cd /
-- rm -rf $TMPDIR;;
-+ ;;
- esac
- }
-
- mcrpmfs_run ()
- {
-+ f="`echo "$1" | $SED "$SEDCMD"`"
- case "$2" in
-- INSTALL) echo "Installing \"$1\""; $RPM -ivh "$1"; exit 0;;
-- UPGRADE) echo "Upgrading \"$1\""; $RPM -iUvh "$1"; exit 0;;
-+ INSTALL) echo "Installing \"$1\""; $RPM -ivh "$f"; exit 0;;
-+ UPGRADE) echo "Upgrading \"$1\""; $RPM -Uvh "$f"; exit 0;;
- esac
- }
-
---- vfs/extfs/uar.in.orig Thu Dec 12 15:21:35 2002
-+++ vfs/extfs/uar.in Tue Jun 15 03:15:09 2004
-@@ -22,8 +22,7 @@
-
- mcarfs_copyin ()
- {
-- TMPDIR=/tmp/mctmpdir-uar.$$
-- mkdir $TMPDIR || exit 1
-+ TMPDIR=`mktemp -d ${MC_TMPDIR:-/tmp}/mctmpdir-uar.XXXXXX` || exit 1
- name=`basename "$2"`
- (cd $TMPDIR && cp -fp "$3" $name && $XAR r "$1" $name)
- rm -rf $TMPDIR
---- vfs/extfs/uha.in.orig Sat Dec 14 11:10:53 2002
-+++ vfs/extfs/uha.in Tue Jun 15 03:15:09 2004
-@@ -31,8 +31,7 @@
-
- mchafs_copyout ()
- {
-- TMPDIR="/tmp/mctmpdir-uha.$$"
-- mkdir $TMPDIR || exit 1
-+ TMPDIR=`mktemp -d ${MC_TMPDIR:-/tmp}/mctmpdir-uha.XXXXXX` || exit 1
- cd $TMPDIR
-
- $HA xyq "$1" "$2" >/dev/null
---- vfs/extfs/ulha.in.orig Sat Dec 14 10:39:10 2002
-+++ vfs/extfs/ulha.in Tue Jun 15 03:15:09 2004
-@@ -35,12 +35,6 @@
- LHA_GET="lha pq"
- LHA_PUT="lha aq"
-
--# Define a directory to create a temporary file for when
--# running a command to be run from the archive
--TMPDIR="/tmp/mctmpdir-uha.$$"
--# Temporary file within the directory
--TMPCMD=$TMPDIR/run
--
- # The 'list' command executive
-
- mc_lha_fs_list()
-@@ -121,9 +115,9 @@
-
- mc_lha_fs_run()
- {
-+ TMPDIR=`mktemp -d ${MC_TMPDIR:-/tmp}/mctmpdir-ulha.XXXXXX` || exit 1
- trap "rm -rf $TMPDIR; exit 0" 1 2 3 4 15
-- # FIXME: Try harder to generate a unique directory if this fails
-- mkdir -m 0700 $TMPDIR || exit 1
-+ TMPCMD=$TMPDIR/run
- $LHA_GET "$1" "$2" > $TMPCMD
- chmod a+x $TMPCMD
- $TMPCMD
---- vfs/extfs/urar.in.orig Fri Jan 24 21:56:25 2003
-+++ vfs/extfs/urar.in Tue Jun 15 03:15:09 2004
-@@ -77,8 +77,7 @@
- # preserve pwd. It is clean, but is it necessary?
- pwd=`pwd`
- # Create a directory and create in it a tmp directory with the good name
-- dir=tmpdir.${RANDOM}
-- mkdir $dir
-+ dir=`mktemp -d ${MC_TMPDIR:-/tmp}/mctmpdir-urar.XXXXXX` || exit 1
- cd $dir
- mkdir -p "$2"
- # rar cannot create an empty directory
---- vfs/extfs/uzip.in.orig Thu Dec 12 15:15:20 2002
-+++ vfs/extfs/uzip.in Tue Jun 15 03:18:53 2004
-@@ -76,7 +76,7 @@
- sub mczipfs_rmdir {
- my ($qfile) = map { &zipquotemeta($_) } @_;
- &checkargs(1, 'archive directory', @_);
-- &safesystem("$cmd_delete $qarchive $qfile/ >/dev/null", 12);
-+ &safesystem("$cmd_delete $qarchive $qfile/ >/dev/null 2>&1", 12);
- exit;
- }
-
-@@ -87,7 +87,7 @@
- my ($qafile, $qfsfile) = map { &zipquotemeta($_) } @_;
- &checkargs(1, 'archive file', @_);
- &checkargs(2, 'local file', @_);
-- &safesystem("$cmd_extract $qarchive $qafile > $qfsfile", 11);
-+ &safesystem("$cmd_extract $qarchive $qafile > $qfsfile 2>/dev/null", 11);
- exit;
- }
-
-@@ -344,10 +344,10 @@
-
- # Make a temporary directory with mode 0700.
- sub mktmpdir {
-- while (1) {
-- my $dir = POSIX::tmpnam();
-- return $dir if mkdir ($dir, 0700);
-- }
-+ use File::Temp qw(mkdtemp);
-+ my $template = "/tmp/mcuzipfs.XXXXXX";
-+ $template="$ENV{MC_TMPDIR}/mcuzipfs.XXXXXX" if ($ENV{MC_TMPDIR});
-+ return mkdtemp($template);
- }
-
- # Make a filename absolute and return it.
---- vfs/extfs/uzoo.in.orig Sat Dec 14 10:29:13 2002
-+++ vfs/extfs/uzoo.in Tue Jun 15 03:15:09 2004
-@@ -13,8 +13,7 @@
- # it to a temporary directory.
- mklink ()
- {
-- TMPDIR="/tmp/mctmpdir-uzoo.$$"
-- mkdir $TMPDIR || exit 1
-+ TMPDIR=`mktemp -d ${MC_TMPDIR:-/tmp}/mctmpdir-uzoo.XXXXXX` || exit 1
- trap 'cd /; rm -rf $TMPDIR' 0 1 2 3 5 13 15
- ARCHIVE=$TMPDIR/tmp.zoo
- ln -sf "$1" "$ARCHIVE"
diff --git a/misc/mc/files/patch-vfs-extfs-a.in b/misc/mc/files/patch-vfs-extfs-a.in
deleted file mode 100644
index 07a5517329e1..000000000000
--- a/misc/mc/files/patch-vfs-extfs-a.in
+++ /dev/null
@@ -1,83 +0,0 @@
---- vfs/extfs/a.in.orig Thu Dec 12 02:57:00 2002
-+++ vfs/extfs/a.in Fri Sep 10 16:09:30 2004
-@@ -8,6 +8,13 @@
- #
-
- # These mtools components must be in PATH for this to work
-+
-+sub quote {
-+ $_ = shift(@_);
-+ s/([^\w\/.+-])/\\$1/g;
-+ return($_);
-+}
-+
- $mmd = "mmd";
- $mrd = "mrd";
- $mdel = "mdel";
-@@ -15,7 +22,7 @@
- $mcopy = "mcopy -noQ";
-
- $0 =~ s|.*/||;
--$disk = $0;
-+$qdisk = quote($0);
-
- $ENV{MTOOLS_DATE_STRING} = "mm-dd-yyyy";
- $ENV{MTOOLS_TWENTY_FOUR_HOUR_CLOCK} = "1";
-@@ -29,29 +36,36 @@
- /mkdir/ && do {
- shift; shift;
- exit 1 if scalar(@ARGV) != 1;
-- system("$mmd $disk:/$ARGV[0] >/dev/null");
-+ $qname = quote($ARGV[0]);
-+ system("$mmd $qdisk:/$qname >/dev/null");
- exit 0; };
- /rmdir/ && do {
- shift; shift;
- exit 1 if scalar(@ARGV) != 1;
-- system("$mrd $disk:/$ARGV[0] >/dev/null");
-+ $qname = quote($ARGV[0]);
-+ system("$mrd $qdisk:/$qname >/dev/null");
- exit 0; };
- /rm/ && do {
- shift; shift;
- exit 1 if scalar(@ARGV) != 1;
-- system("$mdel $disk:/$ARGV[0] >/dev/null");
-+ $qname = quote($ARGV[0]);
-+ system("$mdel $qdisk:/$qname >/dev/null");
- exit 0; };
- /copyout/ && do {
- shift; shift;
- exit 1 if scalar(@ARGV) != 2;
-- ( $src, $dest ) = @ARGV;
-- system("$mcopy $disk:/$src $dest >/dev/null");
-+ ( $qsrc, $qdest ) = @ARGV;
-+ $qsrc = quote($qsrc);
-+ $qdest = quote($qdest);
-+ system("$mcopy $qdisk:/$qsrc $qdest >/dev/null");
- exit 0; };
- /copyin/ && do {
- shift; shift;
- exit 1 if scalar(@ARGV) != 2;
-- ( $dest, $src ) = @ARGV;
-- system("$mcopy $src $disk:/$dest >/dev/null");
-+ ( $qdest, $qsrc ) = @ARGV;
-+ $qsrc = quote($qsrc);
-+ $qdest = quote($qdest);
-+ system("$mcopy $qsrc $qdisk:/$qdest >/dev/null");
- exit 0; };
- /.*/ && do { # an unfamiliar command
- exit 1; };
-@@ -59,11 +73,11 @@
-
- sub get_dirs {
- my ($path, $name, $size, $date, $time, $longname, @lst, @rv);
--
- $path = shift(@_);
-+ my $qpath = quote($path);
- @rv = ();
-
-- open(FILE,"$mdir $disk:/$path |");
-+ open(FILE,"$mdir $qdisk:/$qpath |");
- while ( <FILE> ) {
- chomp();
- /^ / && next; # ignore `non-file' lines
diff --git a/misc/mc/files/patch-vfs-extfs-apt.in b/misc/mc/files/patch-vfs-extfs-apt.in
deleted file mode 100644
index e5857faaa26e..000000000000
--- a/misc/mc/files/patch-vfs-extfs-apt.in
+++ /dev/null
@@ -1,102 +0,0 @@
---- vfs/extfs/apt.in.orig Tue Dec 24 12:33:46 2002
-+++ vfs/extfs/apt.in Fri Sep 10 16:09:30 2004
-@@ -6,6 +6,12 @@
- #
- # apt
-
-+sub quote {
-+ $_ = shift(@_);
-+ s/([^\w\/.+-])/\\$1/g;
-+ return($_);
-+}
-+
- sub bt
- {
- my ($dt) = @_;
-@@ -229,14 +235,16 @@
- sub copyout
- {
- my($archive,$filename) = @_;
-+ my $qarchive = quote($archive);
-+ my $qfilename = quote($filename);
- if( $archive eq 'CHECK' ) {
-- system("apt-get -q check > $filename");
-+ system("apt-get -q check > $qfilename");
- } elsif( $archive eq 'AVAILABLE' ) {
-- system("apt-cache dumpavail > $filename");
-+ system("apt-cache dumpavail > $qfilename");
- } elsif( $archive eq 'STATS' ) {
-- system("apt-cache stats > $filename");
-+ system("apt-cache stats > $qfilename");
- } elsif( $archive eq 'CONFIG' ) {
-- system("(apt-config dump 2>&1) > $filename");
-+ system("(apt-config dump 2>&1) > $qfilename");
- } elsif( $archive eq 'UPDATE' ) {
- open O, ">$filename";
- print O $pressupdate;
-@@ -246,12 +254,12 @@
- print O $pressupgrade;
- close O;
- } elsif( $archive eq 'apt.conf' ) {
-- system("cp /etc/apt/apt.conf $filename");
-+ system("cp /etc/apt/apt.conf $qfilename");
- } elsif( $archive eq 'sources.list' ) {
-- system("cp /etc/apt/sources.list $filename");
-+ system("cp /etc/apt/sources.list $qfilename");
- } elsif( $archive =~ /^CACHE\// ) {
- $archive =~ s%^CACHE/%/var/cache/apt/archives/%;
-- system("cp $archive $filename");
-+ system("cp $qarchive $qfilename");
- } else {
- open O, ">$filename";
- print O $archive, "\n";
-@@ -262,15 +270,17 @@
- sub copyin
- {
- my($archive,$filename) = @_;
-+ my $qarchive = quote($archive);
-+ my $qfilename = quote($filename);
- if( $archive =~ /\.deb$/ ) {
-- system("dpkg -i $filename>/dev/null");
-+ system("dpkg -i $qfilename>/dev/null");
- } elsif( $archive eq 'apt.conf' ) {
-- system("cp $filename /etc/apt/apt.conf");
-+ system("cp $qfilename /etc/apt/apt.conf");
- } elsif( $archive eq 'sources.list' ) {
-- system("cp $filename /etc/apt/sources.list");
-+ system("cp $qfilename /etc/apt/sources.list");
- } elsif( $archive =~ /^CACHE\// ) {
-- $archive =~ s%^CACHE/%/var/cache/apt/archives/%;
-- system("cp $filename $archive");
-+ $qarchive =~ s%^CACHE/%/var/cache/apt/archives/%;
-+ system("cp $qfilename $qarchive");
- } else {
- die "extfs: cannot create regular file \`$archive\': Permission denied\n";
- }
-@@ -293,19 +303,20 @@
- sub rm
- {
- my($archive) = @_;
-+ my $qarchive = quote($archive);
- if( $archive =~ /^CACHE\// ) {
-- $archive =~ s%^CACHE/%/var/cache/apt/archives/%;
-- system("rm -f $archive");
-+ $qarchive =~ s%^CACHE/%/var/cache/apt/archives/%;
-+ system("rm -f $qarchive");
- } elsif( $archive eq 'apt.conf' ) {
- system("rm -f /etc/apt/apt.conf");
- } elsif( $archive eq 'sources.list' ) {
- system("rm -f /etc/apt/sources.list");
- } elsif( $archive =~ /\.debd?$/ ) {
- # uncommented and changed to use dpkg - alpha
-- my $name = $archive;
-- $name =~ s%.*/%%g;
-- $name =~ s%_.*%%g;
-- system("dpkg --remove $name >/dev/null");
-+ my $qname = $qarchive;
-+ $qname =~ s%.*/%%g;
-+ $qname =~ s%_.*%%g;
-+ system("dpkg --remove $qname >/dev/null");
- die("extfs: $archive: Operation not permitted\n") if $? != 0;
- } else {
- die "extfs: $archive: Operation not permitted\n";
diff --git a/misc/mc/files/patch-vfs-extfs-deb.in b/misc/mc/files/patch-vfs-extfs-deb.in
deleted file mode 100644
index 5e276d96fab6..000000000000
--- a/misc/mc/files/patch-vfs-extfs-deb.in
+++ /dev/null
@@ -1,113 +0,0 @@
---- vfs/extfs/deb.in.orig Fri Sep 10 16:22:18 2004
-+++ vfs/extfs/deb.in Fri Sep 10 16:22:25 2004
-@@ -19,6 +19,12 @@
- # Copyright (C) 1997 Free Software Foundation
- #
-
-+sub quote {
-+ $_ = shift(@_);
-+ s/([^\w\/.+-])/\\$1/g;
-+ return($_);
-+}
-+
- sub mcdebfs_list
- {
- #
-@@ -26,8 +32,9 @@
- # Empty directories do not appear at all
- #
- local($archivename)=@_;
-+ local $qarchivename = quote($archivename);
- chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`);
-- chop($info_size=`dpkg -I $archivename | wc -c`);
-+ chop($info_size=`dpkg -I $qarchivename | wc -c`);
- $install_size=length($pressinstall);
-
- print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
-@@ -36,7 +43,7 @@
- print "-r--r--r-- 1 root root $info_size $date INFO\n";
- print "-r-xr--r-- 1 root root $install_size $date INSTALL\n";
-
-- if ( open(PIPEIN, "dpkg-deb -c $archivename |") )
-+ if ( open(PIPEIN, "dpkg-deb -c $qarchivename |") )
- {
- while(<PIPEIN>)
- {
-@@ -81,7 +88,7 @@
- }
- }
- # begin from Patrik Rak
-- if ( open(PIPEIN, "dpkg-deb -I $archivename |") )
-+ if ( open(PIPEIN, "dpkg-deb -I $qarchivename |") )
- {
- while(<PIPEIN>)
- {
-@@ -109,16 +116,19 @@
- sub mcdebfs_copyout
- {
- local($archive,$filename,$destfile)=@_;
-+ local $qarchive = quote($archive);
-+ local $qfilename = quote($filename);
-+ local $qdestfile = quote($destfile);
-
- if($filename eq "INFO")
- {
-- system("dpkg-deb -I $archive > $destfile");
-+ system("dpkg-deb -I $qarchive > $qdestfile");
- # begin from Patrik Rak
- }
- elsif($filename =~ /^DEBIAN/)
- {
-- $filename=~s!^DEBIAN/!!;
-- system("dpkg-deb -I $archive $filename > $destfile");
-+ $qfilename=~s!^DEBIAN/!!;
-+ system("dpkg-deb -I $qarchive $qfilename > $qdestfile");
- # end from Patrik Rak
-
- }
-@@ -128,36 +138,32 @@
- {
- print FILEOUT $pressinstall;
- close FILEOUT;
-- system("chmod a+x $destfile");
-+ system("chmod a+x $qdestfile");
- }
- }
- else
- {
- # files can be prepended with ./ or not, depending on the version of tar
-- $filename=~s!^CONTENTS/!!;
-- system("dpkg-deb --fsys-tarfile $archive | tar xOf - $filename ./$filename > $destfile 2>/dev/null");
-+ $qfilename=~s!^CONTENTS/!!;
-+ system("dpkg-deb --fsys-tarfile $qarchive | tar xOf - $qfilename ./$qfilename > $qdestfile 2>/dev/null");
- }
- }
-
- sub mcdebfs_run
- {
- local($archive,$filename)=@_;
-+ local $qarchive = quote($archive);
- if($filename eq "INSTALL")
- {
- print "Installing $archive\n";
-- system("dpkg -i $archive");
-+ system("dpkg -i $qarchive");
- }
- else
- {
-- $suffix = "aaa";
-- while (1) {
-- $tmpdir = "/tmp/mcdebfs.run".$$.$suffix;
-- last if mkdir $tmpdir, 0700;
-- $suffix++;
-- # Somebody is being really nasty, give up
-- exit 1 if $suffix eq "zzz";
-- }
--
-+ use File::Temp qw(mkdtemp);
-+ my $template = "/tmp/mcdebfs.run.XXXXXX";
-+ $template="$ENV{MC_TMPDIR}/mcdebfs.XXXXXX" if ($ENV{MC_TMPDIR});
-+ $tmpdir = mkdtemp($template);
- $tmpcmd="$tmpdir/run";
- &mcdebfs_copyout($archive, $filename, $tmpcmd);
- system("chmod u+x $tmpcmd");
diff --git a/misc/mc/files/patch-vfs-extfs-deba.in b/misc/mc/files/patch-vfs-extfs-deba.in
deleted file mode 100644
index 6bca535864cb..000000000000
--- a/misc/mc/files/patch-vfs-extfs-deba.in
+++ /dev/null
@@ -1,165 +0,0 @@
---- vfs/extfs/deba.in.orig Thu Dec 12 22:15:30 2002
-+++ vfs/extfs/deba.in Fri Sep 10 16:09:30 2004
-@@ -6,111 +6,25 @@
- #
- # deba
-
--sub bt
--{
-- my ($dt) = @_;
-- my (@time);
-- @time = localtime($dt);
-- $bt = sprintf "%02d-%02d-%d %02d:%02d", $time[4] + 1, $time[3],
-- $time[5] + 1900, $time[2], $time[1];
-- return $bt;
--}
--
--
--sub ft
--{
-- my ($f) = @_;
-- return "d" if -d $f;
-- return "l" if -l $f;
-- return "p" if -p $f;
-- return "S" if -S $f;
-- return "b" if -b $f;
-- return "c" if -c $f;
-- return "-";
--}
--
--sub fm
--{
-- my ($n) = @_;
-- my ($m);
--
-- if( $n & 0400 ) {
-- $m .= "r";
-- } else {
-- $m .= "-";
-- }
-- if( $n & 0200 ) {
-- $m .= "w";
-- } else {
-- $m .= "-";
-- }
-- if( $n & 04000 ) {
-- $m .= "s";
-- } elsif( $n & 0100 ) {
-- $m .= "x";
-- } else {
-- $m .= "-";
-- }
--
-- if( $n & 0040 ) {
-- $m .= "r";
-- } else {
-- $m .= "-";
-- }
-- if( $n & 0020 ) {
-- $m .= "w";
-- } else {
-- $m .= "-";
-- }
-- if( $n & 02000 ) {
-- $m .= "s";
-- } elsif( $n & 0010 ) {
-- $m .= "x";
-- } else {
-- $m .= "-";
-- }
--
-- if( $n & 0004 ) {
-- $m .= "r";
-- } else {
-- $m .= "-";
-- }
-- if( $n & 0002 ) {
-- $m .= "w";
-- } else {
-- $m .= "-";
-- }
-- if( $n & 01000 ) {
-- $m .= "t";
-- } elsif( $n & 0001 ) {
-- $m .= "x";
-- } else {
-- $m .= "-";
-- }
--
-- return $m;
--}
--
--sub ls {
-- my ($file) = @_;
-- my @stat = stat($file);
-- # mode, nlink, uid, gid, size, mtime, filename
-- printf "%s%s %d %d %d %d %s CONTENTS%s\n", ft($file), fm($stat[2] & 07777),
-- $stat[3], $stat[4], $stat[5], $stat[7], bt($stat[9]), $file;
-+sub quote {
-+ $_ = shift(@_);
-+ s/([^\w\/.+-])/\\$1/g;
-+ return($_);
- }
-
- sub list
- {
-- my($archive)=@_;
-+ my($qarchive)=@_;
-+ $qarchive = quote($qarchive);
- chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`);
-- chop($info_size=`apt-cache show $archive | wc -c`);
-+ chop($info_size=`apt-cache show $qarchive | wc -c`);
- $install_size=length($pressinstall);
- $upgrade_size=length($pressupgrade);
-
- print "-r--r--r-- 1 root root $info_size $date INFO\n";
-
-- chop($debd = `dpkg -s $archive | grep -i ^Version | sed 's/^version: //i'`);
-- chop($deba = `apt-cache show $archive | grep -i ^Version | sed 's/^version: //i'`);
-+ chop($debd = `dpkg -s $qarchive | grep -i ^Version | sed 's/^version: //i'`);
-+ chop($deba = `apt-cache show $qarchive | grep -i ^Version | sed 's/^version: //i'`);
- if( ! $debd ) {
- print "-r-xr--r-- 1 root root $install_size $date INSTALL\n";
- } elsif( $debd ne $deba ) {
-@@ -121,20 +35,21 @@
- sub copyout
- {
- my($archive,$filename,$destfile)=@_;
--
-+ my $qarchive = quote($archive);
-+ my $qdestfile = quote($destfile);
- if($filename eq "INFO") {
-- system("apt-cache show $archive > $destfile");
-+ system("apt-cache show $qarchive > $qdestfile");
- } elsif($filename eq "INSTALL") {
-- if ( open(FILEOUT,">$destfile") ) {
-+ if ( open(FILEOUT, "> $destfile") ) {
- print FILEOUT $pressinstall;
- close FILEOUT;
-- system("chmod a+x $destfile");
-+ system("chmod a+x $qdestfile");
- }
- } elsif($filename eq "UPGRADE") {
-- if ( open(FILEOUT,">$destfile") ) {
-+ if ( open(FILEOUT, ">, $destfile") ) {
- print FILEOUT $pressupgrade;
- close FILEOUT;
-- system("chmod a+x $destfile");
-+ system("chmod a+x $qdestfile");
- }
- } else {
- die "extfs: $filename: No such file or directory\n";
-@@ -144,10 +59,11 @@
- sub run
- {
- my($archive,$filename)=@_;
-+ my $qarchive = quote($archive);
- if($filename eq "INSTALL") {
-- system("apt-get install $archive");
-+ system("apt-get install $qarchive");
- } elsif($filename eq "UPGRADE") {
-- system("apt-get install $archive");
-+ system("apt-get install $qarchive");
- } else {
- die "extfs: $filename: Permission denied\n";
- }
diff --git a/misc/mc/files/patch-vfs-extfs-debd.in b/misc/mc/files/patch-vfs-extfs-debd.in
deleted file mode 100644
index 559c1bb71908..000000000000
--- a/misc/mc/files/patch-vfs-extfs-debd.in
+++ /dev/null
@@ -1,148 +0,0 @@
---- vfs/extfs/debd.in.orig Thu Dec 12 22:15:30 2002
-+++ vfs/extfs/debd.in Fri Sep 10 16:09:30 2004
-@@ -6,6 +6,12 @@
- #
- # debd
-
-+sub quote {
-+ $_ = shift(@_);
-+ s/([^\w\/.+-])/\\$1/g;
-+ return($_);
-+}
-+
- sub bt
- {
- my ($dt) = @_;
-@@ -102,8 +108,9 @@
- sub list
- {
- my($archive)=@_;
-+ my $qarchive = quote($archive);
- chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`);
-- chop($info_size=`dpkg -s $archive | wc -c`);
-+ chop($info_size=`dpkg -s $qarchive | wc -c`);
- $repack_size=length($pressrepack);
- $reinstall_size=length($pressreinstall);
- $remove_size=length($pressremove);
-@@ -118,7 +125,7 @@
- print "-r--r--r-- 1 root root $info_size $date INFO\n";
- print "-r-xr--r-- 1 root root $purge_size $date DPKG-PURGE\n";
-
-- chop($status = `dpkg -s $archive | grep ^Status`);
-+ chop($status = `dpkg -s $qarchive | grep ^Status`);
- if( $status =~ /deinstall/ ) {
- print "-r-xr--r-- 1 root root $select_size $date DPKG-SELECT\n";
- } elsif( $status =~ /install/ ) {
-@@ -141,7 +148,7 @@
-
-
-
-- if ( open(PIPEIN, "LANG=C ls -l /var/lib/dpkg/info/$archive.* |") ) {
-+ if ( open(PIPEIN, "LANG=C ls -l /var/lib/dpkg/info/$qarchive.* |") ) {
- while(<PIPEIN>) {
- chop;
- next if /\.list$/;
-@@ -163,35 +170,38 @@
- sub copyout
- {
- my($archive,$filename,$destfile)=@_;
-+ my $qarchive = quote($archive);
-+ my $qfilename = quote($filename);
-+ my $qdestfile = quote($destfile);
-
- if($filename eq "INFO") {
-- system("dpkg -s $archive > $destfile");
-+ system("dpkg -s $qarchive > $qdestfile");
- } elsif($filename eq "DPKG-REPACK") {
- if ( open(FILEOUT,">$destfile") ) {
- print FILEOUT $pressrepack;
- close FILEOUT;
-- system("chmod a+x $destfile");
-+ system("chmod a+x $qdestfile");
- }
- } elsif($filename =~ /^DEBIAN/) {
- $filename=~s!^DEBIAN/!!;
-- system("cat /var/lib/dpkg/info/$archive.$filename > $destfile");
-+ system("cat /var/lib/dpkg/info/$qarchive.$qfilename > $qdestfile");
- } elsif($filename eq "DPKG-REMOVE" || $filename eq "APT-REMOVE") {
- if ( open(FILEOUT,">$destfile") ) {
- print FILEOUT $pressremove;
- close FILEOUT;
-- system("chmod a+x $destfile");
-+ system("chmod a+x $qdestfile");
- }
- } elsif($filename eq "DPKG-PURGE" || $filename eq "APT-PURGE") {
- if ( open(FILEOUT,">$destfile") ) {
- print FILEOUT $presspurge;
- close FILEOUT;
-- system("chmod a+x $destfile");
-+ system("chmod a+x $qdestfile");
- }
- } elsif($filename eq "DPKG-RECONFIGURE") {
- if ( open(FILEOUT,">$destfile") ) {
- print FILEOUT $pressreconfigure;
- close FILEOUT;
-- system("chmod a+x $destfile");
-+ system("chmod a+x $qdestfile");
- }
- } elsif($filename eq "APT-REINSTALL") {
- if ( open(FILEOUT,">$destfile") ) {
-@@ -209,41 +219,43 @@
- if ( open(FILEOUT,">$destfile") ) {
- print FILEOUT $pressunselect;
- close FILEOUT;
-- system("chmod a+x $destfile");
-+ system("chmod a+x $qdestfile");
- }
- } else {
-- $filename=~s!^CONTENTS!!;
-- system("cat $filename > $destfile");
-+ $qfilename=~s!^CONTENTS!!;
-+ system("cat $qfilename > $qdestfile");
- }
- }
-
- sub run
- {
- my($archive,$filename)=@_;
-+ my $qarchive = quote($archive);
-+ my $qfilename = quote($filename);
- if($filename eq "DPKG-REMOVE") {
-- system("dpkg --remove $archive");
-+ system("dpkg --remove $qarchive");
- } elsif($filename eq "APT-REMOVE") {
-- system("apt-get remove $archive");
-+ system("apt-get remove $qarchive");
- } elsif($filename eq "DPKG-PURGE") {
-- system("dpkg --purge $archive");
-+ system("dpkg --purge $qarchive");
- } elsif($filename eq "APT-PURGE") {
-- system("apt-get --purge remove $archive");
-+ system("apt-get --purge remove $qarchive");
- } elsif($filename eq "DPKG-REPACK") {
-- system("dpkg-repack $archive");
-+ system("dpkg-repack $qarchive");
- } elsif($filename eq "DPKG-SELECT") {
-- system("echo $archive install | dpkg --set-selections");
-+ system("echo $aqrchive install | dpkg --set-selections");
- } elsif($filename eq "DPKG-UNSELECT") {
-- system("echo $archive deinstall | dpkg --set-selections");
-+ system("echo $qarchive deinstall | dpkg --set-selections");
- } elsif($filename eq "APT-REINSTALL") {
-- system("apt-get -u --reinstall install $archive");
-+ system("apt-get -u --reinstall install $qarchive");
- } elsif($filename eq "DPKG-RECONFIGURE") {
-- system("dpkg-reconfigure $archive");
-+ system("dpkg-reconfigure $qarchive");
- } elsif($filename=~/^DEBIAN/) {
- $filename=~s!^DEBIAN!!;
-- system("/var/lib/dpkg/info/$archive.$filename");
-+ system("/var/lib/dpkg/info/$qarchive.$qfilename");
- } else {
-- $filename=~s!^CONTENTS!!;
-- system($filename);
-+ $qfilename=~s!^CONTENTS!!;
-+ system($qfilename);
- }
- }
-
diff --git a/misc/mc/files/patch-vfs-extfs-dpkg.in b/misc/mc/files/patch-vfs-extfs-dpkg.in
deleted file mode 100644
index df42b23c4294..000000000000
--- a/misc/mc/files/patch-vfs-extfs-dpkg.in
+++ /dev/null
@@ -1,74 +0,0 @@
---- vfs/extfs/dpkg.in.orig Tue Dec 24 12:33:46 2002
-+++ vfs/extfs/dpkg.in Fri Sep 10 16:09:30 2004
-@@ -6,6 +6,12 @@
- #
- # dpkg
-
-+sub quote {
-+ $_ = shift(@_);
-+ s/([^\w\/.+-])/\\$1/g;
-+ return($_);
-+}
-+
- sub bt
- {
- my ($dt) = @_;
-@@ -183,20 +189,21 @@
- sub copyout
- {
- my($archive,$filename) = @_;
-+ my $qfilename = quote($filename);
- if( $archive eq 'DIVERSIONS' ) {
-- system("dpkg-divert --list > $filename 2>/dev/null");
-+ system("dpkg-divert --list > $qfilename 2>/dev/null");
- } elsif( $archive eq 'ARCHITECTURE' ) {
-- system("dpkg-architecture > $filename 2>/dev/null");
-+ system("dpkg-architecture > $qfilename 2>/dev/null");
- } elsif( $archive eq 'LIST' ) {
-- system("dpkg -l '*' > $filename 2>/dev/null");
-+ system("dpkg -l '*' > $qfilename 2>/dev/null");
- } elsif( $archive eq 'AUDIT' ) {
-- system("dpkg --audit > $filename 2>/dev/null");
-+ system("dpkg --audit > $qfilename 2>/dev/null");
- } elsif( $archive eq 'GET-SELECTIONS' ) {
-- system("dpkg --get-selections > $filename 2>/dev/null");
-+ system("dpkg --get-selections > $qfilename 2>/dev/null");
- } elsif( $archive eq 'STATUS' ) {
-- system("cp /var/lib/dpkg/status $filename");
-+ system("cp /var/lib/dpkg/status $qfilename");
- } elsif( $archive eq 'AVAILABLE' ) {
-- system("cp /var/lib/dpkg/available $filename");
-+ system("cp /var/lib/dpkg/available $qfilename");
- } elsif( $archive eq 'CONFIGURE' ) {
- open O, ">$filename";
- print O $pressconfigure;
-@@ -224,8 +231,9 @@
- sub copyin
- {
- my($archive,$filename) = @_;
-+ my $qfilename = quote($filename);
- if( $archive =~ /\.deb$/ ) {
-- system("dpkg -i $filename>/dev/null");
-+ system("dpkg -i $qfilename>/dev/null");
- } else {
- die "extfs: cannot create regular file \`$archive\': Permission denied\n";
- }
-@@ -252,12 +260,12 @@
- {
- my($archive) = @_;
- if( $archive =~ /\.debd?$/ ) {
-- my $name = $archive;
-- $name =~ s%.*/%%g;
-- $name =~ s%_.*%%g;
-- system("if dpkg -s $name | grep ^Status | grep -qs config-files; \
-- then dpkg --purge $name>/dev/null; \
-- else dpkg --remove $name>/dev/null; fi");
-+ my $qname = quote($archive);
-+ $qname =~ s%.*/%%g;
-+ $qname =~ s%_.*%%g;
-+ system("if dpkg -s $qname | grep ^Status | grep -qs config-files; \
-+ then dpkg --purge $qname>/dev/null; \
-+ else dpkg --remove $qname>/dev/null; fi");
- die("extfs: $archive: Operation not permitted\n") if $? != 0;
- } else {
- die "extfs: $archive: Operation not permitted\n";
diff --git a/misc/mc/files/patch-vfs-extfs.c b/misc/mc/files/patch-vfs-extfs.c
deleted file mode 100644
index 105d9d96f2c8..000000000000
--- a/misc/mc/files/patch-vfs-extfs.c
+++ /dev/null
@@ -1,26 +0,0 @@
---- vfs/extfs.c.orig Thu Dec 26 03:42:59 2002
-+++ vfs/extfs.c Tue Jun 15 03:15:09 2004
-@@ -888,8 +888,7 @@
- if (!*info)
- return NULL;
-
-- strncpy(dir.dent.d_name, (*info)->name, MC_MAXPATHLEN);
-- dir.dent.d_name[MC_MAXPATHLEN] = 0;
-+ g_strlcpy(dir.dent.d_name, (*info)->name, MC_MAXPATHLEN);
-
- compute_namelen(&dir.dent);
- *info = (*info)->next_in_dir;
-@@ -1002,10 +1001,10 @@
- if (entry == NULL)
- return -1;
- if (!S_ISLNK (entry->inode->mode)) ERRNOR (EINVAL, -1);
-- if (size > (i = strlen (entry->inode->linkname))) {
-- size = i;
-+ if (size < (i = strlen (entry->inode->linkname))) {
-+ i = size;
- }
-- strncpy (buf, entry->inode->linkname, i);
-+ memcpy (buf, entry->inode->linkname, i);
- return i;
- }
-
diff --git a/misc/mc/files/patch-vfs-fish.c b/misc/mc/files/patch-vfs-fish.c
deleted file mode 100644
index 634580bacce0..000000000000
--- a/misc/mc/files/patch-vfs-fish.c
+++ /dev/null
@@ -1,21 +0,0 @@
---- vfs/fish.c.orig Thu Dec 26 08:21:43 2002
-+++ vfs/fish.c Tue Jun 15 03:15:09 2004
-@@ -96,8 +96,7 @@
- if (strncmp(answer, "### ", 4)) {
- was_garbage = 1;
- if (string_buf) {
-- strncpy(string_buf, answer, string_len - 1);
-- *(string_buf + string_len - 1) = 0;
-+ g_strlcpy(string_buf, answer, string_len);
- }
- } else return decode_reply(answer+4, was_garbage);
- }
-@@ -668,7 +667,7 @@
- {
- int r;
-
-- r = command (me, super, WAIT_REPLY, cmd);
-+ r = command (me, super, WAIT_REPLY, "%s", cmd);
- vfs_add_noncurrent_stamps (&vfs_fish_ops, (vfsid) super, NULL);
- if (r != COMPLETE) ERRNOR (E_REMOTE, -1);
- if (flags & OPT_FLUSH)
diff --git a/misc/mc/files/patch-vfs-ftpfs-bug3727 b/misc/mc/files/patch-vfs-ftpfs-bug3727
new file mode 100644
index 000000000000..56c1230b0e09
--- /dev/null
+++ b/misc/mc/files/patch-vfs-ftpfs-bug3727
@@ -0,0 +1,52 @@
+--- vfs/ftpfs.c.orig 2004-11-03 03:54:00.000000000 +0200
++++ vfs/ftpfs.c 2005-02-07 17:34:25.000000000 +0200
+@@ -316,6 +316,8 @@
+ va_list ap;
+ char *cmdstr;
+ int status, cmdlen;
++ static int retry = 0;
++ static int level = 0; /* ftpfs_login_server() use ftpfs_command() */
+
+ va_start (ap, fmt);
+ cmdstr = g_strdup_vprintf (fmt, ap);
+@@ -343,7 +345,6 @@
+ code = 421;
+
+ if (errno == EPIPE) { /* Remote server has closed connection */
+- static int level = 0; /* ftpfs_login_server() use ftpfs_command() */
+ if (level == 0) {
+ level = 1;
+ status = ftpfs_reconnect (me, super);
+@@ -359,14 +360,30 @@
+ disable_interrupt_key ();
+ return TRANSIENT;
+ }
++ retry = 0;
+ ok:
+- g_free (cmdstr);
+ disable_interrupt_key ();
+
+ if (wait_reply)
+- return ftpfs_get_reply (me, SUP.sock,
++ {
++ status = ftpfs_get_reply (me, SUP.sock,
+ (wait_reply & WANT_STRING) ? reply_str : NULL,
+ sizeof (reply_str) - 1);
++ if ((wait_reply & WANT_STRING) && !retry && !level && code == 421)
++ {
++ retry = 1;
++ level = 1;
++ status = ftpfs_reconnect (me, super);
++ level = 0;
++ if (status && (write (SUP.sock, cmdstr, cmdlen) > 0)) {
++ goto ok;
++ }
++ }
++ retry = 0;
++ g_free (cmdstr);
++ return status;
++ }
++ g_free (cmdstr);
+ return COMPLETE;
+ }
+
diff --git a/misc/mc/files/patch-vfs-ftpfs.c b/misc/mc/files/patch-vfs-ftpfs.c
deleted file mode 100644
index bfd46fef3436..000000000000
--- a/misc/mc/files/patch-vfs-ftpfs.c
+++ /dev/null
@@ -1,131 +0,0 @@
---- vfs/ftpfs.c.orig Thu Dec 26 08:21:43 2002
-+++ vfs/ftpfs.c Tue Jun 15 03:15:09 2004
-@@ -266,8 +266,7 @@
- switch (sscanf(answer, "%d", &code)){
- case 0:
- if (string_buf) {
-- strncpy (string_buf, answer, string_len - 1);
-- *(string_buf + string_len - 1) = 0;
-+ g_strlcpy (string_buf, answer, string_len);
- }
- code = 500;
- return 5;
-@@ -286,8 +285,7 @@
- }
- }
- if (string_buf){
-- strncpy (string_buf, answer, string_len - 1);
-- *(string_buf + string_len - 1) = 0;
-+ g_strlcpy (string_buf, answer, string_len);
- }
- return code / 100;
- }
-@@ -321,28 +319,28 @@
- va_list ap;
- char *str, *fmt_str;
- int status;
-- int sock = SUP.sock;
-+ int cmdlen;
-
- va_start (ap, fmt);
- fmt_str = g_strdup_vprintf (fmt, ap);
- va_end (ap);
-
-- status = strlen (fmt_str);
-- str = g_realloc (fmt_str, status + 3);
-- strcpy (str + status, "\r\n");
-+ cmdlen = strlen (fmt_str);
-+ str = g_realloc (fmt_str, cmdlen + 3);
-+ strcpy (str + cmdlen, "\r\n");
-
- if (logfile){
- if (strncmp (str, "PASS ", 5) == 0){
- fputs ("PASS <Password not logged>\r\n", logfile);
- } else
-- fwrite (str, status + 2, 1, logfile);
-+ fwrite (str, cmdlen + 2, 1, logfile);
-
- fflush (logfile);
- }
-
- got_sigpipe = 0;
- enable_interrupt_key ();
-- status = write (SUP.sock, str, status + 2);
-+ status = write (SUP.sock, str, cmdlen + 2);
-
- if (status < 0){
- code = 421;
-@@ -353,7 +351,7 @@
- level = 1;
- status = reconnect (me, super);
- level = 0;
-- if (status && write (SUP.sock, str, status + 2) > 0)
-+ if (status && write (SUP.sock, str, cmdlen + 2) > 0)
- goto ok;
- }
- got_sigpipe = 1;
-@@ -367,7 +365,7 @@
- disable_interrupt_key ();
-
- if (wait_reply)
-- return get_reply (me, sock, (wait_reply & WANT_STRING) ? reply_str : NULL, sizeof (reply_str)-1);
-+ return get_reply (me, SUP.sock, (wait_reply & WANT_STRING) ? reply_str : NULL, sizeof (reply_str)-1);
- return COMPLETE;
- }
-
-@@ -903,23 +901,29 @@
- int data, len = sizeof(data_addr);
- struct protoent *pe;
-
-- getsockname(SUP.sock, (struct sockaddr *) &data_addr, &len);
-- data_addr.sin_port = 0;
--
- pe = getprotobyname("tcp");
- if (pe == NULL)
- ERRNOR (EIO, -1);
-+again:
-+ if (getsockname(SUP.sock, (struct sockaddr *) &data_addr, &len) == -1)
-+ ERRNOR (EIO, -1);
-+ data_addr.sin_port = 0;
-+
- data = socket (AF_INET, SOCK_STREAM, pe->p_proto);
- if (data < 0)
- ERRNOR (EIO, -1);
-
- if (SUP.use_passive_connection){
-- if ((SUP.use_passive_connection = setup_passive (me, super, data, &data_addr)))
-+ if (setup_passive (me, super, data, &data_addr))
- return data;
-
- SUP.use_source_route = 0;
- SUP.use_passive_connection = 0;
- print_vfs_message (_("ftpfs: could not setup passive mode"));
-+
-+ /* data or data_addr may be damaged by setup_passive */
-+ close (data);
-+ goto again;
- }
-
- /* If passive setup fails, fallback to active connections */
-@@ -971,11 +975,12 @@
- data = s;
- else {
- data = accept (s, (struct sockaddr *)&from, &fromlen);
-- close(s);
- if (data < 0) {
- my_errno = errno;
-+ close(s);
- return -1;
- }
-+ close(s);
- }
- disable_interrupt_key();
- return data;
-@@ -1019,6 +1024,7 @@
- gettimeofday (&tim, NULL);
- if (tim.tv_sec > start_tim.tv_sec + ABORT_TIMEOUT) {
- /* server keeps sending, drop the connection and reconnect */
-+ close (dsock);
- reconnect (me, super);
- return;
- }
diff --git a/misc/mc/files/patch-vfs-mcfs.c b/misc/mc/files/patch-vfs-mcfs.c
deleted file mode 100644
index e5d41730432e..000000000000
--- a/misc/mc/files/patch-vfs-mcfs.c
+++ /dev/null
@@ -1,27 +0,0 @@
---- vfs/mcfs.c.orig Fri Nov 15 13:49:39 2002
-+++ vfs/mcfs.c Tue Jun 15 03:15:09 2004
-@@ -756,8 +756,7 @@
- return NULL;
- }
- dirent_dest = mcfs_readdir_data.dent.d_name;
-- strncpy (dirent_dest, mcfs_info->current->text, MC_MAXPATHLEN);
-- dirent_dest[MC_MAXPATHLEN] = 0;
-+ g_strlcpy (dirent_dest, mcfs_info->current->text, MC_MAXPATHLEN);
- cached_lstat_info = &mcfs_info->current->my_stat;
- mcfs_info->current = mcfs_info->current->next;
-
-@@ -985,9 +984,12 @@
- if (!rpc_get (mc->sock, RPC_STRING, &stat_str, RPC_END))
- return the_error (-1, EIO);
-
-- strncpy (buf, stat_str, size);
-+ status = strlen (stat_str);
-+ if (status < size)
-+ size = status;
-+ memcpy (buf, stat_str, size);
- g_free (stat_str);
-- return strlen (buf);
-+ return size;
- }
-
- static int
diff --git a/misc/mc/files/patch-vfs-mcserv.c b/misc/mc/files/patch-vfs-mcserv.c
deleted file mode 100644
index 44e3fdd1b894..000000000000
--- a/misc/mc/files/patch-vfs-mcserv.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- vfs/mcserv.c.orig Sun Dec 8 07:12:30 2002
-+++ vfs/mcserv.c Tue Jun 15 03:15:09 2004
-@@ -582,7 +582,7 @@
- int n;
-
- rpc_get (msock, RPC_STRING, &file, RPC_END);
-- n = readlink (file, buffer, 2048);
-+ n = readlink (file, buffer, 2048 - 1);
- send_status (n, errno);
- if (n >= 0) {
- buffer[n] = 0;
diff --git a/misc/mc/files/patch-vfs-names.c b/misc/mc/files/patch-vfs-names.c
deleted file mode 100644
index 36f0a1b66357..000000000000
--- a/misc/mc/files/patch-vfs-names.c
+++ /dev/null
@@ -1,28 +0,0 @@
---- vfs/names.c.orig Fri Nov 15 12:19:34 2002
-+++ vfs/names.c Tue Jun 15 03:15:09 2004
-@@ -31,6 +31,7 @@
- #include <stdio.h>
- #include <pwd.h>
- #include <grp.h>
-+#include <glib.h>
-
- #include "names.h"
-
-@@ -59,7 +60,7 @@
-
- if (uname[0] != saveuname[0] /* Quick test w/o proc call */
- ||0 != strncmp (uname, saveuname, TUNMLEN)) {
-- strncpy (saveuname, uname, TUNMLEN);
-+ g_strlcpy (saveuname, uname, TUNMLEN);
- pw = getpwnam (uname);
- if (pw) {
- saveuid = pw->pw_uid;
-@@ -77,7 +78,7 @@
-
- if (gname[0] != savegname[0] /* Quick test w/o proc call */
- ||0 != strncmp (gname, savegname, TUNMLEN)) {
-- strncpy (savegname, gname, TUNMLEN);
-+ g_strlcpy (savegname, gname, TUNMLEN);
- gr = getgrnam (gname);
- if (gr) {
- savegid = gr->gr_gid;
diff --git a/misc/mc/files/patch-vfs-samba-lib-util.c b/misc/mc/files/patch-vfs-samba-lib-util.c
deleted file mode 100644
index 923fc1238e31..000000000000
--- a/misc/mc/files/patch-vfs-samba-lib-util.c
+++ /dev/null
@@ -1,35 +0,0 @@
---- vfs/samba/lib/util.c.orig Fri Nov 15 23:02:44 2002
-+++ vfs/samba/lib/util.c Tue Jun 15 03:15:09 2004
-@@ -114,7 +114,7 @@
- char *tmpdir(void)
- {
- char *p;
-- if ((p = getenv("TMPDIR"))) {
-+ if ((p = getenv("MC_TMPDIR")) || (p = getenv("TMPDIR"))) {
- return p;
- }
- return "/tmp";
-@@ -1885,20 +1885,17 @@
-
- char *nis_map = (char *)lp_nis_home_map_name();
-
-- char nis_domain[NIS_MAXNAMELEN + 1];
- char buffer[NIS_MAXATTRVAL + 1];
- nis_result *result;
- nis_object *object;
- entry_obj *entry;
-
-- strncpy(nis_domain, (char *)nis_local_directory(), NIS_MAXNAMELEN);
-- nis_domain[NIS_MAXNAMELEN] = '\0';
--
-- DEBUG(5, ("NIS+ Domain: %s\n", nis_domain));
-+ DEBUG(5, ("NIS+ Domain: %s\n", (char *)nis_local_directory()));
-
- if (strcmp(user_name, last_key))
- {
-- slprintf(buffer, sizeof(buffer)-1, "[%s=%s]%s.%s", "key", user_name, nis_map, nis_domain);
-+ slprintf(buffer, sizeof(buffer)-1, "[%s=%s]%s.%s", "key", user_name, nis_map,
-+ (char *)nis_local_directory());
- DEBUG(5, ("NIS+ querystring: %s\n", buffer));
-
- if (result = nis_list(buffer, RETURN_RESULT, NULL, NULL))
diff --git a/misc/mc/files/patch-vfs-smbfs.c b/misc/mc/files/patch-vfs-smbfs.c
deleted file mode 100644
index 181580c40480..000000000000
--- a/misc/mc/files/patch-vfs-smbfs.c
+++ /dev/null
@@ -1,12 +0,0 @@
---- vfs/smbfs.c.orig Sat Jan 25 03:37:29 2003
-+++ vfs/smbfs.c Tue Jun 15 03:15:09 2004
-@@ -785,8 +785,7 @@
- #endif
- return NULL;
- }
-- strncpy(dirent_dest, smbfs_info->current->text, MC_MAXPATHLEN);
-- dirent_dest[MC_MAXPATHLEN] = 0;
-+ g_strlcpy(dirent_dest, smbfs_info->current->text, MC_MAXPATHLEN);
- smbfs_info->current = smbfs_info->current->next;
-
- compute_namelen(&smbfs_readdir_data.dent);
diff --git a/misc/mc/files/patch-vfs-tar.c b/misc/mc/files/patch-vfs-tar.c
deleted file mode 100644
index bbaf9e109b84..000000000000
--- a/misc/mc/files/patch-vfs-tar.c
+++ /dev/null
@@ -1,49 +0,0 @@
---- vfs/tar.c.orig Sun Dec 8 07:12:30 2002
-+++ vfs/tar.c Tue Jun 15 03:15:09 2004
-@@ -264,19 +264,26 @@
- char *bp, *data;
- int size, written;
-
-+ if (hstat.st_size > MC_MAXPATHLEN) {
-+ message_1s (1, MSG_ERROR, _("Inconsistent tar archive"));
-+ return STATUS_BADCHECKSUM;
-+ }
-+
- longp = ((header->header.linkflag == LF_LONGNAME)
- ? &next_long_name
- : &next_long_link);
-
- if (*longp)
- g_free (*longp);
-- bp = *longp = g_malloc (hstat.st_size);
-+ bp = *longp = g_malloc (hstat.st_size + 1);
-
- for (size = hstat.st_size;
- size > 0;
- size -= written) {
- data = get_next_record (archive, tard)->charptr;
- if (data == NULL) {
-+ g_free (*longp);
-+ *longp = NULL;
- message_1s (1, MSG_ERROR, _("Unexpected EOF on archive file"));
- return STATUS_BADCHECKSUM;
- }
-@@ -287,10 +294,14 @@
- memcpy (bp, data, written);
- bp += written;
- }
--#if 0
-- if (hstat.st_size > 1)
-- bp [hstat.st_size - 1] = 0; /* just to make sure */
--#endif
-+
-+ if (bp - *longp == MC_MAXPATHLEN && bp[-1] != '\0') {
-+ g_free (*longp);
-+ *longp = NULL;
-+ message_1s (1, MSG_ERROR, _("Inconsistent tar archive"));
-+ return STATUS_BADCHECKSUM;
-+ }
-+ *bp = 0;
- goto recurse;
- } else {
- struct stat st;
diff --git a/misc/mc/files/patch-vfs-vfs.c b/misc/mc/files/patch-vfs-vfs.c
deleted file mode 100644
index e8e132ba3c5c..000000000000
--- a/misc/mc/files/patch-vfs-vfs.c
+++ /dev/null
@@ -1,12 +0,0 @@
---- vfs/vfs.c.orig Thu Dec 26 08:21:43 2002
-+++ vfs/vfs.c Tue Jun 15 03:15:09 2004
-@@ -637,8 +637,7 @@
- {
- const char *cwd = mc_return_cwd();
-
-- strncpy (buffer, cwd, size - 1);
-- buffer [size - 1] = 0;
-+ g_strlcpy (buffer, cwd, size);
- return buffer;
- }
-
diff --git a/misc/mc/pkg-plist b/misc/mc/pkg-plist
index 0303e9bb00c4..217038cd3bf8 100644
--- a/misc/mc/pkg-plist
+++ b/misc/mc/pkg-plist
@@ -1,6 +1,6 @@
-bin/mcmfmt
bin/mc
%%EDITOR%%bin/mcedit
+bin/mcmfmt
bin/mcview
bin/midc
share/locale/az/LC_MESSAGES/mc.mo
@@ -19,7 +19,9 @@ share/locale/hu/LC_MESSAGES/mc.mo
share/locale/it/LC_MESSAGES/mc.mo
share/locale/ja/LC_MESSAGES/mc.mo
share/locale/ko/LC_MESSAGES/mc.mo
+share/locale/lt/LC_MESSAGES/mc.mo
share/locale/lv/LC_MESSAGES/mc.mo
+share/locale/mn/LC_MESSAGES/mc.mo
share/locale/nl/LC_MESSAGES/mc.mo
share/locale/no/LC_MESSAGES/mc.mo
share/locale/pl/LC_MESSAGES/mc.mo
@@ -29,6 +31,7 @@ share/locale/ro/LC_MESSAGES/mc.mo
share/locale/ru/LC_MESSAGES/mc.mo
share/locale/sk/LC_MESSAGES/mc.mo
share/locale/sl/LC_MESSAGES/mc.mo
+share/locale/sr/LC_MESSAGES/mc.mo
share/locale/sv/LC_MESSAGES/mc.mo
share/locale/ta/LC_MESSAGES/mc.mo
share/locale/tr/LC_MESSAGES/mc.mo
@@ -54,6 +57,7 @@ share/mc/extfs/debd
share/mc/extfs/dpkg
share/mc/extfs/extfs.ini
share/mc/extfs/hp48
+share/mc/extfs/iso9660
share/mc/extfs/lslR
share/mc/extfs/mailfs
share/mc/extfs/patchfs
@@ -78,6 +82,7 @@ share/mc/mc.hint.it
share/mc/mc.hint.nl
share/mc/mc.hint.pl
share/mc/mc.hint.ru
+share/mc/mc.hint.sr
share/mc/mc.hint.uk
share/mc/mc.hint.zh
share/mc/mc.hlp
@@ -86,21 +91,29 @@ share/mc/mc.hlp.hu
share/mc/mc.hlp.it
share/mc/mc.hlp.pl
share/mc/mc.hlp.ru
+share/mc/mc.hlp.sr
share/mc/mc.lib
share/mc/mc.menu
+share/mc/mc.menu.sr
share/mc/syntax/Syntax
share/mc/syntax/ada95.syntax
+share/mc/syntax/aspx.syntax
+share/mc/syntax/assembler.syntax
share/mc/syntax/c.syntax
share/mc/syntax/changelog.syntax
+share/mc/syntax/cs.syntax
share/mc/syntax/diff.syntax
share/mc/syntax/dos.syntax
+share/mc/syntax/eiffel.syntax
share/mc/syntax/fortran.syntax
share/mc/syntax/html.syntax
+share/mc/syntax/idl.syntax
share/mc/syntax/java.syntax
share/mc/syntax/js.syntax
share/mc/syntax/latex.syntax
share/mc/syntax/lisp.syntax
share/mc/syntax/lsm.syntax
+share/mc/syntax/lua.syntax
share/mc/syntax/m4.syntax
share/mc/syntax/mail.syntax
share/mc/syntax/makefile.syntax
@@ -111,7 +124,9 @@ share/mc/syntax/pascal.syntax
share/mc/syntax/perl.syntax
share/mc/syntax/php.syntax
share/mc/syntax/po.syntax
+share/mc/syntax/povray.syntax
share/mc/syntax/python.syntax
+share/mc/syntax/ruby.syntax
share/mc/syntax/sh.syntax
share/mc/syntax/slang.syntax
share/mc/syntax/smalltalk.syntax
@@ -123,29 +138,7 @@ share/mc/syntax/tcl.syntax
share/mc/syntax/texinfo.syntax
share/mc/syntax/unknown.syntax
share/mc/syntax/xml.syntax
-share/mc/term/README.xterm
-share/mc/term/ansi.ti
-share/mc/term/linux.ti
-share/mc/term/vt100.ti
-share/mc/term/xterm.ad
-share/mc/term/xterm.tcap
-share/mc/term/xterm.ti
@dirrm share/mc/syntax
-@dirrm share/mc/term
@dirrm share/mc/extfs
@dirrm share/mc/bin
@dirrm share/mc
-@unexec rmdir %D/share/locale/wa/LC_MESSAGES 2>/dev/null || true
-@unexec rmdir %D/share/locale/wa 2>/dev/null || true
-@unexec rmdir %D/man/es/man1 2>/dev/null || true
-@unexec rmdir %D/man/es/cat1 2>/dev/null || true
-@unexec rmdir %D/man/es 2>/dev/null || true
-@unexec rmdir %D/man/hu/man1 2>/dev/null || true
-@unexec rmdir %D/man/hu/cat1 2>/dev/null || true
-@unexec rmdir %D/man/hu 2>/dev/null || true
-@unexec rmdir %D/man/it/man1 2>/dev/null || true
-@unexec rmdir %D/man/it/cat1 2>/dev/null || true
-@unexec rmdir %D/man/it 2>/dev/null || true
-@unexec rmdir %D/man/pl/man1 2>/dev/null || true
-@unexec rmdir %D/man/pl/cat1 2>/dev/null || true
-@unexec rmdir %D/man/pl 2>/dev/null || true