Re: message formatting and i18n
Hi Roland, some messages in the Midnight Commander don't translate well to other languages because the string is concatenated manually, like in src/ext.c, line 486. I started to fix some of these in mcedit. How do you feel about the new code? Well, it is step in right direction, but I am wondering why message() are not used? -- Regards, Andrew V. Samoilov GET INTERNET ACCESS FROM BCS! http://www.bcs.zp.ua Join BCS today! For your FREE webmail, visit: http://email.zp.ua/ ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
[RFE][PATCH] Allow cd smb://, cd sh://, cd mc:// vfs requests
Hi, since we can access ftp filesystems either like cd /#ftp: or more intuitively like cd ftp:// it's not a bad idea IMNSHO to add such extensions also for other filesystems. The attached patch implements such an extension and it makes vfs_translate_url() more comprehensive in the way that the aliases are kept in a separate table. strip_password() is modified to take the change in account. Cheers, Jindrich -- Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/ ChangeLog: * vfs.c (vfs_translate_url): Add support for smb://, sh:// and mc:// filesystem requests. Introduced separate table for vfs aliases. * util.c (strip_password): Modifications to take the aliases into account while eliminating passwords. --- mc-4.6.1a-20050202/vfs/vfs.c.vfs-url 2004-11-16 17:16:08.0 +0100 +++ mc-4.6.1a-20050202/vfs/vfs.c 2005-02-07 13:03:06.660269240 +0100 @@ -981,15 +981,28 @@ vfs_fill_names (fill_names_f func) * Returns vfs path corresponding to given url. If passed string is * not recognized as url, g_strdup(url) is returned. */ + +static const struct { +const char *name; +size_t name_len; +const char *substitute; +} url_table[] = { {ftp://;, 6, /#ftp:}, + {mc://, 5, /#mc:}, + {smb://, 6, /#smb:}, + {sh://, 5, /#sh:}, + {a:, 2, /#a} +}; + char * vfs_translate_url (const char *url) { -if (strncmp (url, ftp://;, 6) == 0) - return g_strconcat (/#ftp:, url + 6, (char *) NULL); -else if (strncmp (url, a:, 2) == 0) - return g_strdup (/#a); -else - return g_strdup (url); +int i; + +for (i = 0; i sizeof (url_table)/sizeof (url_table[0]); i++) + if (!strncmp (url, url_table[i].name, url_table[i].name_len)) + return g_strconcat (url_table[i].substitute, url + url_table[i].name_len, (char*)NULL); + +return g_strdup (url); } int vfs_file_is_local (const char *filename) --- mc-4.6.1a-20050202/src/util.c.vfs-url 2004-12-02 21:08:06.0 +0100 +++ mc-4.6.1a-20050202/src/util.c 2005-02-07 13:19:53.830156144 +0100 @@ -432,10 +432,13 @@ strip_password (char *p, int has_prefix) const char *name; size_t len; } prefixes[] = { {/#ftp:, 6}, - {/#mc:, 5}, {ftp://;, 6}, + {/#mc:, 5}, + {mc://, 5}, {/#smb:, 6}, - {/#sh:, 5} + {smb://, 6}, + {/#sh:, 5}, + {sh://, 5} }; char *at, *inner_colon, *dir; size_t i; ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [RFE][PATCH] Allow cd smb://, cd sh://, cd mc:// vfs requests
Jindrich Novy wrote: Hi, since we can access ftp filesystems either like cd /#ftp: or more intuitively like cd ftp:// it's not a bad idea IMNSHO to add such extensions also for other filesystems. The attached patch implements such an extension and it makes vfs_translate_url() more comprehensive in the way that the aliases are kept in a separate table. strip_password() is modified to take the change in account. Cheers, Jindrich Jindrich, As you have already touched this part of the code, think about one more feature: replace /#ftp-like prefixes to ftp://-like on command line substitution (%d, %D, M-Enter, etc.) In most cases such substitution is used to form an argument of a command, i.e. rmp -i %D/%F, or lynx -dump %D . Currently, only internal cd command can eat /#ftp: . An ideal variant is: internal cd can handel both mc and general form, command line substitution should mostly use general form. I have a patch (written some years ago) for ftp://; case... -- Dmitry Butskoj [EMAIL PROTECTED] Saint-Petersburg, Russia Red Hat Certified Engineer 809003662809495 ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
[PATCH] Bad error checking after iconv() call
Hello, there's bad return-value checking after iconv() call in translate_character() in charsets.c: count = iconv (cd, ibuf, ibuflen, obuf, obuflen); if (count = 0 ibuflen == 0) Please note that count is size_t, what is at the most machines unsigned int so the left side of the condition is always true independently on the count value. [(size_t)(-1) is returned in case iconv() fails] This may lead to some weird drawing errors. Attached patch fixes this problem and makes translate_character() nicer a bit. Cheers, Jindrich -- Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/ ChangeLog: * charsets.c (get_codepage_index): Fixed bad error checking after iconv() call. --- mc-4.6.1a-20050202/src/charsets.c.iconv-error 2004-08-30 12:38:00.0 +0200 +++ mc-4.6.1a-20050202/src/charsets.c 2005-02-07 10:31:57.523987520 +0100 @@ -142,17 +142,16 @@ get_codepage_index (const char *id) static char translate_character (iconv_t cd, char c) { -char outbuf[4], *obuf; +char obuf[4]; size_t ibuflen, obuflen, count; ICONV_CONST char *ibuf = c; -obuf = outbuf; ibuflen = 1; -obuflen = 4; +obuflen = sizeof(obuf); -count = iconv (cd, ibuf, ibuflen, obuf, obuflen); -if (count = 0 ibuflen == 0) - return outbuf[0]; +count = iconv (cd, ibuf, ibuflen, (char **)obuf, obuflen); +if (count != (size_t)(-1) ibuflen == 0) + return obuf[0]; return UNKNCHAR; } ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: message formatting and i18n
Hello, Roland! This patch fixes too many arguments for format warning and eliminates g_string_*() at all. -- Regards, Andrew V. Samoilov GET INTERNET ACCESS FROM BCS! http://www.bcs.zp.ua Join BCS today! For your FREE webmail, visit: http://email.zp.ua/ src/ChangeLog: * ext.c (regex_command): Eliminate g_string_*(). --- ext.c~ Mon Feb 7 09:29:42 2005 +++ ext.c Mon Feb 7 15:50:27 2005 @@ -461,35 +461,27 @@ regex_command (const char *filename, con home_error = 1; goto check_stock_mc_ext; } else { - GString *msg1 = g_string_new (NULL); - GString *msg2 = g_string_new (NULL); - - g_string_sprintf (msg1, _( %s%s file error), - mc_home, MC_LIB_EXT); - g_string_sprintf (msg2, _(The format of the %smc.ext + char *title = + g_strdup_printf (_( %s%s file error), + mc_home, MC_LIB_EXT); + message (1, title, _(The format of the %smc.ext file has changed with version 3.0. It seems that the installation failed. Please fetch a fresh copy from the Midnight Commander package.), mc_home); - message (1, msg1-str, %s, msg2-str); - g_string_free (msg1, TRUE); - g_string_free (msg2, TRUE); + g_free (title); return 0; } } } if (home_error) { - GString *title = g_string_new (NULL); - GString *text = g_string_new (NULL); - - g_string_sprintf (title, _( ~/%s file error ), MC_USER_EXT); - g_string_sprintf (text, _(The format of the ~/%s file has + char *title = + g_strdup_printf (_( ~/%s file error ), MC_USER_EXT); + message (1, title, _(The format of the ~/%s file has changed with version 3.0. You may either want to copy it from %smc.ext of use that file as an example of how - to write it.), MC_USER_EXT, mc_home, mc_home); - message (1, title-str, %s, text-str); - g_string_free (title, TRUE); - g_string_free (text, TRUE); + to write it.), MC_USER_EXT, mc_home); + g_free (title); } } mc_stat (filename, mystat); ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [RFE][PATCH] Allow cd smb://, cd sh://, cd mc:// vfs requests
Hello Dmitry, On Mon, 2005-02-07 at 16:14 +0300, buc wrote: Jindrich Novy wrote: since we can access ftp filesystems either like cd /#ftp: or more intuitively like cd ftp:// it's not a bad idea IMNSHO to add such extensions also for other filesystems. The attached patch implements such an extension and it makes vfs_translate_url() more comprehensive in the way that the aliases are kept in a separate table. strip_password() is modified to take the change in account. As you have already touched this part of the code, think about one more feature: replace /#ftp-like prefixes to ftp://-like on command line substitution (%d, %D, M-Enter, etc.) In most cases such substitution is used to form an argument of a command, i.e. rmp -i %D/%F, or lynx -dump %D . Currently, only internal cd command can eat /#ftp: . An ideal variant is: internal cd can handel both mc and general form, command line substitution should mostly use general form. I have a patch (written some years ago) for ftp://; case... I only wanted to propose a more intuitive way to access various VFSes to the most of users and to let them use the functionality ASAP. Some further work to let them make their life with mc more comfortable is welcome so if you have any pending patches similar to this problem, no one will be angry if you send them here ;) Cheers, Jindrich -- Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/ ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [RFE][PATCH] Allow cd smb://, cd sh://, cd mc:// vfs requests
Jindrich Novy wrote: Hello Dmitry, I only wanted to propose a more intuitive way to access various VFSes to the most of users and to let them use the functionality ASAP. Some further work to let them make their life with mc more comfortable is welcome so if you have any pending patches similar to this problem, no one will be angry if you send them here ;) Cheers, Jindrich My old patch attached. It locates the place where something should be done now, not for ftp only... -- Dmitry Butskoj [EMAIL PROTECTED] Saint-Petersburg, Russia Red Hat Certified Engineer 809003662809495 diff -Nrbu mc-4.6.0/src/util.c mc-4.6.0-OK/src/util.c --- mc-4.6.0/src/util.c 2003-11-13 18:25:13.0 +0300 +++ mc-4.6.0-OK/src/util.c 2003-11-13 18:22:23.0 +0300 @@ -186,6 +186,13 @@ *d++ = '.'; *d++ = '/'; } +else if (*s == '/' s[1] == '#' + !strncmp (s, /#ftp:, 6) +) { + strcpy (d, ftp://;); + s += 6; + d += 6; +} for (; *s; s++, d++) { switch (*s) { ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
detach on quick-save
moin, in quick-save mode the editor just overwrites the existing file. this is all fine ... except when you cloned a source tree with cp -al and want to patch one copy. this patch adds a check whether the file has multiple hard links and asks whether the file should be detached before saving. not sure the dialog looks 100% right, but you get the idea. :) -- Hi! I'm a .signature virus! Copy me into your ~/.signature, please! -- Chaos, panic, and disorder - my work here is done. Index: edit/edit-widget.h === RCS file: /cvsroot/mc/mc/edit/edit-widget.h,v retrieving revision 1.24 diff -U2 -r1.24 edit-widget.h --- edit/edit-widget.h 3 Dec 2004 17:09:27 - 1.24 +++ edit/edit-widget.h 7 Feb 2005 17:32:40 - @@ -90,4 +90,5 @@ struct stat stat1; /* Result of mc_fstat() on the file */ +int skip_ask_if_detach:1; /* Already asked whether to detach file */ /* syntax higlighting */ Index: edit/editcmd.c === RCS file: /cvsroot/mc/mc/edit/editcmd.c,v retrieving revision 1.128 diff -U2 -r1.128 editcmd.c --- edit/editcmd.c 7 Feb 2005 07:31:19 - 1.128 +++ edit/editcmd.c 7 Feb 2005 17:32:41 - @@ -262,6 +262,23 @@ savename = g_strdup (filename); -mc_chown (savename, edit-stat1.st_uid, edit-stat1.st_gid); -mc_chmod (savename, edit-stat1.st_mode); +if (this_save_mode == EDIT_QUICK_SAVE + edit-stat1.st_nlink 1 + !edit-skip_ask_if_detach) +{ + switch (query_dialog (_( File has hard-links ), + _(Detach before saving?), 0, + 3, _(Yes), _(No), _(Cancel))) + { + case 0: + mc_unlink (savename); + /* fallthrough */ + case 1: + edit-skip_ask_if_detach = 1; + break; + default: + g_free (savename); + return 1; + } +} if ((fd = @@ -270,4 +287,7 @@ goto error_save; +mc_chown (savename, edit-stat1.st_uid, edit-stat1.st_gid); +mc_chmod (savename, edit-stat1.st_mode); + /* pipe save */ if ((p = edit_get_write_filter (savename, filename))) { ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
When will mc-4.6.2 be released?
Hi all, especially our project maintainers, the release of a new MC version is long overdue. Also there has been some confusion concerning our version numbering scheme, as some distributions consider a version 4.6.1-pre3 to be higher than 4.6.1. For these reasons I vote that the current Midnight Commander be released _this_ _month_, not as mc-4.6.1, but as mc-4.6.2. To avoid repeating those confusion, we should not announce those many release candidates. I think the next main releases should be 4.7, 4.8, 4.9, ... with 4.7.1, 4.7.2, ... being the release candidates. By the way: NetBSD already has a current Midnight Commander (4.6.1-pre2b), and although mcslang does not work at all, it was easy to make it build and run, as there is also a `slang' package. So don't be too afraid about bugs. Even the Debian people will manage the undefined references from the link editor. Roland ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: When will mc-4.6.2 be released?
Hi Roland, On Mon, 2005-02-07 at 22:20, Roland Illig wrote: the release of a new MC version is long overdue. Also there has been some confusion concerning our version numbering scheme, as some distributions consider a version 4.6.1-pre3 to be higher than 4.6.1. Nope. The point is that at December 3rd pchel tagged HEAD 4.6.1a. According to his scheme HEAD was supposed to be used for experimental code that should *not* go into 4.6.1. Essentially we where then working with two branches. However, it seems Miguel has reverted this tagging. This is ok, except for the fact that now some experimental code that was not supposed to go into 4.6.1 is now in the prerelease. I'm not sure if this is a problem, but this was *not* the intention 2 months ago. But then 2 months ago the intention was to have a release before the new year, so this tagging shouldn't be my main concern. Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: When will mc-4.6.2 be released?
Hello Roland, Tuesday, February 8, 2005, 2:20:18 AM, you wrote: RI the release of a new MC version is long overdue. Also there has been RI some confusion concerning our version numbering scheme, as some RI distributions consider a version 4.6.1-pre3 to be higher than 4.6.1. mc numbering like linux kernel, see at www.kernel.org. rc - release candidate pre - prerelease mc-4.6.1-pre3 - prerelease 3 of mc-4.6.1 RI For these reasons I vote that the current Midnight Commander be released RI _this_ _month_, not as mc-4.6.1, but as mc-4.6.2. I don't agree with it. RI To avoid repeating those confusion, we should not announce those RI many release candidates. I think the next main releases should be RI 4.7, 4.8, 4.9, ... with 4.7.1, 4.7.2, ... being the release RI candidates. RI By the way: NetBSD already has a current Midnight Commander RI (4.6.1-pre2b), and although mcslang does not work at all, it was RI easy to make it build and run, as there is also a `slang' package. I'll see on NetBSD problem today. RI So don't be too afraid about bugs. Even the Debian people will manage RI the undefined references from the link editor. Pavel Roskin doesn't release of mc-4.6.1-pre3 because: - mc exists when run remotely over ssh with X forwarding enabled: X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 38 (X_QueryPointer) Resource id in failed request: 0x60 Serial number of failed request: 6 Current serial number in output stream: 6 This is an openssh issue. Please compare https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=125838 . You need to use ssh with -Y instead of -X IIRC. I wouldn't call this an OpenSSH issue. From http://www.openssh.com/txt/release-3.8: * ssh(1) now uses untrusted cookies for X11-Forwarding. Some X11 applications might need full access to the X11 server, see ForwardX11Trusted in ssh(1) and xauth(1) for more information. So, mc needs full access, but it cannot get in certain cases. If that happens, mc should stop using X events without exiting. It's not like mc is completely useless without full access to the X server. - And - I have a cpio archive (CONTENTS.cpio from an rpm) that I cannot open in mc. mc crashes. I'm sorry, but I cannot send that archive. Here's the backtrace (Fedora Core 3 on AMD 64): #0 0x004726a2 in cpio_open_archive (me=0x5b4600, super=0x5f03d0, name=0x5efcb0 /home/proski/tmp/CONTENTS.cpio, op=0x6 Address 0x6 out of bounds) at cpio.c:245 #1 0x0046a161 in vfs_s_get_path_mangle (me=0x5b4600, inname=0x5efcb0 /home/proski/tmp/CONTENTS.cpio, archive=0x7fffde38, flags=0) at direntry.c:483 #2 0x0046a25b in vfs_s_get_path (me=0x5b4600, inname=0x488da6 070702, archive=0x7fffde38, flags=0) at direntry.c:511 #3 0x0046a33e in vfs_s_inode_from_path (me=0x5b4600, name=0x8000 Address 0x8000 out of bounds, flags=5) at direntry.c:566 #4 0x0046a3e3 in vfs_s_opendir (me=0x5b4600, dirname=0x8000 Address 0x8000 out of bounds) at direntry.c:595 #5 0x0046a4a9 in vfs_s_chdir (me=0x488da6, path=0x8000 Address 0x8000 out of bounds) at direntry.c:649 #6 0x0046e963 in mc_chdir (path=0x488da6 070702) at vfs.c:691 #7 0x004307da in _do_panel_cd (panel=0x5d86a0, new_dir=0x5efc80 CONTENTS.cpio#ucpio, cd_type=cd_parse_command) at main.c:588 #8 0x00430ab6 in do_panel_cd (panel=0x5d86a0, new_dir=0x8000 Address 0x8000 out of bounds, cd_type=cd_parse_command) at main.c:630 #9 0x0041f07a in regex_command (filename=0x0, action=0x47d8fb Open, move_dir=0x0) at ext.c:262 #10 0x0043a0c0 in do_enter (panel=0x488da6) at screen.c:1942 #11 0x0043a924 in panel_callback (panel=0x5d86a0, msg=WIDGET_DESTROY, parm=0) at screen.c:2137 #12 0x0041be9e in dlg_process_event (h=0x5d8540, key=10, event=0x0) at dialog.c:651 #13 0x0041c202 in run_dlg (h=0x5d8540) at dialog.c:777 #14 0x00431612 in main (argc=0, argv=0x0) at main.c:1674 I wasn't even testing mc. I just tried to use it. - I'm using mc-4.6.1-current and mc-4.6.1-preX very long time. Without problem. -- Best regards, Pavelmailto:[EMAIL PROTECTED] ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re[2]: message formatting and i18n
Hello Andrew, Monday, February 7, 2005, 7:26:35 PM, you wrote: AVS Hello, Roland! AVS This patch fixes too many arguments for format warning and eliminates AVS g_string_*() at all. Committed. Thx -- Best regards, Pavelmailto:[EMAIL PROTECTED] ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel