Ticket #130: mc-etcmc.patch
File mc-etcmc.patch, 12.0 KB (added by slavazanko, 16 years ago) |
---|
-
mc-4.6.1a/src/charsets.c
old new 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 } -
mc-4.6.1a/src/main.h
old new void print_vfs_message(const char *msg, 112 112 113 113 extern const char *prompt; 114 114 extern const char *edit_one_file; 115 extern char *mc_home ;115 extern char *mc_home, *mc_home_alt; 116 116 char *get_mc_lib_dir (void); 117 117 118 118 int maybe_cd (int move_up_dir); -
mc-4.6.1a/src/ext.c
old new regex_command (const char *filename, con 444 444 g_free (extension_file); 445 445 check_stock_mc_ext: 446 446 extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT); 447 if (!exist_file (extension_file)) { 448 g_free (extension_file); 449 extension_file = concat_dir_and_file (mc_home_alt, MC_LIB_EXT); 450 } 447 451 mc_user_ext = 0; 448 452 } 449 453 data = load_file (extension_file); -
mc-4.6.1a/src/setup.c
old new setup_init (void) 481 481 if (exist_file (inifile)){ 482 482 g_free (profile); 483 483 profile = inifile; 484 } else 484 } else { 485 485 g_free (inifile); 486 inifile = concat_dir_and_file (mc_home_alt, "mc.ini"); 487 if (exist_file (inifile)) { 488 g_free (profile); 489 profile = inifile; 490 } else 491 g_free (inifile); 492 } 486 493 } 487 494 488 495 profile_name = profile; … … load_setup (void) 501 508 /* mc.lib is common for all users, but has priority lower than 502 509 ~/.mc/ini. FIXME: it's only used for keys and treestore now */ 503 510 global_profile_name = concat_dir_and_file (mc_home, "mc.lib"); 511 512 if (!exist_file(global_profile_name)) { 513 g_free (global_profile_name); 514 global_profile_name = concat_dir_and_file (mc_home_alt, "mc.lib"); 515 } 504 516 505 517 /* Load integer boolean options */ 506 518 for (i = 0; int_options[i].opt_name; i++) -
mc-4.6.1a/src/Makefile.am
old new 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 -
mc-4.6.1a/src/util.c
old new 40 40 #include "tty.h" 41 41 #include "global.h" 42 42 #include "profile.h" 43 #include "main.h" /* mc_home */43 #include "main.h" /* mc_home, mc_home_alt */ 44 44 #include "cmd.h" /* guess_message_value */ 45 45 #include "mountlist.h" 46 46 #include "win.h" /* xterm_flag */ … … load_mc_home_file (const char *filename, 950 950 951 951 if (!data) { 952 952 g_free (hintfile); 953 /* Fall back to the two-letter language code */ 954 if (lang[0] && lang[1]) 955 lang[2] = 0; 953 g_free (hintfile_base); 954 955 hintfile_base = concat_dir_and_file (mc_home_alt, filename); 956 956 957 hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL); 957 958 data = load_file (hintfile); 958 959 959 960 if (!data) { 960 g_free (hintfile); 961 hintfile = hintfile_base; 962 data = load_file (hintfile_base); 961 /* Fall back to the two-letter language code */ 962 if (lang[0] && lang[1]) 963 lang[2] = 0; 964 hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL); 965 data = load_file (hintfile); 966 967 if (!data) { 968 g_free (hintfile); 969 hintfile = hintfile_base; 970 data = load_file (hintfile_base); 971 } 963 972 } 964 973 } 965 974 -
mc-4.6.1a/src/cmd.c
old new 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) 594 599 ); 595 600 596 601 menufile = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); 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 } 597 607 598 608 switch (dir) { 599 609 case 0: … … 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); -
mc-4.6.1a/src/main.c
old new gboolean is_utf8 = FALSE; 282 282 /* The xterm title */ 283 283 char *xterm_title_str = NULL; 284 284 285 /* mc_home: The home of MC */285 /* mc_home: The home of MC - /etc/mc or defined by MC_DATADIR */ 286 286 char *mc_home = NULL; 287 287 288 /* mc_home_alt: Alternative home of MC - deprecated /usr/share/mc */ 289 char *mc_home_alt = NULL; 290 288 291 char cmd_buf[512]; 289 292 290 293 static void … … OS_Setup (void) 1817 1820 if ((mc_libdir = getenv ("MC_DATADIR")) != NULL) { 1818 1821 mc_home = g_strdup (mc_libdir); 1819 1822 } else { 1820 mc_home = g_strdup ( DATADIR);1823 mc_home = g_strdup (SYSCONFDIR); 1821 1824 } 1825 mc_home_alt = mc_libdir != NULL ? g_strdup (SYSCONFDIR) : g_strdup (DATADIR); 1822 1826 } 1823 1827 1824 1828 static void … … process_args (poptContext ctx, int c, co 1948 1952 break; 1949 1953 1950 1954 case 'f': 1951 printf ("%s \n", mc_home);1955 printf ("%s (%s)\n", mc_home, mc_home_alt); 1952 1956 exit (0); 1953 1957 break; 1954 1958 … … main (int argc, char *argv[]) 2326 2330 } 2327 2331 g_free (last_wd_string); 2328 2332 2333 g_free (mc_home_alt); 2329 2334 g_free (mc_home); 2330 2335 done_key (); 2331 2336 #ifdef HAVE_CHARSET -
mc-4.6.1a/src/Makefile.in
old new target_alias = @target_alias@ 314 314 AM_CFLAGS = $(GLIB_CFLAGS) 315 315 localedir = $(datadir)/locale 316 316 pkglibexecdir = $(libexecdir)/@PACKAGE@ 317 @CONS_SAVER_FALSE@AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" 317 @CONS_SAVER_FALSE@AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" \ 318 @CONS_SAVER_FALSE@ -DSYSCONFDIR=\""$(sysconfdir)/@PACKAGE@/"\" 318 319 @CONS_SAVER_TRUE@AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" \ 319 @CONS_SAVER_TRUE@ -DSAVERDIR=\""$(pkglibexecdir)"\" 320 @CONS_SAVER_TRUE@ -DSAVERDIR=\""$(pkglibexecdir)"\" -DSYSCONFDIR=\""$(sysconfdir)/@PACKAGE@/"\" 320 321 321 322 man2hlp_LDADD = $(GLIB_LIBS) 322 323 mcmfmt_SOURCES = mfmt.c -
mc-4.6.1a/src/user.c
old new 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 -
mc-4.6.1a/edit/editcmd.c
old new 49 49 #include "../src/tty.h" /* LINES */ 50 50 #include "../src/widget.h" /* listbox_new() */ 51 51 #include "../src/layout.h" /* clr_scr() */ 52 #include "../src/main.h" /* mc_home */52 #include "../src/main.h" /* mc_home, mc_home_alt */ 53 53 #include "../src/help.h" /* interactive_display() */ 54 54 #include "../src/key.h" /* XCTRL */ 55 55 #include "../src/dialog.h" /* do_refresh() */ … … edit_block_process_cmd (WEdit *edit, con 2790 2790 return; 2791 2791 } 2792 2792 if (!(script_src = fopen (o, "r"))) { 2793 fclose (script_home); 2794 unlink (h); 2795 edit_error_dialog ("", get_sys_error (catstrs 2796 (_("Error reading script:"), 2797 o, (char *) NULL))); 2798 return; 2793 o = catstrs (mc_home_alt, shell_cmd, (char *) NULL); 2794 if (!(script_src = fopen (o, "r"))) { 2795 fclose (script_home); 2796 unlink (h); 2797 edit_error_dialog ("", get_sys_error (catstrs 2798 (_("Error reading script:"), 2799 o, (char *) NULL))); 2800 return; 2801 } 2799 2802 } 2800 2803 while (fgets (buf, sizeof (buf), script_src)) 2801 2804 fputs (buf, script_home); -
mc-4.6.1a/edit/syntax.c
old new 37 37 #include "edit.h" 38 38 #include "edit-widget.h" 39 39 #include "../src/color.h" /* use_colors */ 40 #include "../src/main.h" /* mc_home */40 #include "../src/main.h" /* mc_home, mc_home_alt */ 41 41 #include "../src/wtools.h" /* message() */ 42 42 43 43 /* bytes */ … … static FILE *open_include_file (const ch 680 680 g_free (error_file_name); 681 681 error_file_name = g_strconcat (mc_home, PATH_SEP_STR "syntax" PATH_SEP_STR, 682 682 filename, (char *) NULL); 683 if (!(f = fopen (error_file_name, "r"))) { 684 g_free (error_file_name); 685 error_file_name = g_strconcat (mc_home_alt, PATH_SEP_STR "syntax" PATH_SEP_STR, 686 filename, (char *) NULL); 687 } else return f; 688 683 689 return fopen (error_file_name, "r"); 684 690 } 685 691 -
mc-4.6.1a/vfs/extfs.c
old new extfs_open_archive (int fstype, const ch 242 242 tmp = name_quote (name, 0); 243 243 } 244 244 245 mc_extfsdir = concat_dir_and_file (mc_home , "extfs" PATH_SEP_STR);245 mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR); 246 246 cmd = 247 247 g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ", 248 248 local_name ? local_name : tmp, (char *) NULL); … … extfs_cmd (const char *extfs_cmd, struct 617 617 archive_name = name_quote (extfs_get_archive_name (archive), 0); 618 618 quoted_localname = name_quote (localname, 0); 619 619 620 mc_extfsdir = concat_dir_and_file (mc_home , "extfs" PATH_SEP_STR);620 mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR); 621 621 cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], 622 622 extfs_cmd, archive_name, " ", quoted_file, " ", 623 623 quoted_localname, (char *) NULL); … … extfs_run (struct vfs_class *me, const c 646 646 g_free (p); 647 647 648 648 archive_name = name_quote (extfs_get_archive_name (archive), 0); 649 mc_extfsdir = concat_dir_and_file (mc_home , "extfs" PATH_SEP_STR);649 mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR); 650 650 cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], 651 651 " run ", archive_name, " ", q, (char *) NULL); 652 652 g_free (mc_extfsdir);