- update to 4.7.0-pre2
This commit is contained in:
parent
78571b53e4
commit
a1b416a1c7
@ -1 +1 @@
|
||||
mc-4.7.0-pre1.tar.bz2
|
||||
mc-4.7.0-pre2.tar.bz2
|
||||
|
@ -10,18 +10,6 @@ diff -up mc-4.7.0-pre1/configure.ac.extensions mc-4.7.0-pre1/configure.ac
|
||||
|
||||
dnl
|
||||
dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
|
||||
diff -up mc-4.7.0-pre1/configure.extensions mc-4.7.0-pre1/configure
|
||||
--- mc-4.7.0-pre1/configure.extensions 2009-07-31 20:49:03.000000000 +0200
|
||||
+++ mc-4.7.0-pre1/configure 2009-08-05 12:51:08.000000000 +0200
|
||||
@@ -15250,7 +15250,7 @@ else
|
||||
fi
|
||||
|
||||
|
||||
-for ac_prog in gnome-moz-remote mozilla konqueror opera netscape
|
||||
+for ac_prog in firefox gnome-moz-remote mozilla konqueror opera netscape
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
diff -up mc-4.7.0-pre1/misc/mc.ext.in.extensions mc-4.7.0-pre1/misc/mc.ext.in
|
||||
--- mc-4.7.0-pre1/misc/mc.ext.in.extensions 2009-06-23 20:55:11.000000000 +0200
|
||||
+++ mc-4.7.0-pre1/misc/mc.ext.in 2009-08-05 13:01:48.000000000 +0200
|
||||
|
443
mc-ipv6.patch
443
mc-ipv6.patch
@ -1,443 +0,0 @@
|
||||
commit 883967347e817e1743d265d19a95a432cf875b5e
|
||||
Author: Slava Zanko <slavazanko@gmail.com>
|
||||
Date: Wed Aug 5 09:44:39 2009 +0300
|
||||
|
||||
Ticket #121 (support IPv6).
|
||||
|
||||
121_support_IPv6 -> origin/121_support_IPv6
|
||||
|
||||
Thanks to Dan Kopecek.
|
||||
|
||||
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
|
||||
|
||||
diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c
|
||||
index 9ac03bc..f2baaee 100644
|
||||
--- a/vfs/ftpfs.c
|
||||
+++ b/vfs/ftpfs.c
|
||||
@@ -652,17 +652,17 @@ ftpfs_get_proxy_host_and_port (const char *proxy, char **host, int *port)
|
||||
static int
|
||||
ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super)
|
||||
{
|
||||
- struct sockaddr_in server_address;
|
||||
- struct hostent *hp;
|
||||
- int my_socket;
|
||||
- char *host;
|
||||
- int port = SUP.port;
|
||||
- int free_host = 0;
|
||||
+ struct addrinfo hints, *res, *curr_res;
|
||||
+ int my_socket = 0;
|
||||
+ char *host = NULL;
|
||||
+ char *port = NULL;
|
||||
+ int tmp_port;
|
||||
+ int e;
|
||||
|
||||
(void) me;
|
||||
|
||||
/* Use a proxy host? */
|
||||
- host = SUP.host;
|
||||
+ host = g_strdup(SUP.host);
|
||||
|
||||
if (!host || !*host){
|
||||
print_vfs_message (_("ftpfs: Invalid host name."));
|
||||
@@ -671,61 +671,86 @@ ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super)
|
||||
}
|
||||
|
||||
/* Hosts to connect to that start with a ! should use proxy */
|
||||
+ tmp_port = SUP.port;
|
||||
+
|
||||
if (SUP.proxy){
|
||||
- ftpfs_get_proxy_host_and_port (ftpfs_proxy_host, &host, &port);
|
||||
- free_host = 1;
|
||||
+ char *orig_host = host;
|
||||
+
|
||||
+ ftpfs_get_proxy_host_and_port (ftpfs_proxy_host, &host, &tmp_port);
|
||||
+
|
||||
+ if (orig_host != host)
|
||||
+ g_free(orig_host);
|
||||
+ }
|
||||
+
|
||||
+ port = g_strdup_printf("%hu", (unsigned short) tmp_port);
|
||||
+ if (port == NULL) {
|
||||
+ g_free (host);
|
||||
+ ftpfs_errno = errno;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
enable_interrupt_key(); /* clear the interrupt flag */
|
||||
-
|
||||
- /* Get host address */
|
||||
- memset ((char *) &server_address, 0, sizeof (server_address));
|
||||
- server_address.sin_family = AF_INET;
|
||||
- server_address.sin_addr.s_addr = inet_addr (host);
|
||||
- if (server_address.sin_addr.s_addr == INADDR_NONE) {
|
||||
- hp = gethostbyname (host);
|
||||
- if (hp == NULL){
|
||||
- disable_interrupt_key();
|
||||
- print_vfs_message (_("ftpfs: Invalid host address."));
|
||||
- ftpfs_errno = EINVAL;
|
||||
- if (free_host)
|
||||
- g_free (host);
|
||||
- return -1;
|
||||
- }
|
||||
- server_address.sin_family = hp->h_addrtype;
|
||||
|
||||
- /* We copy only 4 bytes, we cannot trust hp->h_length, as it comes from the DNS */
|
||||
- memcpy ((char *) &server_address.sin_addr, (char *) hp->h_addr, 4);
|
||||
- }
|
||||
+ memset (&hints, 0, sizeof (struct addrinfo));
|
||||
+ hints.ai_socktype = SOCK_STREAM;
|
||||
+ hints.ai_flags = AI_ADDRCONFIG;
|
||||
|
||||
- server_address.sin_port = htons (port);
|
||||
|
||||
- /* Connect */
|
||||
- if ((my_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
+ e = getaddrinfo (host, port, &hints, &res);
|
||||
+ g_free (port);
|
||||
+ port = NULL;
|
||||
+
|
||||
+ if ( e != 0 ) {
|
||||
disable_interrupt_key();
|
||||
- ftpfs_errno = errno;
|
||||
- if (free_host)
|
||||
- g_free (host);
|
||||
+ print_vfs_message (_("ftpfs: %s"), gai_strerror (e));
|
||||
+ g_free (host);
|
||||
+ ftpfs_errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
-
|
||||
- print_vfs_message (_("ftpfs: making connection to %s"), host);
|
||||
- if (free_host)
|
||||
+
|
||||
+ for (curr_res = res; curr_res != NULL; curr_res = curr_res->ai_next) {
|
||||
+
|
||||
+ my_socket = socket (curr_res->ai_family, curr_res->ai_socktype, curr_res->ai_protocol);
|
||||
+
|
||||
+ if (my_socket < 0) {
|
||||
+
|
||||
+ if (curr_res->ai_next != NULL)
|
||||
+ continue;
|
||||
+
|
||||
+ disable_interrupt_key();
|
||||
+ print_vfs_message (_("ftpfs: %s"), unix_error_string (errno));
|
||||
+ g_free (host);
|
||||
+ freeaddrinfo (res);
|
||||
+ ftpfs_errno = errno;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ print_vfs_message (_("ftpfs: making connection to %s"), host);
|
||||
g_free (host);
|
||||
+ host = NULL;
|
||||
+
|
||||
+ if ( connect (my_socket, curr_res->ai_addr, curr_res->ai_addrlen) >= 0 )
|
||||
+ break;
|
||||
|
||||
- if (connect (my_socket, (struct sockaddr *) &server_address,
|
||||
- sizeof (server_address)) < 0){
|
||||
ftpfs_errno = errno;
|
||||
- if (errno == EINTR && got_interrupt ())
|
||||
+ close (my_socket);
|
||||
+
|
||||
+ if (errno == EINTR && got_interrupt ()) {
|
||||
print_vfs_message (_("ftpfs: connection interrupted by user"));
|
||||
- else
|
||||
+ } else if (res->ai_next == NULL) {
|
||||
print_vfs_message (_("ftpfs: connection to server failed: %s"),
|
||||
- unix_error_string(errno));
|
||||
- disable_interrupt_key();
|
||||
- close (my_socket);
|
||||
+ unix_error_string (errno));
|
||||
+ } else {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ freeaddrinfo (res);
|
||||
+ disable_interrupt_key ();
|
||||
return -1;
|
||||
}
|
||||
- disable_interrupt_key();
|
||||
+
|
||||
+ freeaddrinfo (res);
|
||||
+ disable_interrupt_key ();
|
||||
return my_socket;
|
||||
}
|
||||
|
||||
@@ -874,84 +899,174 @@ ftpfs_get_current_directory (struct vfs_class *me, struct vfs_s_super *super)
|
||||
|
||||
/* Setup Passive ftp connection, we use it for source routed connections */
|
||||
static int
|
||||
-ftpfs_setup_passive (struct vfs_class *me, struct vfs_s_super *super, int my_socket, struct sockaddr_in *sa)
|
||||
+ftpfs_setup_passive (struct vfs_class *me, struct vfs_s_super *super,
|
||||
+ int my_socket, struct sockaddr_storage *sa, socklen_t *salen)
|
||||
{
|
||||
- int xa, xb, xc, xd, xe, xf;
|
||||
- char n [6];
|
||||
char *c;
|
||||
-
|
||||
- if (ftpfs_command (me, super, WAIT_REPLY | WANT_STRING, "PASV") != COMPLETE)
|
||||
- return 0;
|
||||
|
||||
- /* Parse remote parameters */
|
||||
- for (c = reply_str + 4; (*c) && (!isdigit ((unsigned char) *c)); c++)
|
||||
- ;
|
||||
- if (!*c)
|
||||
- return 0;
|
||||
- if (!isdigit ((unsigned char) *c))
|
||||
- return 0;
|
||||
- if (sscanf (c, "%d,%d,%d,%d,%d,%d", &xa, &xb, &xc, &xd, &xe, &xf) != 6)
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY | WANT_STRING, "EPSV") == COMPLETE) {
|
||||
+ int port;
|
||||
+ /* (|||<port>|) */
|
||||
+ c = strchr (reply_str, '|');
|
||||
+ if (c == NULL)
|
||||
+ return 0;
|
||||
+ if(strlen(c) > 3)
|
||||
+ c+=3;
|
||||
+ else
|
||||
+ return 0;
|
||||
+
|
||||
+ port = atoi (c);
|
||||
+ if (port < 0 || port > 65535)
|
||||
+ return 0;
|
||||
+ port = htons (port);
|
||||
+
|
||||
+ switch (sa->ss_family) {
|
||||
+ case AF_INET:
|
||||
+ ((struct sockaddr_in *)sa)->sin_port = port;
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ ((struct sockaddr_in6 *)sa)->sin6_port = port;
|
||||
+ break;
|
||||
+ default:
|
||||
+ print_vfs_message (_("ftpfs: invalid address family"));
|
||||
+ ERRNOR (EINVAL, -1);
|
||||
+ }
|
||||
+ } else if (sa->ss_family == AF_INET) {
|
||||
+ int xa, xb, xc, xd, xe, xf;
|
||||
+ char n [6];
|
||||
+
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY | WANT_STRING, "PASV") != COMPLETE)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Parse remote parameters */
|
||||
+ for (c = reply_str + 4; (*c) && (!isdigit ((unsigned char) *c)); c++);
|
||||
+
|
||||
+ if (!*c)
|
||||
+ return 0;
|
||||
+ if (!isdigit ((unsigned char) *c))
|
||||
+ return 0;
|
||||
+ if (sscanf (c, "%d,%d,%d,%d,%d,%d", &xa, &xb, &xc, &xd, &xe, &xf) != 6)
|
||||
+ return 0;
|
||||
+
|
||||
+ n [0] = (unsigned char) xa;
|
||||
+ n [1] = (unsigned char) xb;
|
||||
+ n [2] = (unsigned char) xc;
|
||||
+ n [3] = (unsigned char) xd;
|
||||
+ n [4] = (unsigned char) xe;
|
||||
+ n [5] = (unsigned char) xf;
|
||||
+
|
||||
+ memcpy (&(((struct sockaddr_in *)sa)->sin_addr.s_addr), (void *)n, 4);
|
||||
+ memcpy (&(((struct sockaddr_in *)sa)->sin_port), (void *)&n[4], 2);
|
||||
+ } else
|
||||
return 0;
|
||||
- n [0] = (unsigned char) xa;
|
||||
- n [1] = (unsigned char) xb;
|
||||
- n [2] = (unsigned char) xc;
|
||||
- n [3] = (unsigned char) xd;
|
||||
- n [4] = (unsigned char) xe;
|
||||
- n [5] = (unsigned char) xf;
|
||||
-
|
||||
- memcpy (&(sa->sin_addr.s_addr), (void *)n, 4);
|
||||
- memcpy (&(sa->sin_port), (void *)&n[4], 2);
|
||||
- if (connect (my_socket, (struct sockaddr *) sa, sizeof (struct sockaddr_in)) < 0)
|
||||
+
|
||||
+ if (connect (my_socket, (struct sockaddr *) sa, *salen ) < 0)
|
||||
return 0;
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
ftpfs_initconn (struct vfs_class *me, struct vfs_s_super *super)
|
||||
{
|
||||
- struct sockaddr_in data_addr;
|
||||
- int data;
|
||||
- socklen_t len = sizeof(data_addr);
|
||||
- struct protoent *pe;
|
||||
+ struct sockaddr_storage data_addr;
|
||||
+ socklen_t data_addrlen;
|
||||
+ int data_sock;
|
||||
|
||||
- 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);
|
||||
+ memset (&data_addr, 0, sizeof (struct sockaddr_storage));
|
||||
+ data_addrlen = sizeof (struct sockaddr_storage);
|
||||
+
|
||||
+ if (getpeername (SUP.sock, (struct sockaddr *) &data_addr, &data_addrlen) == -1)
|
||||
+ return -1;
|
||||
+
|
||||
+ switch (data_addr.ss_family) {
|
||||
+ case AF_INET:
|
||||
+ ((struct sockaddr_in *)&data_addr)->sin_port = 0;
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ ((struct sockaddr_in6 *)&data_addr)->sin6_port = 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ print_vfs_message (_("ftpfs: invalid address family"));
|
||||
+ ERRNOR(EINVAL, -1);
|
||||
+ }
|
||||
+
|
||||
+ data_sock = socket (data_addr.ss_family, SOCK_STREAM, IPPROTO_TCP);
|
||||
+ if (data_sock < 0) {
|
||||
+ if (SUP.use_passive_connection) {
|
||||
+ print_vfs_message (_("ftpfs: could not setup passive mode: %s"), unix_error_string (errno));
|
||||
+ SUP.use_passive_connection = 0;
|
||||
+ goto again;
|
||||
+ }
|
||||
+
|
||||
+ print_vfs_message (_("ftpfs: could not create socket: %s"), unix_error_string (errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
if (SUP.use_passive_connection) {
|
||||
- if (ftpfs_setup_passive (me, super, data, &data_addr))
|
||||
- return data;
|
||||
+
|
||||
+ if (ftpfs_setup_passive (me, super, data_sock, &data_addr, &data_addrlen))
|
||||
+ return data_sock;
|
||||
|
||||
SUP.use_passive_connection = 0;
|
||||
print_vfs_message (_("ftpfs: could not setup passive mode"));
|
||||
|
||||
- /* data or data_addr may be damaged by ftpfs_setup_passive */
|
||||
- close (data);
|
||||
+ close (data_sock);
|
||||
goto again;
|
||||
}
|
||||
|
||||
/* If passive setup fails, fallback to active connections */
|
||||
/* Active FTP connection */
|
||||
- if ((bind (data, (struct sockaddr *)&data_addr, len) == 0) &&
|
||||
- (getsockname (data, (struct sockaddr *) &data_addr, &len) == 0) &&
|
||||
- (listen (data, 1) == 0))
|
||||
- {
|
||||
- unsigned char *a = (unsigned char *)&data_addr.sin_addr;
|
||||
- unsigned char *p = (unsigned char *)&data_addr.sin_port;
|
||||
+ if ((bind (data_sock, (struct sockaddr *)&data_addr, data_addrlen) == 0) &&
|
||||
+ (getsockname (data_sock, (struct sockaddr *)&data_addr, &data_addrlen) == 0) &&
|
||||
+ (listen (data_sock, 1) == 0)) {
|
||||
+ unsigned short int port;
|
||||
+ char *addr;
|
||||
+ unsigned int af;
|
||||
+
|
||||
+ switch (data_addr.ss_family) {
|
||||
+ case AF_INET:
|
||||
+ af = FTP_INET;
|
||||
+ port = ((struct sockaddr_in *)&data_addr)->sin_port;
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ af = FTP_INET6;
|
||||
+ port = ((struct sockaddr_in6 *)&data_addr)->sin6_port;
|
||||
+ break;
|
||||
+ default:
|
||||
+ print_vfs_message (_("ftpfs: invalid address family"));
|
||||
+ ERRNOR (EINVAL, -1);
|
||||
+ }
|
||||
+
|
||||
+ port = ntohs (port);
|
||||
+
|
||||
+ addr = malloc (NI_MAXHOST);
|
||||
+ if (addr == NULL)
|
||||
+ ERRNOR (ENOMEM, -1);
|
||||
+
|
||||
+ if (getnameinfo ((struct sockaddr *)&data_addr, data_addrlen, addr, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) != 0) {
|
||||
+ g_free (addr);
|
||||
+ ERRNOR (EIO, -1);
|
||||
+ }
|
||||
+
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY, "EPRT |%u|%s|%hu|", af, addr, port) == COMPLETE) {
|
||||
+ g_free (addr);
|
||||
+ return data_sock;
|
||||
+ }
|
||||
+ g_free (addr);
|
||||
+
|
||||
+ if (FTP_INET == af) {
|
||||
+ unsigned char *a = (unsigned char *)&((struct sockaddr_in *)&data_addr)->sin_addr;
|
||||
+ unsigned char *p = (unsigned char *)&port;
|
||||
|
||||
- if (ftpfs_command (me, super, WAIT_REPLY, "PORT %d,%d,%d,%d,%d,%d", a[0], a[1],
|
||||
- a[2], a[3], p[0], p[1]) == COMPLETE)
|
||||
- return data;
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY,
|
||||
+ "PORT %u,%u,%u,%u,%u,%u", a[0], a[1], a[2], a[3],
|
||||
+ p[0], p[1]) == COMPLETE)
|
||||
+ return data_sock;
|
||||
+ }
|
||||
}
|
||||
- close (data);
|
||||
+ close (data_sock);
|
||||
ftpfs_errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
@@ -960,7 +1075,7 @@ static int
|
||||
ftpfs_open_data_connection (struct vfs_class *me, struct vfs_s_super *super, const char *cmd,
|
||||
const char *remote, int isbinary, int reget)
|
||||
{
|
||||
- struct sockaddr_in from;
|
||||
+ struct sockaddr_storage from;
|
||||
int s, j, data;
|
||||
socklen_t fromlen = sizeof(from);
|
||||
|
||||
diff --git a/vfs/ftpfs.h b/vfs/ftpfs.h
|
||||
index b2003db..0f41b18 100644
|
||||
--- a/vfs/ftpfs.h
|
||||
+++ b/vfs/ftpfs.h
|
||||
@@ -21,6 +21,9 @@ extern int ftpfs_first_cd_then_ls;
|
||||
void ftpfs_init_passwd (void);
|
||||
void init_ftpfs (void);
|
||||
|
||||
+#define FTP_INET 1
|
||||
+#define FTP_INET6 2
|
||||
+
|
||||
#define OPT_FLUSH 1
|
||||
#define OPT_IGNORE_ERROR 2
|
||||
|
||||
diff --git a/vfs/utilvfs.c b/vfs/utilvfs.c
|
||||
index af05144..f53914a 100644
|
||||
--- a/vfs/utilvfs.c
|
||||
+++ b/vfs/utilvfs.c
|
||||
@@ -123,7 +123,21 @@ vfs_split_url (const char *path, char **host, char **user, int *port,
|
||||
}
|
||||
|
||||
/* Check if the host comes with a port spec, if so, chop it */
|
||||
- colon = strchr (rest, ':');
|
||||
+ if ('[' == *rest) {
|
||||
+ colon = strchr (++rest, ']');
|
||||
+ if (colon) {
|
||||
+ colon[0] = '\0';
|
||||
+ colon[1] = '\0';
|
||||
+ colon++;
|
||||
+ } else {
|
||||
+ g_free (pcopy);
|
||||
+ *host = NULL;
|
||||
+ *port = 0;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ } else
|
||||
+ colon = strchr (rest, ':');
|
||||
+
|
||||
if (colon) {
|
||||
*colon = 0;
|
||||
if (sscanf (colon + 1, "%d", port) == 1) {
|
154
mc-prompt.patch
154
mc-prompt.patch
@ -1,154 +0,0 @@
|
||||
diff -up mc-4.6.99/src/execute.c.prompt mc-4.6.99/src/execute.c
|
||||
--- mc-4.6.99/src/execute.c.prompt 2009-07-31 14:57:10.000000000 +0200
|
||||
+++ mc-4.6.99/src/execute.c 2009-07-31 14:58:21.000000000 +0200
|
||||
@@ -146,6 +146,8 @@ do_execute (const char *shell, const cha
|
||||
printf ("\r\n");
|
||||
fflush (stdout);
|
||||
}
|
||||
+ update_prompt = TRUE;
|
||||
+ do_update_prompt ();
|
||||
if (console_flag) {
|
||||
if (output_lines && keybar_visible) {
|
||||
putchar ('\n');
|
||||
diff -up mc-4.6.99/src/main.c.prompt mc-4.6.99/src/main.c
|
||||
--- mc-4.6.99/src/main.c.prompt 2009-07-31 14:57:10.000000000 +0200
|
||||
+++ mc-4.6.99/src/main.c 2009-07-31 14:58:21.000000000 +0200
|
||||
@@ -459,7 +459,7 @@ void
|
||||
do_update_prompt (void)
|
||||
{
|
||||
if (update_prompt) {
|
||||
- printf ("%s", subshell_prompt);
|
||||
+ printf ("\r\n%s", original_subshell_prompt);
|
||||
fflush (stdout);
|
||||
update_prompt = 0;
|
||||
}
|
||||
diff -up mc-4.6.99/src/subshell.c.prompt mc-4.6.99/src/subshell.c
|
||||
--- mc-4.6.99/src/subshell.c.prompt 2009-07-31 14:57:11.000000000 +0200
|
||||
+++ mc-4.6.99/src/subshell.c 2009-07-31 15:02:35.000000000 +0200
|
||||
@@ -114,6 +114,9 @@ enum subshell_state_enum subshell_state;
|
||||
/* Holds the latest prompt captured from the subshell */
|
||||
char *subshell_prompt = NULL;
|
||||
|
||||
+/* Holds the latest prompt captured from the subshell with terminal codes */
|
||||
+char *original_subshell_prompt = NULL;
|
||||
+
|
||||
/* Initial length of the buffer for the subshell's prompt */
|
||||
#define INITIAL_PROMPT_SIZE 10
|
||||
|
||||
@@ -160,6 +163,7 @@ static struct termios raw_mode;
|
||||
/* This counter indicates how many characters of prompt we have read */
|
||||
/* FIXME: try to figure out why this had to become global */
|
||||
static int prompt_pos;
|
||||
+static int original_prompt_pos;
|
||||
|
||||
|
||||
/*
|
||||
@@ -598,6 +602,7 @@ int invoke_subshell (const char *command
|
||||
init_subshell ();
|
||||
|
||||
prompt_pos = 0;
|
||||
+ original_prompt_pos = 0;
|
||||
|
||||
return quit;
|
||||
}
|
||||
@@ -607,6 +612,7 @@ int
|
||||
read_subshell_prompt (void)
|
||||
{
|
||||
static int prompt_size = INITIAL_PROMPT_SIZE;
|
||||
+ static int original_prompt_size = INITIAL_PROMPT_SIZE;
|
||||
int bytes = 0, i, rc = 0;
|
||||
struct timeval timeleft = { 0, 0 };
|
||||
|
||||
@@ -617,7 +623,10 @@ read_subshell_prompt (void)
|
||||
if (subshell_prompt == NULL) { /* First time through */
|
||||
subshell_prompt = g_malloc (prompt_size);
|
||||
*subshell_prompt = '\0';
|
||||
+ original_subshell_prompt = g_malloc (original_prompt_size);
|
||||
+ *original_subshell_prompt = '\0';
|
||||
prompt_pos = 0;
|
||||
+ original_prompt_pos = 0;
|
||||
}
|
||||
|
||||
while (subshell_alive
|
||||
@@ -638,20 +647,27 @@ read_subshell_prompt (void)
|
||||
|
||||
/* Extract the prompt from the shell output */
|
||||
|
||||
- for (i = 0; i < bytes; ++i)
|
||||
+ for (i = 0; i < bytes; ++i) {
|
||||
+ if (!pty_buffer[i])
|
||||
+ continue;
|
||||
+
|
||||
+ original_subshell_prompt[original_prompt_pos++] = pty_buffer[i];
|
||||
+ if (original_prompt_pos == original_prompt_size)
|
||||
+ original_subshell_prompt =
|
||||
+ g_realloc (original_subshell_prompt, original_prompt_size *= 2);
|
||||
+
|
||||
if (pty_buffer[i] == '\n' || pty_buffer[i] == '\r') {
|
||||
prompt_pos = 0;
|
||||
} else {
|
||||
- if (!pty_buffer[i])
|
||||
- continue;
|
||||
-
|
||||
subshell_prompt[prompt_pos++] = pty_buffer[i];
|
||||
if (prompt_pos == prompt_size)
|
||||
subshell_prompt =
|
||||
g_realloc (subshell_prompt, prompt_size *= 2);
|
||||
}
|
||||
+ }
|
||||
|
||||
subshell_prompt[prompt_pos] = '\0';
|
||||
+ original_subshell_prompt[original_prompt_pos] = '\0';
|
||||
}
|
||||
if (rc == 0 && bytes == 0)
|
||||
return FALSE;
|
||||
@@ -792,6 +808,7 @@ do_subshell_chdir (const char *directory
|
||||
char *pcwd;
|
||||
char *temp;
|
||||
char *translate;
|
||||
+ static char *old_subshell_prompt = NULL;
|
||||
|
||||
pcwd = vfs_translate_path_n (current_panel->cwd);
|
||||
|
||||
@@ -802,8 +819,14 @@ do_subshell_chdir (const char *directory
|
||||
* the main program. Please note that in the code after this
|
||||
* if, the cd command that is sent will make the subshell
|
||||
* repaint the prompt, so we don't have to paint it. */
|
||||
- if (do_update)
|
||||
- do_update_prompt ();
|
||||
+ if (do_update) {
|
||||
+ if (old_subshell_prompt == NULL
|
||||
+ || strcmp (old_subshell_prompt, original_subshell_prompt)) {
|
||||
+ g_free (old_subshell_prompt);
|
||||
+ old_subshell_prompt = g_strdup (original_subshell_prompt);
|
||||
+ do_update_prompt ();
|
||||
+ }
|
||||
+ }
|
||||
g_free (pcwd);
|
||||
return;
|
||||
}
|
||||
@@ -861,8 +884,10 @@ do_subshell_chdir (const char *directory
|
||||
}
|
||||
}
|
||||
|
||||
- if (reset_prompt)
|
||||
+ if (reset_prompt) {
|
||||
prompt_pos = 0;
|
||||
+ original_prompt_pos = 0;
|
||||
+ }
|
||||
update_prompt = FALSE;
|
||||
|
||||
g_free (pcwd);
|
||||
diff -up mc-4.6.99/src/subshell.h.prompt mc-4.6.99/src/subshell.h
|
||||
--- mc-4.6.99/src/subshell.h.prompt 2009-07-31 14:57:10.000000000 +0200
|
||||
+++ mc-4.6.99/src/subshell.h 2009-07-31 14:58:21.000000000 +0200
|
||||
@@ -25,6 +25,9 @@ extern enum subshell_state_enum subshell
|
||||
/* Holds the latest prompt captured from the subshell */
|
||||
extern char *subshell_prompt;
|
||||
|
||||
+/* Holds the latest prompt captured from the subshell with terminal codes */
|
||||
+extern char *original_subshell_prompt;
|
||||
+
|
||||
/* For the `how' argument to various functions */
|
||||
enum {QUIETLY, VISIBLY};
|
||||
|
@ -1,41 +0,0 @@
|
||||
diff -d -urpN mc.7/src/search/glob.c mc.8/src/search/glob.c
|
||||
--- mc.7/src/search/glob.c 2009-06-29 14:06:35.000000000 +0200
|
||||
+++ mc.8/src/search/glob.c 2009-07-03 12:40:36.000000000 +0200
|
||||
@@ -141,8 +142,36 @@ mc_search__run_glob (mc_search_t * mc_se
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
+static GString *
|
||||
+mc_search__translate_replace_glob_to_regex (gchar *str)
|
||||
+{
|
||||
+ GString *buff = g_string_new ("");
|
||||
+ int cnt = '0';
|
||||
+
|
||||
+ while (*str) {
|
||||
+ char c = *str++;
|
||||
+ switch (c) {
|
||||
+ case '*':
|
||||
+ case '?':
|
||||
+ g_string_append_c (buff, '\\');
|
||||
+ c = ++cnt;
|
||||
+ break;
|
||||
+ /* breaks copying: mc uses "\0" internally, it must not be changed */
|
||||
+ /*case '\\':*/
|
||||
+ case '&':
|
||||
+ g_string_append_c (buff, '\\');
|
||||
+ break;
|
||||
+ }
|
||||
+ g_string_append_c (buff, c);
|
||||
+ }
|
||||
+ return buff;
|
||||
+}
|
||||
+
|
||||
GString *
|
||||
mc_search_glob_prepare_replace_str (mc_search_t * mc_search, GString * replace_str)
|
||||
{
|
||||
- return mc_search_regex_prepare_replace_str (mc_search, replace_str);
|
||||
+ GString *repl = mc_search__translate_replace_glob_to_regex(replace_str->str);
|
||||
+ GString *res = mc_search_regex_prepare_replace_str (mc_search, repl);
|
||||
+ g_string_free (repl, TRUE);
|
||||
+ return res;
|
||||
}
|
23
mc.spec
23
mc.spec
@ -1,22 +1,19 @@
|
||||
Summary: User-friendly text console file manager and visual shell
|
||||
Name: mc
|
||||
Version: 4.7.0
|
||||
Release: 0.3.pre1%{?dist}
|
||||
Release: 0.4.pre2%{?dist}
|
||||
Epoch: 1
|
||||
License: GPLv2
|
||||
Group: System Environment/Shells
|
||||
# tarball created from git clone git://midnight-commander.org/git/mc.git
|
||||
Source0: mc-%{version}-pre1.tar.bz2
|
||||
Source0: mc-%{version}-pre2.tar.bz2
|
||||
URL: http://www.midnight-commander.org/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: glib2-devel e2fsprogs-devel slang-devel
|
||||
Requires: dev >= 3.3-3
|
||||
|
||||
Patch1: mc-ipv6.patch
|
||||
Patch2: mc-prompt.patch
|
||||
Patch3: mc-exit.patch
|
||||
Patch4: mc-extensions.patch
|
||||
Patch5: mc-shell-patterns.patch
|
||||
Patch1: mc-exit.patch
|
||||
Patch2: mc-extensions.patch
|
||||
|
||||
%description
|
||||
Midnight Commander is a visual shell much like a file manager, only
|
||||
@ -26,12 +23,9 @@ ability to FTP, view tar and zip files, and to poke into RPMs for
|
||||
specific files.
|
||||
|
||||
%prep
|
||||
%setup -q -n mc-%{version}-pre1
|
||||
%patch1 -p1 -b .ipv6
|
||||
%patch2 -p1 -b .prompt
|
||||
%patch3 -p1 -b .exit
|
||||
%patch4 -p1 -b .extensions
|
||||
%patch5 -p1 -b .shell-patterns
|
||||
%setup -q -n mc-%{version}-pre2
|
||||
%patch1 -p1 -b .exit
|
||||
%patch2 -p1 -b .extensions
|
||||
|
||||
%build
|
||||
export CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $RPM_OPT_FLAGS"
|
||||
@ -87,6 +81,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir %{_libexecdir}/mc
|
||||
|
||||
%changelog
|
||||
* Tue Sep 1 2009 Jindrich Novy <jnovy@redhat.com> 4.7.0-0.4.pre2
|
||||
- update to 4.7.0-pre2
|
||||
|
||||
* Fri Aug 7 2009 Jindrich Novy <jnovy@redhat.com> 4.7.0-0.3.pre1
|
||||
- support shell patterns in copy dialog (#516180)
|
||||
(http://www.midnight-commander.org/ticket/414)
|
||||
|
Loading…
Reference in New Issue
Block a user