patch to get a relocateable mc
- From: Ludovic Drolez <ludovic drolez freealter com>
- To: mc-devel gnome org
- Subject: patch to get a relocateable mc
- Date: Fri, 20 Jul 2001 10:56:09 +0200
Hi !
I've just found that mc is not relocateable. If you compile mc with
'--prefix=/tmp/xxx' and
then move it to /usr/local, even with 'export
MC_LIBDIR=/usr/local/lib/mc' some things
do not work:
- syntax highlighting
- single filesystem (.tgz ...)
- + bogus error messages
Indeed, to take into account 'MC_LIBDIR' you need to use the 'mc_home'
variable
and not the LIBDIR define.
The included patch fixes that. (for 4.5.5X)
Regards,
Ludovic Drolez.
diff -uNr mc-4.5.51.orig/gtkedit/syntax.c mc-4.5.51/gtkedit/syntax.c
--- mc-4.5.51.orig/gtkedit/syntax.c Mon Jul 3 16:32:03 2000
+++ mc-4.5.51/gtkedit/syntax.c Fri Jul 20 10:24:52 2001
@@ -598,6 +598,8 @@
static FILE *open_include_file (char *filename)
{
FILE *f;
+ char *mc_libdir;
+
char p[MAX_PATH_LEN];
syntax_free (error_file_name);
error_file_name = (char *) strdup (filename);
@@ -611,8 +613,10 @@
f = fopen (p, "r");
if (f)
return f;
- strcpy (p, LIBDIR "/syntax/");
+ mc_libdir = concat_dir_and_file (mc_home, "/syntax/");
+ strcpy (p, mc_libdir);
strcat (p, filename);
+ free (mc_libdir);
syntax_free (error_file_name);
error_file_name = (char *) strdup (p);
return fopen (p, "r");
diff -uNr mc-4.5.51.orig/vfs/extfs.c mc-4.5.51/vfs/extfs.c
--- mc-4.5.51.orig/vfs/extfs.c Mon Jul 3 16:31:59 2000
+++ mc-4.5.51/vfs/extfs.c Fri Jul 20 10:24:34 2001
@@ -1052,10 +1052,10 @@
mc_extfsini = concat_dir_and_file (mc_home, "extfs/extfs.ini");
cfg = fopen (mc_extfsini, "r");
- g_free (mc_extfsini);
if (!cfg) {
- fprintf( stderr, "Warning: " LIBDIR "extfs/extfs.ini not found\n" );
+ fprintf( stderr, "Warning: %s not found\n", mc_extfsini );
+ g_free (mc_extfsini);
return 0;
}
@@ -1075,8 +1075,9 @@
/* We may not use vfs_die() message or message_1s or similar,
* UI is not initialized at this time and message would not
* appear on screen. */
- fprintf( stderr, "Warning: You need to update your " LIBDIR "extfs/extfs.ini file.\n" );
+ fprintf( stderr, "Warning: You need to update your %s file.\n", mc_extfsini );
fclose(cfg);
+ g_free (mc_extfsini);
return 0;
}
if (*key == '#')
@@ -1098,6 +1099,7 @@
extfs_no++;
}
fclose(cfg);
+ g_free (mc_extfsini);
return 1;
}
diff -uNr mc-4.5.51.orig/vfs/sfs.c mc-4.5.51/vfs/sfs.c
--- mc-4.5.51.orig/vfs/sfs.c Mon Jul 3 16:31:59 2000
+++ mc-4.5.51/vfs/sfs.c Fri Jul 20 10:24:40 2001
@@ -291,12 +291,18 @@
static int sfs_init (vfs *me)
{
- FILE *cfg = fopen (LIBDIR "extfs/sfs.ini", "r");
+ char *mc_sfsini;
+ FILE *cfg;
+
+ mc_sfsini = concat_dir_and_file (mc_home, "extfs/sfs.ini");
+ cfg = fopen (mc_sfsini, "r");
if (!cfg){
- fprintf (stderr, "Warning: " LIBDIR "extfs/sfs.ini not found\n");
- return 0;
+ fprintf (stderr, "Warning: %s not found\n", mc_sfsini);
+ free (mc_sfsini);
+ return 0;
}
+ free (mc_sfsini);
sfs_no = 0;
while (sfs_no < MAXFS){
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]