[PATCH] Choose syntax with dynamic list allocation
Hi, Well, it turned out my pointer arithmetic wasn't that bad, but testing for (! count % NENTRIES) to reallocate the list is not entirely correct ;). Here is a patch which allocates the syntax list dynamically. NENTRIES is currently defined as 3, but that is for testing purposes only. Maybe we should save the syntax list instead of creating it on every invocation of the editor? Leonard. -- mount -t life -o ro /dev/dna /genetic/research diff -pruN MC_4_6_1_PRE/mc/edit/choosesyntax.c MC_4_6_1_PRE.syntax/mc/edit/choosesyntax.c --- MC_4_6_1_PRE/mc/edit/choosesyntax.c 1970-01-01 01:00:00.0 +0100 +++ MC_4_6_1_PRE.syntax/mc/edit/choosesyntax.c 2005-07-20 14:39:07.0 +0200 @@ -0,0 +1,94 @@ +/* User interface for syntax selection. + + Copyright (C) 2005 Leonard den Ottolander leonard den ottolander nl + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include config.h +#include edit.h +#include ../src/wtools.h + +#define MAX_ENTRY_LEN 40 +#define LIST_LINES 14 +#define N_DFLT_ENTRIES 1 + +int +exec_edit_syntax_dialog (const char **names) { +int i; + +Listbox *syntaxlist = create_listbox_window (MAX_ENTRY_LEN, LIST_LINES, + N_( Choose syntax highlighting ), NULL); +LISTBOX_APPEND_TEXT (syntaxlist, 'A', N_( Auto ), NULL); + +for (i = 0; names[i]; i++) { + LISTBOX_APPEND_TEXT (syntaxlist, 0, names[i], NULL); + if (! option_auto_syntax option_syntax_type + (strcmp (names[i], option_syntax_type) == 0)) + listbox_select_by_number (syntaxlist-list, i + N_DFLT_ENTRIES); +} + +return run_listbox (syntaxlist); +} + +void +edit_syntax_dialog (void) { +char *old_syntax_type; +int old_auto_syntax, syntax; +char **names; +int i; + +names = (char**) g_malloc (sizeof (char*)); +names[0] = NULL; +/* We fill the list of syntax files every time the editor is invoked. + Instead we could save the list to a file and update it once the syntax + file gets updated (either by testing or by explicit user command). */ +edit_load_syntax (NULL, names, NULL); + +if ((syntax = exec_edit_syntax_dialog ((const char**) names)) 0) { + for (i = 0; names[i]; i++) { + g_free (names[i]); + } + g_free (names); + return; +} + +old_auto_syntax = option_auto_syntax; +old_syntax_type = g_strdup (option_syntax_type); + +/* Using a switch as we might want to define more specific commands, f.e. + Refill syntax list (compare N_DFLT_ENTRIES). */ +switch (syntax) { + case 0: /* auto syntax */ + option_auto_syntax = 1; + break; + default: + option_auto_syntax = 0; + g_free (option_syntax_type); + option_syntax_type = g_strdup (names[syntax - N_DFLT_ENTRIES]); +} + +/* Load or unload syntax rules if the option has changed */ +if (option_auto_syntax !old_auto_syntax || old_auto_syntax || + old_syntax_type option_syntax_type + (strcmp (old_syntax_type, option_syntax_type) != 0)) + edit_load_syntax (wedit, NULL, option_syntax_type); + +for (i = 0; names[i]; i++) { + g_free (names[i]); +} +g_free (names); +g_free (old_syntax_type); +} diff -pruN MC_4_6_1_PRE/mc/edit/edit.c MC_4_6_1_PRE.syntax/mc/edit/edit.c --- MC_4_6_1_PRE/mc/edit/edit.c 2005-05-29 12:04:00.0 +0200 +++ MC_4_6_1_PRE.syntax/mc/edit/edit.c 2005-07-20 14:39:07.0 +0200 @@ -499,6 +499,7 @@ edit_init (WEdit *edit, int lines, int c long line) { int to_free = 0; +option_auto_syntax = 1; /* Resetting to auto on every invokation */ if (!edit) { #ifdef ENABLE_NLS diff -pruN MC_4_6_1_PRE/mc/edit/editcmd.c MC_4_6_1_PRE.syntax/mc/edit/editcmd.c --- MC_4_6_1_PRE/mc/edit/editcmd.c 2005-05-29 12:04:00.0 +0200 +++ MC_4_6_1_PRE.syntax/mc/edit/editcmd.c 2005-07-20 14:39:07.0 +0200 @@ -512,7 +512,7 @@ edit_save_as_cmd (WEdit *edit) edit-modified = 0; edit-delete_file = 0; if (different_filename) - edit_load_syntax (edit, 0, 0); + edit_load_syntax (edit, NULL, option_syntax_type); edit-force |= REDRAW_COMPLETELY; return 1; } else { diff -pruN MC_4_6_1_PRE/mc/edit/edit.h MC_4_6_1_PRE.syntax/mc/edit/edit.h --- MC_4_6_1_PRE/mc/edit/edit.h 2005-05-29 12:04:00.0 +0200 +++ MC_4_6_1_PRE.syntax/mc/edit/edit.h 2005-07-20 14:39:07.0 +0200 @@ -234,7 +234,7 @@ void
Let's have a release!
Hi Miguel, Pavel, The latest pre release hasn't brought many serious issues to light. Pavel Tsekov fixed an old double free condition and one or two other buglets. We seen hardly any translation updates except for Dutch (which I did). I think it is time to finally have a release of 4.6.1. I'm satisfied with having had an official pre release and a few weeks time for testing. Afaict all the other developers are anxious for a release as well. Let's have it! Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] Choose syntax with dynamic list allocation
Hi, On Wed, 2005-07-20 at 15:13, Leonard den Ottolander wrote: Here is a patch which allocates the syntax list dynamically. NENTRIES is currently defined as 3, but that is for testing purposes only. Oops. Almost forgot to tell you this is a patch against PRE, not HEAD. If no serious issues are found with it I'll update it for HEAD and commit it in a couple of days. Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Let's have a release!
Leonard den Ottolander wrote: I think it is time to finally have a release of 4.6.1. I'm satisfied with having had an official pre release and a few weeks time for testing. Afaict all the other developers are anxious for a release as well. Let's have it! Me too! Roland ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Let's have a release!
On Wed, 2005-07-20 at 15:19 +0200, Leonard den Ottolander wrote: Hi Miguel, Pavel, The latest pre release hasn't brought many serious issues to light. Pavel Tsekov fixed an old double free condition and one or two other buglets. We seen hardly any translation updates except for Dutch (which I did). I think it is time to finally have a release of 4.6.1. I'm satisfied with having had an official pre release and a few weeks time for testing. Afaict all the other developers are anxious for a release as well. Let's have it! Leonard. Not very frequently I use ASCII art, but this is my big __ __ _ _/ / / / / / _ \/ ___/ / / /_/ / __(__ )_/ \__, /\___/(_) // Please don't linger with mc release any more. Jindrich -- Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/ The worst evil in the world is refusal to think. ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Let's have a release!
Hello, I think it is time to finally have a release of 4.6.1. I'm satisfied with having had an official pre release and a few weeks time for testing. Afaict all the other developers are anxious for a release as well. Let's have it! If Pavel does not beat me to it, I will do the release on the weekend. Miguel ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
glibc and getgrouplist
and, in src/utilunix.c, write #if defined(HAVE_GETGROUPLIST) !defined(HAVE_GLIBC_2_3_2) ... #endif Roland Index: configure.ac === RCS file: /cvsroot/mc/mc/configure.ac,v retrieving revision 1.30 diff -u -p -r1.30 configure.ac --- configure.ac10 Jul 2005 10:45:28 - 1.30 +++ configure.ac20 Jul 2005 19:06:02 - @@ -179,6 +179,25 @@ AC_CHECK_FUNCS([atoll cfgetospeed getsid putenv setreuid setuid statfs strerror strftime \ sysconf tcgetattr tcsetattr truncate getgrouplist]) +dnl The GNU libc, version 2.3.2 has a buffer overflow in the getgrouplist(3) +dnl function, so we cannot use that function. +AC_MSG_CHECKING([for glibc version]) +AC_LINK_IFELSE([ +#include gnu/libc-version.h +#include stdio.h +int main(void) { +return puts(gnu_get_libc_version()); +} +], [ +mc_glibc_version=`./conftest$ac_exeext` +if test x${mc_glibc_version} = x2.3.2; then + AC_DEFINE([HAVE_GLIBC_2_3_2], 1, [Define this if you have glibc-2.3.2]) +fi +AC_MSG_RESULT([${mc_glibc_version}]) +], [ +AC_MSG_RESULT([none]) +]) + dnl S-Lang needs all four functions to be defined to use POSIX signal API AC_CHECK_FUNCS([sigaction sigemptyset sigprocmask sigaddset], , [slang_signals=no]) if test x$slang_signals != xno; then ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Removal of 7-zip oipening support - accidental?
Hello, Leonard! I see that you have removed support for opening 7-Zip archives in revision 1.79 of lib/mc.ext.in. The commit comments don't mention 7-Zip explicitly and it doesn't seem you meant to remove it: revision 1.79 date: 2005/07/03 12:43:15; author: leonardjo; state: Exp; lines: +36 -31 lib/mc.ext.in: Move matches for plain compressed files down. I think it would be polite to you inform the author of the original patch if you are undoing it. Maybe you removed 7-zip opening support accidentally? CVS should prevent it, unless you do something gross. One possible scenario would be if you copy the file from the working directory, update from CVS and copy the file back to the working directory. If that was the case, please don't do it again. I'm restoring 7-zip opening support, and if you want to remove it again, I want to hear your arguments. -- Regards, Pavel Roskin ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Removal of 7-zip oipening support - accidental?
Hello Pavel, On Wed, 2005-07-20 at 23:28, Pavel Roskin wrote: revision 1.79 date: 2005/07/03 12:43:15; author: leonardjo; state: Exp; lines: +36 -31 lib/mc.ext.in: Move matches for plain compressed files down. I think it would be polite to you inform the author of the original patch if you are undoing it. Maybe you removed 7-zip opening support accidentally? CVS should prevent it, unless you do something gross. This was indeed unintentional. I must have pressed F8 once accidently when updating this file. This is why the open line was removed and the view line stayed around. I'll try to be more careful next time. Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: glibc and getgrouplist
Hi Roland, On Wed, 2005-07-20 at 21:08, Roland Illig wrote: and, in src/utilunix.c, write #if defined(HAVE_GETGROUPLIST) !defined(HAVE_GLIBC_2_3_2) ... #endif We shouldn't need to patch utilunix.c. Just don't do AC_CHECK_FUNCS([getgrouplist]) in case of glibc version 2.3.2. Well, that's the approach I had in mind ;) . Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: glibc and getgrouplist
Hi, How does one test for the availability of glibc in configure.ac, and for glibc's version next? Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Removal of 7-zip oipening support - accidental?
Hi Pavel, On Thu, 2005-07-21 at 00:24, Leonard den Ottolander wrote: This was indeed unintentional. I must have pressed F8 once accidently when updating this file. No such thing happened. I was under the impression PRE and HEAD were in sync here, so I just copied in the PRE version into HEAD. These kind of minor changes that are unlikely to break things have been kept in sync since the development freeze in december, so you might want to commit it to PRE as well. Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] add 'ualz' to MC extfs.
Hi Pavel, On Fri, 2005-07-15 at 23:32, Pavel Roskin wrote: I don't think it should be added to the main distribution because the compression software (ALZip) is not free and not really popular, so mc would in effect advertise it. What's the use of putting hooks in mc.ext.in and configure.ac if you don't want to put the actual support for the fs in mc? Maybe these hooks should be part of the patch set in contrib instead? Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Removal of 7-zip oipening support - accidental?
On Thu, 21 Jul 2005 01:26:17 +0200 Leonard den Ottolander [EMAIL PROTECTED] wrote: No such thing happened. I was under the impression PRE and HEAD were in sync here, so I just copied in the PRE version into HEAD. These kind of minor changes that are unlikely to break things have been kept in sync since the development freeze in december, so you might want to commit it to PRE as well. Usually who breaks things, fixes them. Besides, Pavel is probably busy, so please readd support for opening 7-Zip archives. Regards, Nerijus ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel