Re: [PATCH] Allow storing mc configuration in /etc/mc - take 2
On Sat, May 19, 2007 at 05:04:25PM +0300, Pavel Tsekov wrote: I am reposting in case no one noticed the previous message due to the fact that I replied to an old thread. ah, you wanted a reply ... :) From [EMAIL PROTECTED] Sun May 6 15:06:58 2007 Please, review it and let me know whether to commit. as SYSCONFDIR is a constant, it can be concatenated with the file name constants without use of concat_dir_and_file in most places. the AM_CPPFLAGS assignments in the if CONS_SAVER can be made more elgant by use of +=, but that's another story. -- Hi! I'm a .signature virus! Copy me into your ~/.signature, please! -- Chaos, panic, and disorder - my work here is done. ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] Allow storing mc configuration in /etc/mc
Hi! I wrote a patch allowing to store mc configuration to /etc/mc. It's tested within Fedora for a few months with no complaints. I moved these configuration files from /usr/share/mc to /etc/mc: I use this patch several months, all ok. -- Sincerely yours, Vadim Likhota ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] Allow storing mc configuration in /etc/mc
On Thu, 18 May 2006, Jindrich Novy wrote: On Wed, 2006-05-17 at 23:36 +0300, Pavel Tsekov wrote: I think the patch is pretty straigth forward. I am not really sure that we want to check both mc_home and mc_home_alt though. Anyway, if noone objects I'll commit this patch. I would keep both checks for a while to not to break mc when someone decides he wants the configs in one place as it used to be (/usr/share/mc). On the other hand we could remove the dual checks after some time when the most of the mc users are aware of the change. I can write a patch for it as well then. I don't want to start a big discussion about it - either way it is acceptable. I just occured to me that it may be confusing for the end user if both paths are checked. If someone wants to store the config files in the old place he just needs to configure MC accordingly. What's more important if someone wants to use their old config files without doing anything it won't work either. So in both cases the user has to be aware of the fact that MC looks for config files in a different place. ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] Allow storing mc configuration in /etc/mc
On Thu, May 18, 2006 at 04:09:00PM +0300, Pavel Tsekov wrote: On Thu, 18 May 2006, Jindrich Novy wrote: On Wed, 2006-05-17 at 23:36 +0300, Pavel Tsekov wrote: I think the patch is pretty straigth forward. I am not really sure that we want to check both mc_home and mc_home_alt though. Anyway, if noone objects I'll commit this patch. I would keep both checks for a while to not to break mc when someone decides he wants the configs in one place as it used to be (/usr/share/mc). On the other hand we could remove the dual checks after some time when the most of the mc users are aware of the change. I can write a patch for it as well then. I don't want to start a big discussion about it - either way it is acceptable. I just occured to me that it may be confusing for the end user if both paths are checked. you bet it is. for example, suse-packaged kdm has a long track record of confusing the hell out of users with this approach. i'd much prefer a clean switch to sysconfdir, which is presumably what the debian packaging does. -- Hi! I'm a .signature virus! Copy me into your ~/.signature, please! -- Chaos, panic, and disorder - my work here is done. ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] Allow storing mc configuration in /etc/mc
On Thu, 18 May 2006, Oswald Buddenhagen wrote: On Thu, May 18, 2006 at 04:09:00PM +0300, Pavel Tsekov wrote: On Thu, 18 May 2006, Jindrich Novy wrote: On Wed, 2006-05-17 at 23:36 +0300, Pavel Tsekov wrote: I think the patch is pretty straigth forward. I am not really sure that we want to check both mc_home and mc_home_alt though. Anyway, if noone objects I'll commit this patch. I would keep both checks for a while to not to break mc when someone decides he wants the configs in one place as it used to be (/usr/share/mc). On the other hand we could remove the dual checks after some time when the most of the mc users are aware of the change. I can write a patch for it as well then. I don't want to start a big discussion about it - either way it is acceptable. I just occured to me that it may be confusing for the end user if both paths are checked. you bet it is. for example, suse-packaged kdm has a long track record of confusing the hell out of users with this approach. i'd much prefer a clean switch to sysconfdir, which is presumably what the debian packaging does. Oswald, your advice is always appreciated. Let's see what the rest of the MC developes think about that patch and whether Jindrich is willing to change his patch. ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] Allow storing mc configuration in /etc/mc
Hi Pavel, On Thu, 2006-05-18 at 23:17 +0300, Pavel Tsekov wrote: Let's see what the rest of the MC developes think about that patch and whether Jindrich is willing to change his patch. A consistent change to the new location is fine with me :) . Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
[PATCH] Allow storing mc configuration in /etc/mc
Hi all, I wrote a patch allowing to store mc configuration to /etc/mc. It's tested within Fedora for a few months with no complaints. I moved these configuration files from /usr/share/mc to /etc/mc: extfs/extfs.ini extfs/sfs.ini syntax/Syntax cedit.menu edit.indent.rc edit.spell.rc mc.charsets mc.ext mc.lib mc.menu and let the rest in the /usr/share/mc location since they are not config files. The patch changes the default way how mc looks for config files in the way that it first searches /etc/mc and if not found, the fallback is to search /usr/share/mc. So it is fully consistent with the former mc behavior. Cheers, Jindrich -- Jindrich Novy [EMAIL PROTECTED] --- mc-4.6.1a/src/charsets.c.etcmc 2005-05-27 05:35:15.0 +0200 +++ mc-4.6.1a/src/charsets.c 2006-02-24 15:17:05.0 +0100 @@ -45,12 +45,17 @@ load_codepages_list (void) char *fname; char buf[256]; extern char *mc_home; +extern char *mc_home_alt; extern int display_codepage; char *default_codepage = NULL; fname = concat_dir_and_file (mc_home, CHARSETS_INDEX); if (!(f = fopen (fname, r))) { - fprintf (stderr, _(Warning: file %s not found\n), fname); +g_free (fname); +fname = concat_dir_and_file (mc_home_alt, CHARSETS_INDEX); +if (!(f = fopen (fname, r))) { + fprintf (stderr, _(Warning: file %s not found\n), fname); +} g_free (fname); return -1; } --- mc-4.6.1a/src/main.h.etcmc 2006-02-24 15:17:05.0 +0100 +++ mc-4.6.1a/src/main.h 2006-02-24 15:17:05.0 +0100 @@ -112,7 +112,7 @@ void print_vfs_message(const char *msg, extern const char *prompt; extern const char *edit_one_file; -extern char *mc_home; +extern char *mc_home, *mc_home_alt; char *get_mc_lib_dir (void); int maybe_cd (int move_up_dir); --- mc-4.6.1a/src/ext.c.etcmc 2005-07-31 22:29:35.0 +0200 +++ mc-4.6.1a/src/ext.c 2006-02-24 15:17:05.0 +0100 @@ -444,6 +444,10 @@ regex_command (const char *filename, con g_free (extension_file); check_stock_mc_ext: extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT); + if (!exist_file (extension_file)) { + g_free (extension_file); + extension_file = concat_dir_and_file (mc_home_alt, MC_LIB_EXT); + } mc_user_ext = 0; } data = load_file (extension_file); --- mc-4.6.1a/src/setup.c.etcmc 2006-01-29 21:26:05.0 +0100 +++ mc-4.6.1a/src/setup.c 2006-02-24 15:17:05.0 +0100 @@ -481,8 +481,15 @@ setup_init (void) if (exist_file (inifile)){ g_free (profile); profile = inifile; - } else + } else { g_free (inifile); + inifile = concat_dir_and_file (mc_home_alt, mc.ini); + if (exist_file (inifile)) { + g_free (profile); + profile = inifile; + } else + g_free (inifile); + } } profile_name = profile; @@ -501,6 +508,11 @@ load_setup (void) /* mc.lib is common for all users, but has priority lower than ~/.mc/ini. FIXME: it's only used for keys and treestore now */ global_profile_name = concat_dir_and_file (mc_home, mc.lib); + +if (!exist_file(global_profile_name)) { + g_free (global_profile_name); + global_profile_name = concat_dir_and_file (mc_home_alt, mc.lib); +} /* Load integer boolean options */ for (i = 0; int_options[i].opt_name; i++) --- mc-4.6.1a/src/Makefile.am.etcmc 2006-02-04 12:13:30.0 +0100 +++ mc-4.6.1a/src/Makefile.am 2006-02-24 15:17:05.0 +0100 @@ -8,9 +8,11 @@ bin_PROGRAMS = mc mcmfmt if CONS_SAVER pkglibexec_PROGRAMS = cons.saver AM_CPPFLAGS = -DDATADIR=\$(pkgdatadir)/\ -DLOCALEDIR=\$(localedir)\ \ - -DSAVERDIR=\$(pkglibexecdir)\ + -DSAVERDIR=\$(pkglibexecdir)\ \ + -DSYSCONFDIR=\$(sysconfdir)/@PACKAGE@/\ else -AM_CPPFLAGS = -DDATADIR=\$(pkgdatadir)/\ -DLOCALEDIR=\$(localedir)\ +AM_CPPFLAGS = -DDATADIR=\$(pkgdatadir)/\ -DLOCALEDIR=\$(localedir)\ \ + -DSYSCONFDIR=\$(sysconfdir)/@PACKAGE@/\ endif noinst_PROGRAMS = man2hlp --- mc-4.6.1a/src/util.c.etcmc 2006-02-24 15:17:05.0 +0100 +++ mc-4.6.1a/src/util.c 2006-02-24 15:17:05.0 +0100 @@ -40,7 +40,7 @@ #include tty.h #include global.h #include profile.h -#include main.h /* mc_home */ +#include main.h /* mc_home, mc_home_alt */ #include cmd.h /* guess_message_value */ #include mountlist.h #include win.h /* xterm_flag */ @@ -950,16 +950,25 @@ load_mc_home_file (const char *filename, if (!data) { g_free (hintfile); - /* Fall back to the two-letter language code */ - if (lang[0] lang[1]) - lang[2] = 0; + g_free (hintfile_base); + + hintfile_base = concat_dir_and_file (mc_home_alt, filename); + hintfile = g_strconcat (hintfile_base, ., lang, (char *) NULL); data = load_file (hintfile); - + if (!data) { - g_free (hintfile); - hintfile = hintfile_base; - data = load_file (hintfile_base); + /* Fall back to the two-letter language code */ + if (lang[0] lang[1]) + lang[2] = 0; + hintfile =
Re: [PATCH] Allow storing mc configuration in /etc/mc
On Wed, 17 May 2006, Jindrich Novy wrote: I wrote a patch allowing to store mc configuration to /etc/mc. It's tested within Fedora for a few months with no complaints. I moved these configuration files from /usr/share/mc to /etc/mc: extfs/extfs.ini extfs/sfs.ini syntax/Syntax cedit.menu edit.indent.rc edit.spell.rc mc.charsets mc.ext mc.lib mc.menu and let the rest in the /usr/share/mc location since they are not config files. The patch changes the default way how mc looks for config files in the way that it first searches /etc/mc and if not found, the fallback is to search /usr/share/mc. So it is fully consistent with the former mc behavior. I think the patch is pretty straigth forward. I am not really sure that we want to check both mc_home and mc_home_alt though. Anyway, if noone objects I'll commit this patch. ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel