diff --git a/edit/editcmd.c b/edit/editcmd.c
index 01262f1..4bb0ef6 100644
a
|
b
|
|
50 | 50 | #include "../src/tty.h" /* LINES */ |
51 | 51 | #include "../src/widget.h" /* listbox_new() */ |
52 | 52 | #include "../src/layout.h" /* clr_scr() */ |
53 | | #include "../src/main.h" /* mc_home */ |
| 53 | #include "../src/main.h" /* mc_home, mc_home_alt */ |
54 | 54 | #include "../src/help.h" /* interactive_display() */ |
55 | 55 | #include "../src/key.h" /* XCTRL */ |
56 | 56 | #include "../src/dialog.h" /* do_refresh() */ |
… |
… |
edit_block_process_cmd (WEdit *edit, const char *shell_cmd, int block) |
2530 | 2530 | return; |
2531 | 2531 | } |
2532 | 2532 | if (!(script_src = fopen (o, "r"))) { |
2533 | | fclose (script_home); |
2534 | | unlink (h); |
2535 | | edit_error_dialog ("", get_sys_error (catstrs |
2536 | | (_("Error reading script:"), |
2537 | | o, (char *) NULL))); |
2538 | | return; |
| 2533 | o = catstrs (mc_home_alt, shell_cmd, (char *) NULL); |
| 2534 | if (!(script_src = fopen (o, "r"))) { |
| 2535 | fclose (script_home); |
| 2536 | unlink (h); |
| 2537 | edit_error_dialog ("", get_sys_error (catstrs |
| 2538 | (_("Error reading script:"), |
| 2539 | o, (char *) NULL))); |
| 2540 | return; |
| 2541 | } |
2539 | 2542 | } |
2540 | 2543 | while (fgets (buf, sizeof (buf), script_src)) |
2541 | 2544 | fputs (buf, script_home); |
diff --git a/edit/syntax.c b/edit/syntax.c
index 23e8b6c..1f6b2d6 100644
a
|
b
|
|
38 | 38 | #include "edit.h" |
39 | 39 | #include "edit-widget.h" |
40 | 40 | #include "../src/color.h" /* use_colors */ |
41 | | #include "../src/main.h" /* mc_home */ |
| 41 | #include "../src/main.h" /* mc_home, mc_home_alt */ |
42 | 42 | #include "../src/wtools.h" /* message() */ |
43 | 43 | |
44 | 44 | /* bytes */ |
… |
… |
static FILE *open_include_file (const char *filename) |
681 | 681 | g_free (error_file_name); |
682 | 682 | error_file_name = g_strconcat (mc_home, PATH_SEP_STR "syntax" PATH_SEP_STR, |
683 | 683 | filename, (char *) NULL); |
| 684 | |
| 685 | if (!(f = fopen (error_file_name, "r"))) { |
| 686 | g_free (error_file_name); |
| 687 | error_file_name = g_strconcat (mc_home_alt, PATH_SEP_STR "syntax" PATH_SEP_STR, |
| 688 | filename, (char *) NULL); |
| 689 | } else return f; |
| 690 | |
684 | 691 | return fopen (error_file_name, "r"); |
685 | 692 | } |
686 | 693 | |
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5f61432..c0f08c0 100644
a
|
b
|
endif |
9 | 9 | LIBFILES_OUT = mc.ext |
10 | 10 | LIBFILES_CONST = mc.hint mc.hint.cs mc.hint.es mc.hint.hu mc.hint.it \ |
11 | 11 | mc.hint.nl mc.hint.pl mc.hint.ru mc.hint.sr mc.hint.uk \ |
12 | | mc.hint.zh mc.lib mc.menu mc.menu.sr cedit.menu edit.indent.rc \ |
13 | | edit.spell.rc |
| 12 | mc.hint.zh mc.menu.sr |
14 | 13 | |
15 | 14 | noinst_DATA = README.xterm mcserv.init mcserv.pamd xterm.ad |
16 | 15 | |
… |
… |
SCRIPTS_OUT = mc.csh mc.sh mc-wrapper.csh mc-wrapper.sh |
19 | 18 | |
20 | 19 | suppbin_SCRIPTS = $(SCRIPTS_OUT) |
21 | 20 | |
22 | | pkgdata_DATA = $(LIBFILES_CONST) $(LIBFILES_ADD) $(LIBFILES_OUT) |
| 21 | pkgdata_DATA = $(LIBFILES_CONST) |
23 | 22 | |
24 | 23 | CLEANFILES = $(SCRIPTS_OUT) |
25 | 24 | |
| 25 | cfgdir = $(sysconfdir)/@PACKAGE@ |
| 26 | cfg_DATA = \ |
| 27 | cedit.menu \ |
| 28 | edit.indent.rc \ |
| 29 | edit.spell.rc \ |
| 30 | $(LIBFILES_OUT) \ |
| 31 | mc.lib \ |
| 32 | mc.menu \ |
| 33 | $(LIBFILES_ADD) |
| 34 | |
26 | 35 | # Files processed by configure don't need to be here |
27 | 36 | EXTRA_DIST = \ |
28 | 37 | $(LIBFILES_CONST) \ |
diff --git a/src/Makefile.am b/src/Makefile.am
index ccf0f8b..b93c9c8 100644
a
|
b
|
bin_PROGRAMS = mc mcmfmt |
8 | 8 | if CONS_SAVER |
9 | 9 | pkglibexec_PROGRAMS = cons.saver |
10 | 10 | AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" \ |
11 | | -DSAVERDIR=\""$(pkglibexecdir)"\" |
| 11 | -DSAVERDIR=\""$(pkglibexecdir)"\" \ |
| 12 | -DSYSCONFDIR=\""$(sysconfdir)/@PACKAGE@/"\" |
12 | 13 | else |
13 | | AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" |
| 14 | AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" \ |
| 15 | -DSYSCONFDIR=\""$(sysconfdir)/@PACKAGE@/"\" |
14 | 16 | endif |
15 | 17 | |
16 | 18 | noinst_PROGRAMS = man2hlp |
diff --git a/src/charsets.c b/src/charsets.c
index 5666c23..bd29648 100644
a
|
b
|
load_codepages_list (void) |
45 | 45 | char *fname; |
46 | 46 | char buf[256]; |
47 | 47 | extern char *mc_home; |
| 48 | extern char *mc_home_alt; |
48 | 49 | extern int display_codepage; |
49 | 50 | char *default_codepage = NULL; |
50 | 51 | |
51 | 52 | fname = concat_dir_and_file (mc_home, CHARSETS_INDEX); |
52 | 53 | if (!(f = fopen (fname, "r"))) { |
53 | | fprintf (stderr, _("Warning: file %s not found\n"), fname); |
| 54 | g_free (fname); |
| 55 | fname = concat_dir_and_file (mc_home_alt, CHARSETS_INDEX); |
| 56 | if (!(f = fopen (fname, "r"))) { |
| 57 | fprintf (stderr, _("Warning: file %s not found\n"), fname); |
| 58 | } |
54 | 59 | g_free (fname); |
55 | 60 | return -1; |
56 | 61 | } |
diff --git a/src/cmd.c b/src/cmd.c
index 01d110f..f332789 100644
a
|
b
|
void ext_cmd (void) |
570 | 570 | check_for_default (extdir, buffer); |
571 | 571 | do_edit (buffer); |
572 | 572 | g_free (buffer); |
573 | | } else if (dir == 1) |
| 573 | } else if (dir == 1) { |
| 574 | if (!exist_file(extdir)) { |
| 575 | g_free (extdir); |
| 576 | extdir = concat_dir_and_file (mc_home_alt, MC_LIB_EXT); |
| 577 | } |
574 | 578 | do_edit (extdir); |
| 579 | } |
575 | 580 | |
576 | 581 | g_free (extdir); |
577 | 582 | flush_extension_file (); |
… |
… |
menu_edit_cmd (int where) |
595 | 600 | |
596 | 601 | menufile = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); |
597 | 602 | |
| 603 | if (!exist_file(menufile)) { |
| 604 | g_free (menufile); |
| 605 | menufile = concat_dir_and_file (mc_home_alt, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); |
| 606 | } |
| 607 | |
598 | 608 | switch (dir) { |
599 | 609 | case 0: |
600 | 610 | buffer = g_strdup (where ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU); |
… |
… |
menu_edit_cmd (int where) |
608 | 618 | |
609 | 619 | case 2: |
610 | 620 | buffer = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); |
| 621 | if (!exist_file(buffer)) { |
| 622 | g_free (buffer); |
| 623 | buffer = concat_dir_and_file (mc_home_alt, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); |
| 624 | } |
611 | 625 | break; |
612 | 626 | |
613 | 627 | default: |
… |
… |
edit_syntax_cmd (void) |
666 | 680 | _(" Which syntax file you want to edit? "), 0, 2, |
667 | 681 | _("&User"), _("&System Wide")); |
668 | 682 | } |
669 | | extdir = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax"); |
| 683 | extdir = concat_dir_and_file (mc_home_alt, "syntax" PATH_SEP_STR "Syntax"); |
670 | 684 | |
671 | 685 | if (dir == 0) { |
672 | 686 | buffer = concat_dir_and_file (home_dir, SYNTAX_FILE); |
diff --git a/src/ext.c b/src/ext.c
index 8e64d2c..7acaf31 100644
a
|
b
|
regex_command (const char *filename, const char *action, int *move_dir) |
445 | 445 | g_free (extension_file); |
446 | 446 | check_stock_mc_ext: |
447 | 447 | extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT); |
| 448 | if (!exist_file (extension_file)) { |
| 449 | g_free (extension_file); |
| 450 | extension_file = concat_dir_and_file (mc_home_alt, MC_LIB_EXT); |
| 451 | } |
448 | 452 | mc_user_ext = 0; |
449 | 453 | } |
450 | 454 | data = load_file (extension_file); |
diff --git a/src/main.c b/src/main.c
index a59607e..c6f3bf9 100644
a
|
b
|
int midnight_shutdown = 0; |
276 | 276 | /* The user's shell */ |
277 | 277 | const char *shell = NULL; |
278 | 278 | |
279 | | /* mc_home: The home of MC */ |
| 279 | /* mc_home: The home of MC - /etc/mc or defined by MC_DATADIR */ |
280 | 280 | char *mc_home = NULL; |
281 | 281 | |
| 282 | /* mc_home_alt: Alternative home of MC - deprecated /usr/share/mc */ |
| 283 | char *mc_home_alt = NULL; |
| 284 | |
282 | 285 | char cmd_buf[512]; |
283 | 286 | |
284 | 287 | static void |
… |
… |
OS_Setup (void) |
1777 | 1780 | if ((mc_libdir = getenv ("MC_DATADIR")) != NULL) { |
1778 | 1781 | mc_home = g_strdup (mc_libdir); |
1779 | 1782 | } else { |
1780 | | mc_home = g_strdup (DATADIR); |
| 1783 | mc_home = g_strdup (SYSCONFDIR); |
1781 | 1784 | } |
| 1785 | mc_home_alt = mc_libdir != NULL ? g_strdup (SYSCONFDIR) : g_strdup (DATADIR); |
1782 | 1786 | } |
1783 | 1787 | |
1784 | 1788 | static void |
… |
… |
process_args (poptContext ctx, int c, const char *option_arg) |
1908 | 1912 | break; |
1909 | 1913 | |
1910 | 1914 | case 'f': |
1911 | | printf ("%s\n", mc_home); |
| 1915 | printf ("%s (%s)\n", mc_home, mc_home_alt); |
1912 | 1916 | exit (0); |
1913 | 1917 | break; |
1914 | 1918 | |
… |
… |
main (int argc, char *argv[]) |
2304 | 2308 | } |
2305 | 2309 | g_free (last_wd_string); |
2306 | 2310 | |
| 2311 | g_free (mc_home_alt); |
2307 | 2312 | g_free (mc_home); |
2308 | 2313 | done_key (); |
2309 | 2314 | #ifdef HAVE_CHARSET |
diff --git a/src/main.h b/src/main.h
index 3f3c695..0eaa4af 100644
a
|
b
|
void print_vfs_message(const char *msg, ...) |
110 | 110 | |
111 | 111 | extern const char *prompt; |
112 | 112 | extern const char *edit_one_file; |
113 | | extern char *mc_home; |
| 113 | extern char *mc_home, *mc_home_alt; |
114 | 114 | char *get_mc_lib_dir (void); |
115 | 115 | |
116 | 116 | int maybe_cd (int move_up_dir); |
diff --git a/src/setup.c b/src/setup.c
index 026ac02..cb38e01 100644
a
|
b
|
setup_init (void) |
484 | 484 | if (exist_file (inifile)){ |
485 | 485 | g_free (profile); |
486 | 486 | profile = inifile; |
487 | | } else |
| 487 | } else { |
488 | 488 | g_free (inifile); |
| 489 | inifile = concat_dir_and_file (mc_home_alt, "mc.ini"); |
| 490 | if (exist_file (inifile)) { |
| 491 | g_free (profile); |
| 492 | profile = inifile; |
| 493 | } else |
| 494 | g_free (inifile); |
| 495 | } |
489 | 496 | } |
490 | 497 | |
491 | 498 | profile_name = profile; |
… |
… |
load_setup (void) |
505 | 512 | ~/.mc/ini. FIXME: it's only used for keys and treestore now */ |
506 | 513 | global_profile_name = concat_dir_and_file (mc_home, "mc.lib"); |
507 | 514 | |
| 515 | if (!exist_file(global_profile_name)) { |
| 516 | g_free (global_profile_name); |
| 517 | global_profile_name = concat_dir_and_file (mc_home_alt, "mc.lib"); |
| 518 | } |
| 519 | |
508 | 520 | /* Load integer boolean options */ |
509 | 521 | for (i = 0; int_options[i].opt_name; i++) |
510 | 522 | *int_options[i].opt_addr = |
diff --git a/src/user.c b/src/user.c
index 01022aa..5ac07aa 100644
a
|
b
|
user_menu_cmd (struct WEdit *edit_widget) |
726 | 726 | g_free (menu); |
727 | 727 | menu = concat_dir_and_file \ |
728 | 728 | (mc_home, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); |
| 729 | if (!exist_file (menu)) { |
| 730 | g_free (menu); |
| 731 | menu = concat_dir_and_file \ |
| 732 | (mc_home_alt, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); |
| 733 | } |
729 | 734 | } |
730 | 735 | } |
731 | 736 | |
diff --git a/src/util.c b/src/util.c
index da6d1b2..d32690e 100644
a
|
b
|
|
37 | 37 | |
38 | 38 | #include "global.h" |
39 | 39 | #include "profile.h" |
40 | | #include "main.h" /* mc_home */ |
| 40 | #include "main.h" /* mc_home, mc_home_alt */ |
41 | 41 | #include "cmd.h" /* guess_message_value */ |
42 | 42 | #include "mountlist.h" |
43 | 43 | #include "win.h" /* xterm_flag */ |
… |
… |
load_mc_home_file (const char *filename, char **allocated_filename) |
693 | 693 | |
694 | 694 | if (!data) { |
695 | 695 | g_free (hintfile); |
696 | | /* Fall back to the two-letter language code */ |
697 | | if (lang[0] && lang[1]) |
698 | | lang[2] = 0; |
| 696 | g_free (hintfile_base); |
| 697 | |
| 698 | hintfile_base = concat_dir_and_file (mc_home_alt, filename); |
| 699 | |
699 | 700 | hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL); |
700 | 701 | data = load_file (hintfile); |
701 | 702 | |
702 | 703 | if (!data) { |
703 | | g_free (hintfile); |
704 | | hintfile = hintfile_base; |
705 | | data = load_file (hintfile_base); |
| 704 | /* Fall back to the two-letter language code */ |
| 705 | if (lang[0] && lang[1]) |
| 706 | lang[2] = 0; |
| 707 | hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL); |
| 708 | data = load_file (hintfile); |
| 709 | |
| 710 | if (!data) { |
| 711 | g_free (hintfile); |
| 712 | hintfile = hintfile_base; |
| 713 | data = load_file (hintfile_base); |
| 714 | } |
706 | 715 | } |
707 | 716 | } |
708 | 717 | |
diff --git a/syntax/Makefile.am b/syntax/Makefile.am
index d99dc3a..d35ff22 100644
a
|
b
|
|
1 | 1 | SYNTAXFILES = \ |
2 | | Syntax \ |
3 | 2 | ada95.syntax \ |
4 | 3 | aspx.syntax \ |
5 | 4 | assembler.syntax \ |
… |
… |
SYNTAXFILES = \ |
45 | 44 | unknown.syntax \ |
46 | 45 | xml.syntax |
47 | 46 | |
| 47 | SYNTAXCONFFILES = \ |
| 48 | Syntax |
| 49 | |
48 | 50 | if USE_EDIT |
49 | 51 | syntaxdir = $(pkgdatadir)/syntax |
50 | 52 | syntax_DATA = $(SYNTAXFILES) |
| 53 | |
| 54 | syntaxconfdir = $(sysconfdir)/@PACKAGE@ |
| 55 | syntaxconf_DATA = $(SYNTAXCONFFILES) |
51 | 56 | endif |
52 | 57 | |
53 | | EXTRA_DIST = $(SYNTAXFILES) |
| 58 | EXTRA_DIST = $(SYNTAXFILES) $(SYNTAXCONFFILES) |
diff --git a/vfs/extfs.c b/vfs/extfs.c
index d634e33..9c389dc 100644
a
|
b
|
extfs_open_archive (int fstype, const char *name, struct archive **pparc) |
246 | 246 | tmp = name_quote (name, 0); |
247 | 247 | } |
248 | 248 | |
249 | | mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); |
| 249 | mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR); |
250 | 250 | cmd = |
251 | 251 | g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ", |
252 | 252 | local_name ? local_name : tmp, (char *) NULL); |
… |
… |
extfs_cmd (const char *extfs_cmd, struct archive *archive, |
621 | 621 | archive_name = name_quote (extfs_get_archive_name (archive), 0); |
622 | 622 | quoted_localname = name_quote (localname, 0); |
623 | 623 | |
624 | | mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); |
| 624 | mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR); |
625 | 625 | cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], |
626 | 626 | extfs_cmd, archive_name, " ", quoted_file, " ", |
627 | 627 | quoted_localname, (char *) NULL); |
… |
… |
extfs_run (struct vfs_class *me, const char *file) |
650 | 650 | g_free (p); |
651 | 651 | |
652 | 652 | archive_name = name_quote (extfs_get_archive_name (archive), 0); |
653 | | mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); |
| 653 | mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR); |
654 | 654 | cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], |
655 | 655 | " run ", archive_name, " ", q, (char *) NULL); |
656 | 656 | g_free (mc_extfsdir); |
diff --git a/vfs/extfs/Makefile.am b/vfs/extfs/Makefile.am
index e7efbe4..899e6c7 100644
a
|
b
|
|
1 | 1 | extfsdir = $(pkgdatadir)/extfs |
2 | 2 | |
| 3 | EXTFSCONFFILES = extfs.ini sfs.ini |
| 4 | |
3 | 5 | # Files to install and distribute other than extfs scripts |
4 | | EXTFS_MISC = README extfs.ini sfs.ini |
| 6 | EXTFS_MISC = README |
5 | 7 | |
6 | 8 | # Scripts hat don't need adaptation to the local system |
7 | 9 | EXTFS_CONST = bpp rpm trpm u7z |
… |
… |
EXTFS_OUT = \ |
57 | 59 | if USE_VFS |
58 | 60 | extfs_DATA = $(EXTFS_MISC) |
59 | 61 | extfs_SCRIPTS = $(EXTFS_CONST) $(EXTFS_OUT) |
| 62 | |
| 63 | extfsconfdir = $(sysconfdir)/@PACKAGE@/extfs |
| 64 | extfsconf_DATA = $(EXTFSCONFFILES) |
60 | 65 | endif |
61 | 66 | |
62 | 67 | EXTRA_DIST = $(EXTFS_MISC) $(EXTFS_CONST) |