Ticket #150: installdirs.001.diff

File installdirs.001.diff, 75.6 KB (added by anonymous, 15 years ago)

Added by email2trac

  • ChangeLog

    diff --git a/ChangeLog b/ChangeLog
    index 291791f..810ccdf 100644
    a b  
     1 
     22009-01-05  Enrico Weigelt <weigelt@metux.de> 
     3        * core: most config/data pathenames are now hold in global 
     4                vars, initiallized in main.c 
     5        * vfs/extfs.c: config file now taken from $sysconfdir/mc 
     6        * vfs/sfs.c: config file now taken from $sysconfdir/mc 
     7        * core: mc.ext, mc.menu, mc.lib now taken from $sysconfdir/mc 
     8        * cedit: cedit.menu now taken from $sysconfdir/mc 
     9 
    1102008-12-18  Roland Illig  <roland.illig@gmx.de> 
    211 
    312        * doc/mcedit.1: Documented the newly added filename:lineno 
  • doc/es/mc.1.in

    diff --git a/doc/es/mc.1.in b/doc/es/mc.1.in
    index 2a27306..839188a 100644
    a b Abre el archivo 
    13001300.I ~/.mc/bindings 
    13011301en nuestro editor. El administrador puede optar por editar, en su lugar, 
    13021302el archivo de extensiones del sistema 
    1303 .IR @prefix@/share/mc/mc.ext . 
     1303.IR @sysconfdir@/mc/mc.ext . 
    13041304El formato del archivo (formato nuevo cambiado desde la versión 3.0) 
    13051305es como sigue: 
    13061306.PP 
    el archivo .mc.menu del directorio actual, pero s 
    13721372usuario o del superusuario y no es modificable por todos. 
    13731373Si no se encuentra allí el archivo, se intenta de la misma manera con ~/.mc/menu, 
    13741374y si no, mc utiliza el menú por defecto para todo el sistema 
    1375 @prefix@/share/mc/mc.menu. 
     1375@sysconfdir@/mc/mc.menu. 
    13761376.PP 
    13771377El formato del menú de archivo es muy simple.  Todas las líneas, salvo 
    13781378las que empiezan con espacio o tabulación, son consideradas entradas 
    y puede ser impedida por alg 
    18701870.SH "    Guardar Configuración" 
    18711871Al arrancar Midnight Commander se carga la información de inicio del 
    18721872archivo ~/.mc/ini.  Si éste no existe, se cargará la información del 
    1873 archivo de configuración genérico del sistema, @prefix@/share/mc/mc.ini. 
     1873archivo de configuración genérico del sistema, @sysconfdir@/mc/mc.ini. 
    18741874Si el archivo de configuración genérico del sistema no existe, MC utiliza 
    18751875la configuración por defecto. 
    18761876.PP 
    seleccionado en cada momento. 
    31903190Midnight Commander permite hacer ajustes a la base de datos de terminales 
    31913191del sistema sin necesidad de privilegios de superusuario. El programa 
    31923192busca definiciones de teclas en el archivo de inicialización del sistema 
    3193 .B @prefix@/share/mc/mc.lib 
     3193.B @sysconfdir@/mc/mc.lib 
    31943194o en el del usuario 
    31953195.BR ~/.mc/ini , 
    31963196en la sección "terminal:nuestro-terminal" y si no en "terminal:general". 
    entorno MC_DATADIR, que de estar definida se emplear 
    32443244.IP 
    32453245Archivo de ayuda. 
    32463246.PP 
    3247 .I @prefix@/share/mc/mc.ext 
     3247.I @sysconfdir@/mc/mc.ext 
    32483248.IP 
    32493249Archivo de extensiones por defecto del sistema. 
    32503250.PP 
    Archivo de extensiones por defecto del sistema. 
    32533253Archivo de usuario de extensiones y configuración de visor y editor. Si 
    32543254está presente prevalece sobre el contenido de los archivos del sistema. 
    32553255.PP 
    3256 .I @prefix@/share/mc/mc.ini 
     3256.I @sysconfdir@/mc/mc.ini 
    32573257.IP 
    32583258Archivo de configuración del sistema para Midnight Commander, sólo si 
    32593259el usuario no dispone de su propio ~/.mc/ini. 
    32603260.PP 
    3261 .I @prefix@/share/mc/mc.lib 
     3261.I @sysconfdir@/mc/mc.lib 
    32623262.IP 
    32633263Opciones globales de Midnight Commander. Se aplican siempre a todos los 
    32643264usuarios, tengan ~/.mc/ini o no. Actualmente sólo se emplea para los 
    configuraci 
    32773277Este archivo contiene los mensajes cortos de ayuda mostrados por el 
    32783278programa. 
    32793279.PP 
    3280 .I @prefix@/share/mc/mc.menu 
     3280.I @sysconfdir@/mc/mc.menu 
    32813281.IP 
    32823282Este archivo contiene el menú de aplicaciones por defecto para el sistema. 
    32833283.PP 
  • doc/hu/mc.1.in

    diff --git a/doc/hu/mc.1.in b/doc/hu/mc.1.in
    index 963c4f2..63250b6 100644
    a b nem tal 
    13571357.I ~/.mc/menu 
    13581358keresése a következõ lépés, egyébként pedig az mc az alapértelmezett 
    13591359rendszerszintû menüt használja, pl.: 
    1360 .IR @prefix@/share/mc/mc.menu , 
    1361 esetleg /etc/mc/mc.menu. 
     1360.IR @sysconfdir@/mc/mc.menu , 
     1361esetleg @sysconfdir@/mc/mc.menu. 
    13621362.PP 
    13631363A menü fájl formátuma nagyon egyszerû. A sorok, amelyek bármivel 
    13641364kezdõdhetnek, de a space, vagy a tab megkülönböztetett menübejegyzések 
    beolvasni az 
    18651865.I ~/.mc/ini 
    18661866fájlból. Ha ez a fájl nem létezik, ezeket az információkat a 
    18671867rendszerszintû konfigurációs fájlból fogja beolvasni, amelyek a 
    1868 .I @prefix@/share/mc/mc.ini 
     1868.I @sysconfdir@/mc/mc.ini 
    18691869fájlban találhatóak meg. Ha ez a rendszerszintû konfigurációs fájl sem 
    18701870létezik, a MC az alapértelmezett beállításokat használja. 
    18711871.PP 
    fog  
    30933093.IP 
    30943094A program súgó fájlja. 
    30953095.PP 
    3096 .I @prefix@/share/mc/mc.ext 
     3096.I @sysconfdir@/mc/mc.ext 
    30973097.IP 
    30983098Az alapértelmezett rendszerszintû kiterjesztés fájl. 
    30993099.PP 
    A felhaszn 
    31033103beállítások. Ezek felülbírálják a rendszerszintû fájl bejegyzéseit, ha 
    31043104van ilyen. 
    31053105.PP 
    3106 .I @prefix@/share/mc/mc.ini 
     3106.I @sysconfdir@/mc/mc.ini 
    31073107.IP 
    31083108Az alapértelmezett rendszerszintû Midnight Commander beállítás, amelyet 
    31093109csak akkor használ, ha a felhasználónak nincs saját ~/.mc/ini fájlja. 
    31103110.PP 
    3111 .I @prefix@/share/mc/mc.lib 
     3111.I @sysconfdir@/mc/mc.lib 
    31123112.IP 
    31133113A Midnight Commander globális beállításai. Az ebben a fájlban elvégzett 
    31143114beállítások minden felhasználó Midnight Commander-jére vonatkoznak, ez 
    helyett. 
    31253125Ez a fájl tartalmazza a program által megjelenített útmutattásokat 
    31263126(cookie-kat). 
    31273127.PP 
    3128 .I @prefix@/share/mc/mc.menu 
     3128.I @sysconfdir@/mc/mc.menu 
    31293129.IP 
    31303130Ez a fájl azonos a rendszerszintû alkalmazás menüvel. 
    31313131.PP 
  • doc/it/mc.1.in

    diff --git a/doc/it/mc.1.in b/doc/it/mc.1.in
    index af61b19..e89c510 100644
    a b utilizzato, se esiste, il file .mc.menu dalla directory corrente, 
    13651365ma solo se è di proprietà dell'utente o di root e se non è scrivibile 
    13661366a tutti. Se tale file non viene trovato, mc alla stessa maniera  
    13671367prova con ~/.mc/menu altrimenti usa il menu di sistema 
    1368 @prefix@/share/mc/mc.menu. 
     1368@sysconfdir@/mc/mc.menu. 
    13691369.PP 
    13701370Il formato del file menu è molto semplice. Le righe che cominciano 
    13711371con qualsiasi cosa che non sia uno spazio o una tabulazione sono 
    funzionare con alcuni firewall. 
    18991899Alla partenza il Midnight Commander prova a caricare le informazioni di 
    19001900inizializzazione dal file ~/.mc/ini. Se questo file non esiste,  
    19011901caricherà le informazioni dal file di configurazione di sistema  
    1902 posizionato in @prefix@/share/mc/mc.ini. Se il file di configurazione di  
     1902posizionato in @sysconfdir@/mc/mc.ini. Se il file di configurazione di  
    19031903sistema non esiste, MC userà le impostazioni predefinite. 
    19041904.PP 
    19051905Il comando 
    passer 
    31173117.IP 
    31183118Il file di aiuto per il programma. 
    31193119.PP 
    3120 .I @prefix@/share/mc/mc.ext 
     3120.I @sysconfdir@/mc/mc.ext 
    31213121.IP 
    31223122Il file delle estensioni di sistema predefinito. 
    31233123.PP 
    Le estensioni dell'utente, la configurazione del visualizzatore e 
    31273127dell'editor di file. Se presenti, questi file si sovrappongono ai file di  
    31283128sistema. 
    31293129.PP 
    3130 .I @prefix@/share/mc/mc.ini 
     3130.I @sysconfdir@/mc/mc.ini 
    31313131.IP 
    31323132La configurazione di sistema predefinita per il Midnight Commander, usata solo 
    31333133se l'utente non possiede il proprio file ~/.mc/ini. 
    31343134.PP 
    3135 .I @prefix@/share/mc/mc.lib 
     3135.I @sysconfdir@/mc/mc.lib 
    31363136.IP 
    31373137Le impostazioni globali per il Midnight Commander. La modifica di questo 
    31383138file influisce su tutti gli utenti, che abbiano o no il file ~/.mc/ini . 
    viene caricata da qui invece che dal file di sistema. 
    31513151.IP 
    31523152Questo file contiene i suggerimenti (dritte) mostrate dal programma. 
    31533153.PP 
    3154 .I @prefix@/share/mc/mc.menu 
     3154.I @sysconfdir@/mc/mc.menu 
    31553155.IP 
    31563156Questo file contiene il menu di sistema per le applicazioni. 
    31573157.PP 
  • doc/mc.1.in

    diff --git a/doc/mc.1.in b/doc/mc.1.in
    index e29d169..a8c1d73 100644
    a b file .mc.menu from the current directory is used if it exists, 
    13961396but only if it is owned by user or root and is not world-writable. 
    13971397If no such file found, ~/.mc/menu is tried in the same way, 
    13981398and otherwise mc uses the default system-wide menu 
    1399 @prefix@/share/mc/mc.menu. 
     1399@sysconfdir@/mc/mc.menu. 
    14001400.PP 
    14011401The format of the menu file is very simple. Lines that start with 
    14021402anything but space or tab are considered entries for the menu (in 
    firewalls. 
    19231923At startup the Midnight Commander will try to load initialization 
    19241924information from the ~/.mc/ini file. If this file doesn't exist, it will 
    19251925load the information from the system-wide configuration file, located in 
    1926 @prefix@/share/mc/mc.ini. If the system-wide configuration file doesn't 
     1926@sysconfdir@/mc/mc.ini. If the system-wide configuration file doesn't 
    19271927exist, MC uses the default settings. 
    19281928.PP 
    19291929The 
    instead of @prefix@/share/mc in the paths below. 
    32513251.IP 
    32523252The help file for the program. 
    32533253.PP 
    3254 .I @prefix@/share/mc/mc.ext 
     3254.I @sysconfdir@/mc/mc.ext 
    32553255.IP 
    32563256The default system-wide extensions file. 
    32573257.PP 
    The default system-wide extensions file. 
    32603260User's own extension, view configuration and edit configuration 
    32613261file.  They override the contents of the system wide files if present. 
    32623262.PP 
    3263 .I @prefix@/share/mc/mc.ini 
     3263.I @sysconfdir@/mc/mc.ini 
    32643264.IP 
    32653265The default system-wide setup for the Midnight Commander, used only if 
    32663266the user doesn't have his own ~/.mc/ini file. 
    32673267.PP 
    3268 .I @prefix@/share/mc/mc.lib 
     3268.I @sysconfdir@/mc/mc.lib 
    32693269.IP 
    32703270Global settings for the Midnight Commander.  Settings in this file 
    32713271affect all users, whether they have ~/.mc/ini or not.  Currently, only 
    from here instead of the system-wide startup file. 
    32833283.IP 
    32843284This file contains the hints displayed by the program. 
    32853285.PP 
    3286 .I @prefix@/share/mc/mc.menu 
     3286.I @sysconfdir@/mc/mc.menu 
    32873287.IP 
    32883288This file contains the default system-wide applications menu. 
    32893289.PP 
  • doc/mcedit.1.in

    diff --git a/doc/mcedit.1.in b/doc/mcedit.1.in
    index 691d86e..9490c4f 100644
    a b clean. 
    467467.IP 
    468468The help file for the program. 
    469469.PP 
    470 .I @prefix@/share/mc/mc.ini 
     470.I @sysconfdir@/mc/mc.ini 
    471471.IP 
    472472The default system-wide setup for GNU Midnight Commander, used only if 
    473473the user's own ~/.mc/ini file is missing. 
    474474.PP 
    475 .I @prefix@/share/mc/mc.lib 
     475.I @sysconfdir@/mc/mc.lib 
    476476.IP 
    477477Global settings for the Midnight Commander.  Settings in this file 
    478478affect all users, whether they have ~/.mc/ini or not. 
  • doc/mcview.1.in

    diff --git a/doc/mcview.1.in b/doc/mcview.1.in
    index 327dbf1..f9257b1 100644
    a b selected=black,green" 
    6565.IP 
    6666The help file for the program. 
    6767.PP 
    68 .I @prefix@/share/mc/mc.ini 
     68.I @sysconfdir@/mc/mc.ini 
    6969.IP 
    7070The default system-wide setup for GNU Midnight Commander, used only if 
    7171the user's own ~/.mc/ini file is missing. 
    7272.PP 
    73 .I @prefix@/share/mc/mc.lib 
     73.I @sysconfdir@/mc/mc.lib 
    7474.IP 
    7575Global settings for the Midnight Commander.  Settings in this file 
    7676affect all users, whether they have ~/.mc/ini or not. 
  • doc/pl/mc.1.in

    diff --git a/doc/pl/mc.1.in b/doc/pl/mc.1.in
    index 910e661..4658763 100644
    a b przy u 
    11521152tylko wtedy kiedy jest on w posiadaniu u¿ytkownika lub roota i mamy do niego 
    11531153prawa zapisu. Je¶li takiego nie ma próbuje siê z plikiem ~/.mc/menu z tymi 
    11541154samymi za³o¿eniami, je¶li jego te¿ nie ma - u¿ywa siê standardowego pliku 
    1155 systemowego, który znajduje siê w @prefix@/share/mc/mc.menu. 
     1155systemowego, który znajduje siê w @sysconfdir@/mc/mc.menu. 
    11561156.PP 
    11571157Format pliku z menu u¿ytkownika jest bardzo prosty. Linie zaczynaj±ce siê 
    11581158od czegokolwiek innego ni¿ spacja lub tabulacja, s± traktowane jako 
    System plik 
    15901590.SH "    Zapisz ustawienia (Save Setup)" 
    15911591Na starcie Midnight Commander bêdzie próbowa³ odczytaæ opcje startowe 
    15921592z pliku ~/.mc/ini. Je¶li on nie istnieje, odczyta on konfiguracje z 
    1593 ogólnodostêpnego pliku @prefix@/share/mc/mc.ini. Je¶li on te¿ nie istnieje MC 
     1593ogólnodostêpnego pliku @sysconfdir@/mc/mc.ini. Je¶li on te¿ nie istnieje MC 
    15941594u¿yje swoich domy¶lnych ustawieñ. 
    15951595.PP 
    15961596Komenda 
    je 
    27932793.IP 
    27942794Plik pomocy dla programu. 
    27952795.PP 
    2796 @prefix@/share/mc/mc.ext 
     2796@sysconfdir@/mc/mc.ext 
    27972797.IP 
    27982798Standardowy plik rozszerzeñ plików. 
    27992799.PP 
    Standardowy plik rozszerze 
    28022802W³asny plik u¿ytkownika, konfiguruje podgl±d i edycje plików. Ma wy¿szy 
    28032803priorytet ni¿ plik systemowy. 
    28042804.PP 
    2805 @prefix@/share/mc/mc.ini 
     2805@sysconfdir@/mc/mc.ini 
    28062806.IP 
    28072807Standardowy plik setupu do Midnight Commandera, u¿ywany tylko wówczas, 
    28082808kiedy u¿ytkownik nie ma swojego w³asnego pliku ~/.mc/ini. 
    28092809.PP 
    2810 @prefix@/share/mc/mc.lib 
     2810@sysconfdir@/mc/mc.lib 
    28112811.IP 
    28122812Globalne ustawienia Midnight Commandera. Ustawienia w tym pliku s± 
    28132813uwzglêdniane przez wszystkie sesje Midnight Commandera, u¿yteczne do 
    zamiast pliku globalnego. 
    28222822.IP 
    28232823Plik zawieraj±cy podpowiedzi (hints) wy¶wietlane przez program. 
    28242824.PP 
    2825 @prefix@/share/mc/mc.menu 
     2825@sysconfdir@/mc/mc.menu 
    28262826.IP 
    28272827Ten plik zawiera informacje o ogólnosystemowych aplikacjach w menu. 
    28282828.PP 
  • doc/ru/mc.1.in

    diff --git a/doc/ru/mc.1.in b/doc/ru/mc.1.in
    index a74d61f..3909491 100644
    a b View  
    15321532ÏÂÒÁÚÏÍ ÉÝÅÔÓÑ ÆÁÊÌ 
    15331533.B ~/.mc/menu 
    15341534É, × ÐÏÓÌÅÄÎÀÀ ÏÞÅÒÅÄØ, mc ÉÓÐÏÌØÚÕÅÔ ÏÂÝÅÓÉÓÔÅÍÎÏÅ ÍÅÎÀ 
    1535 .BR @prefix@/share/mc/mc.menu . 
     1535.BR @sysconfdir@/mc/mc.menu . 
    15361536.PP 
    15371537æÏÒÍÁÔ ×ÓÅÈ ÔÒÅÈ ÆÁÊÌÏ× ÍÅÎÀ ÏÄÉÎÁËÏ× É ÏÞÅÎØ ÐÒÏÓÔ. óÔÒÏËÉ ËÏÍÍÅÎÔÁÒÉÅ× 
    15381538ÎÁÞÉÎÁÀÔÓÑ Ó '#'. äÏÐÏÌÎÉÔÅÌØÎÙÅ ËÏÍÍÅÎÔÁÒÉÉ ÄÏÌÖÎÙ ÎÁÞÉÎÁÔØÓÑ Ó '#', 
    insert=\\e[Op 
    36373637.IP 
    36383638æÁÊÌ ÐÏÄÓËÁÚËÉ ÄÌÑ ÐÒÏÇÒÁÍÍÙ. 
    36393639.PP 
    3640 .I @prefix@/share/mc/mc.ext 
     3640.I @sysconfdir@/mc/mc.ext 
    36413641.IP 
    36423642éÓÐÏÌØÚÕÅÍÙÊ ÐÏ ÕÍÏÌÞÁÎÉÀ ÏÂÝÅÓÉÓÔÅÍÎÙÊ ÆÁÊÌ ÒÁÓÛÉÒÅÎÉÊ. 
    36433643.PP 
    insert=\\e[Op 
    36463646æÁÊÌ ÒÁÓÛÉÒÅÎÉÊ ÐÏÌØÚÏ×ÁÔÅÌÑ. åÓÌÉ ÜÔÏÔ ÆÁÊÌ ÓÕÝÅÓÔ×ÕÅÔ, ÏÎ ÉÓÐÏÌØÚÕÅÔÓÑ 
    36473647×ÍÅÓÔÏ ÏÂÝÅÓÉÓÔÅÍÎÏÇÏ ÆÁÊÌÁ ÒÁÓÛÉÒÅÎÉÊ. 
    36483648.PP 
    3649 .I @prefix@/share/mc/mc.ini 
     3649.I @sysconfdir@/mc/mc.ini 
    36503650.IP 
    36513651éÓÐÏÌØÚÕÅÍÙÊ ÐÏ ÕÍÏÌÞÁÎÉÀ ÏÂÝÅÓÉÓÔÅÍÎÙÊ ÆÁÊÌ ÕÓÔÁÎÏ×ÏË ÄÌÑ Midnight 
    36523652Commander; ÉÓÐÏÌØÚÕÅÔÓÑ ÔÏÌØËÏ × ÔÅÈ ÓÌÕÞÁÑÈ, ËÏÇÄÁ ÐÏÌØÚÏ×ÁÔÅÌØ ÎÅ 
    36533653ÉÍÅÅÔ Ó×ÏÅÇÏ ÆÁÊÌÁ 
    36543654.B ~/.mc/ini 
    36553655.PP 
    3656 .I @prefix@/share/mc/mc.lib 
     3656.I @sysconfdir@/mc/mc.lib 
    36573657.IP 
    36583658çÌÏÂÁÌØÎÙÅ ÕÓÔÁÎÏ×ËÉ ÄÌÑ Midnight Commander.  õÓÔÁÎÏ×ËÉ ÉÚ ÜÔÏÇÏ ÆÁÊÌÁ 
    36593659ÄÅÊÓÔ×ÉÔÅÌØÎÙ ÄÌÑ ×ÓÅÈ ÐÏÌØÚÏ×ÁÔÅÌÅÊ, ÎÅÚÁ×ÉÓÉÍÏ ÏÔ ÔÏÇÏ, ÉÍÅÀÔ ÌÉ ÏÎÉ 
    Commander;  
    36743674üÔÏÔ ÆÁÊÌ ÓÏÄÅÒÖÉÔ ÐÏÄÓËÁÚËÉ (hints ÉÌÉ cookies), ÃÉËÌÉÞÅÓËÉ 
    36753675ÏÔÏÂÒÁÖÁÅÍÙÅ ÐÒÏÇÒÁÍÍÏÊ. 
    36763676.PP 
    3677 .I @prefix@/share/mc/mc.menu 
     3677.I @sysconfdir@/mc/mc.menu 
    36783678.IP 
    36793679üÔÏÔ ÆÁÊÌ ÓÏÄÅÒÖÉÔ ÏÂÝÅÓÉÓÔÅÍÎÏÅ ÍÅÎÀ ÐÒÉÌÏÖÅÎÉÊ. 
    36803680.PP 
  • doc/sr/mc.1.in

    diff --git a/doc/sr/mc.1.in b/doc/sr/mc.1.in
    index 84c1aa2..0f5617a 100644
    a b awk '$9 ~! /incoming/ { print $9 }' < /usr/adm/xferlog 
    13581358ÔÞ×ÒÞùÕÝ ãßØá ã úã ÞÔ áâàÐÝÕ ÔàãÓØå (áÒÕâÐ). °ÚÞ âÐÚÒÐ ÔÐâÞâÕÚÐ ÝØøÕ 
    13591359ÝÐòÕÝÐ, ÝÐ ØáâØ ÝÐçØÝ áÕ ßÞÚãèÐÒÐ áÐ ÔÐâÞâÕÚÞÜ ~/.mc/menu, Ð ØÝÐçÕ ¿½ 
    13601360ÚÞàØáâØ ßÞÔàÐ×ãÜÕÒÐÝã ÔÐâÞâÕÚã ÜÕÝØøÐ ×Ð æÕÞ áØáâÕÜ 
    1361 @prefix@/share/mc/mc.menu. 
     1361@sysconfdir@/mc/mc.menu. 
    13621362.PP 
    13631363ÄÞàÜÐâ ÔÐâÞâÕÚÕ ÜÕÝØøÐ øÕ ÒÕÞÜÐ øÕÔÝÞáâÐÒÐÝ. ÀÕÔÞÒØ ÚÞøØ ßÞçØúã ÑØÛÞ 
    13641364çØÜ ÞáØÜ àÐ×ÜÐÚÐ ØÛØ âÐÑãÛÐâÞàÐ áÕ ã×ØÜÐøã ×Ð áâÐÒÚÕ ÜÕÝØøÐ (ÔÐ ÑØ áÕ 
    MC_DATADIR.  
    32473247.IP 
    32483248´ÐâÞâÕÚÐ ßÞÜÞûØ ×Ð ßàÞÓàÐÜ. 
    32493249.PP 
    3250 .I @prefix@/share/mc/mc.ext 
     3250.I @sysconfdir@/mc/mc.ext 
    32513251.IP 
    32523252¿ÞÔàÐ×ãÜÕÒÐÝÐ áØáâÕÜáÚÐ ÔÐâÞâÕÚÐ ÒàáâÐ. 
    32533253.PP 
    MC_DATADIR.  
    32563256ºÞàØáÝØçÚÕ ÔÐâÞâÕÚÕ ÒàáâÐ, ßÞÔÕèÐÒÐúÐ ßàÕÓÛÕÔÐçÐ Ø ãàÕòØÒÐçÐ. ÃÚÞÛØÚÞ 
    32573257ßÞáâÞøÕ, ÞÝÕ ×ÐÞÑØÛÐ×Õ áØáâÕÜáÚÕ ÔÐâÞâÕÚÕ. 
    32583258.PP 
    3259 .I @prefix@/share/mc/mc.ini 
     3259.I @sysconfdir@/mc/mc.ini 
    32603260.IP 
    32613261¿ÞÔàÐ×ãÜÕÒÐÝÐ áØáâÕÜáÚÐ ßÞÔÕèÐÒÐúÐ ¿ÞÝÞûÝÞÓ ÝÐàÕÔÝØÚÐ; ÚÞàØáâÕ áÕ áÐÜÞ 
    32623262ã áÛãçÐøã ÔÐ ÚÞàØáÝØÚ ÝÕÜÐ áÞßáâÒÕÝã ÔÐâÞâÕÚã ~/.mc/ini. 
    32633263.PP 
    3264 .I @prefix@/share/mc/mc.lib 
     3264.I @sysconfdir@/mc/mc.lib 
    32653265.IP 
    32663266³ÛÞÑÐÛÝÕ ßÞáâÐÒÚÕ ¿ÞÝÞûÝÞÓ ÝÐàÕÔÝØÚÐ. ¿ÞáâÐÒÚÕ Ø× ÞÒÕ ÔÐâÞâÕÚÕ áÕ 
    32673267ÞÔÝÞáÕ ÝÐ áÒÕ ÚÞàØáÝØÚÕ ÑÕ× ÞÑ×ØàÐ ÝÐ âÞ ÔÐ ÛØ ÞÝØ ØÜÐøã áÒÞøÕ 
    MC_DATADIR.  
    32803280.IP 
    32813281¾ÒÐ ÔÐâÞâÕÚÐ áÐÔàÖØ áÐÒÕâÕ (ÚÞÛÐçØûÕ) ÚÞøØ áÕ ßàØÚÐ×ãøã ã ßàÞÓàÐÜã. 
    32823282.PP 
    3283 .I @prefix@/share/mc/mc.menu 
     3283.I @sysconfdir@/mc/mc.menu 
    32843284.IP 
    32853285¾ÒÐ ÔÐâÞâÕÚÐ áÐÔàÖØ ßÞÔàÐ×ãÜÕÒÐÝØ ÜÕÝØ ßàÞÓàÐÜÐ ×Ð æÕÞ áØáâÕÜ. 
    32863286.PP 
  • edit/edit.h

    diff --git a/edit/edit.h b/edit/edit.h
    index d7725b6..5b4fdd4 100644
    a b extern int column_highlighting; 
    300300 
    301301/* File names */ 
    302302#define EDIT_DIR           ".mc" PATH_SEP_STR "cedit" 
    303 #define SYNTAX_FILE        EDIT_DIR PATH_SEP_STR "Syntax" 
    304303#define CLIP_FILE          EDIT_DIR PATH_SEP_STR "cooledit.clip" 
    305304#define MACRO_FILE         EDIT_DIR PATH_SEP_STR "cooledit.macros" 
    306305#define BLOCK_FILE         EDIT_DIR PATH_SEP_STR "cooledit.block" 
  • edit/editcmd.c

    diff --git a/edit/editcmd.c b/edit/editcmd.c
    index 01262f1..4838230 100644
    a b  
    5050#include "../src/tty.h"         /* LINES */ 
    5151#include "../src/widget.h"      /* listbox_new() */ 
    5252#include "../src/layout.h"      /* clr_scr() */ 
    53 #include "../src/main.h"        /* mc_home */ 
    5453#include "../src/help.h"        /* interactive_display() */ 
    5554#include "../src/key.h"         /* XCTRL */ 
    5655#include "../src/dialog.h"      /* do_refresh() */ 
    5756#include "../src/wtools.h"      /* message() */ 
    5857#include "../src/charsets.h" 
    5958#include "../src/selcodepage.h" 
     59#include "../src/mc_conf.h"     /* MC global configuration */ 
    6060 
    6161#define edit_get_load_file(f,h) input_expand_dialog (h, _(" Enter file name: "), f) 
    6262#define edit_get_save_file(f,h) input_expand_dialog (h, _(" Enter file name: "), f) 
    edit_block_process_cmd (WEdit *edit, const char *shell_cmd, int block) 
    25172517    const char *b = NULL; 
    25182518    char *quoted_name = NULL; 
    25192519 
    2520     o = catstrs (mc_home, shell_cmd, (char *) NULL);    /* original source script */ 
     2520    o = catstrs (mc_global_datadir, shell_cmd, (char *) NULL);  /* original source script */ 
    25212521    h = catstrs (home_dir, PATH_SEP_STR EDIT_DIR, shell_cmd, (char *) NULL);    /* home script */ 
    25222522    b = catstrs (home_dir, PATH_SEP_STR BLOCK_FILE, (char *) NULL);     /* block file */ 
    25232523 
  • edit/syntax.c

    diff --git a/edit/syntax.c b/edit/syntax.c
    index 23e8b6c..e5504e3 100644
    a b  
    3838#include "edit.h" 
    3939#include "edit-widget.h" 
    4040#include "../src/color.h"       /* use_colors */ 
    41 #include "../src/main.h"        /* mc_home */ 
    4241#include "../src/wtools.h"      /* message() */ 
     42#include "../src/mc_conf.h"     /* MC global configuration */ 
    4343 
    4444/* bytes */ 
    4545#define SYNTAX_MARKER_DENSITY 512 
    char *option_syntax_type = NULL; 
    104104 
    105105#define syntax_g_free(x) do {g_free(x); (x)=0;} while (0) 
    106106 
     107#define _syntaxfile(fn)         (_strcatdup(mc_global_syntaxdir, fn)) 
     108 
    107109static gint 
    108110mc_defines_destroy (gpointer key, gpointer value, gpointer data) 
    109111{ 
    this_try_alloc_color_pair (const char *fg, const char *bg) 
    662664 
    663665static char *error_file_name = 0; 
    664666 
     667/* the the filename of last error occourence */ 
     668static inline void _set_err_fn(const char* filename) 
     669{ 
     670    if (error_file_name) 
     671        free(error_file_name); 
     672    error_file_name = g_strdup(filename); 
     673} 
     674 
    665675static FILE *open_include_file (const char *filename) 
    666676{ 
    667677    FILE *f; 
    static FILE *open_include_file (const char *filename) 
    679689        return f; 
    680690 
    681691    g_free (error_file_name); 
    682     error_file_name = g_strconcat (mc_home, PATH_SEP_STR "syntax" PATH_SEP_STR, 
    683                                    filename, (char *) NULL); 
     692    error_file_name = _syntaxfile(filename); 
     693 
    684694    return fopen (error_file_name, "r"); 
    685695} 
    686696 
    edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file, 
    10261036 
    10271037    f = fopen (syntax_file, "r"); 
    10281038    if (!f){ 
    1029         lib_file = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax"); 
     1039        lib_file = _syntaxfile("Syntax"); 
    10301040        f = fopen (lib_file, "r"); 
    10311041        g_free (lib_file); 
    10321042        if (!f) 
    void 
    11691179edit_load_syntax (WEdit *edit, char ***pnames, const char *type) 
    11701180{ 
    11711181    int r; 
    1172     char *f = NULL; 
    11731182 
    11741183    if (option_auto_syntax) 
    11751184        type = NULL; 
    edit_load_syntax (WEdit *edit, char ***pnames, const char *type) 
    11881197        if (!*edit->filename && !type) 
    11891198            return; 
    11901199    } 
    1191     f = concat_dir_and_file (home_dir, SYNTAX_FILE); 
    1192     r = edit_read_syntax_file (edit, pnames, f, edit ? edit->filename : 0, 
     1200    r = edit_read_syntax_file (edit, pnames, mc_user_syntaxfile, edit ? edit->filename : 0, 
    11931201                               get_first_editor_line (edit), type); 
    11941202    if (r == -1) { 
    11951203        edit_free_syntax_rules (edit); 
    11961204        message (D_ERROR, _(" Load syntax file "), 
    1197                  _(" Cannot open file %s \n %s "), f, 
     1205                 _(" Cannot open file %s \n %s "), mc_user_syntaxfile, 
    11981206                 unix_error_string (errno)); 
    11991207    } else if (r) { 
    12001208        edit_free_syntax_rules (edit); 
    12011209        message (D_ERROR, _(" Load syntax file "), 
    12021210                 _(" Error in file %s on line %d "), 
    1203                  error_file_name ? error_file_name : f, r); 
     1211                 error_file_name ? error_file_name : mc_user_syntaxfile, r); 
    12041212        syntax_g_free (error_file_name); 
    12051213    } else { 
    12061214        /* succeeded */ 
    12071215    } 
    1208     g_free (f); 
    12091216} 
  • lib/Makefile.am

    diff --git a/lib/Makefile.am b/lib/Makefile.am
    index 5f61432..1c5457b 100644
    a b  
    11suppbindir = $(pkgdatadir)/bin 
     2mcconfdir = $(sysconfdir)/mc 
    23 
    34if CHARSET 
    45LIBFILES_ADD = mc.charsets 
    else 
    67LIBFILES_ADD = 
    78endif 
    89 
    9 LIBFILES_OUT = mc.ext 
    1010LIBFILES_CONST = mc.hint mc.hint.cs mc.hint.es mc.hint.hu mc.hint.it    \ 
    1111        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 edit.indent.rc edit.spell.rc 
    1413 
    1514noinst_DATA = README.xterm mcserv.init mcserv.pamd xterm.ad 
    1615 
    SCRIPTS_OUT = mc.csh mc.sh mc-wrapper.csh mc-wrapper.sh 
    1918 
    2019suppbin_SCRIPTS = $(SCRIPTS_OUT) 
    2120 
    22 pkgdata_DATA = $(LIBFILES_CONST) $(LIBFILES_ADD) $(LIBFILES_OUT) 
     21pkgdata_DATA = $(LIBFILES_CONST) $(LIBFILES_ADD) 
     22mcconf_DATA = mc.ext cedit.menu mc.menu mc.menu.sr mc.lib 
    2323 
    2424CLEANFILES = $(SCRIPTS_OUT) 
    2525 
  • mc.qpg.in

    diff --git a/mc.qpg.in b/mc.qpg.in
    index 24f8983..d75f9ad 100644
    a b  
    3232         <QPG:Add file="./lib/mc-wrapper.sh" permissions="0755" install="/opt/share/mc/bin/"/> 
    3333         <QPG:Add file="./lib/mc.csh" permissions="0755" install="/opt/share/mc/bin/"/> 
    3434         <QPG:Add file="./lib/mc.sh" permissions="0755" install="/opt/share/mc/bin/"/> 
    35          <QPG:Add file="./lib/cedit.menu" permissions="0644" install="/opt/share/mc/"/> 
     35         <QPG:Add file="./lib/cedit.menu" permissions="0644" install="/etc/mc/"/> 
    3636         <QPG:Add file="./lib/edit.indent.rc" permissions="0644" install="/opt/share/mc/"/> 
    3737         <QPG:Add file="./lib/edit.spell.rc" permissions="0644" install="/opt/share/mc/"/> 
    3838         <QPG:Add file="./vfs/extfs/README" permissions="0644" install="/opt/share/mc/extfs/"/> 
     
    4444         <QPG:Add file="./vfs/extfs/deba" permissions="0755" install="/opt/share/mc/extfs/"/> 
    4545         <QPG:Add file="./vfs/extfs/debd" permissions="0755" install="/opt/share/mc/extfs/"/> 
    4646         <QPG:Add file="./vfs/extfs/dpkg" permissions="0755" install="/opt/share/mc/extfs/"/> 
    47          <QPG:Add file="./vfs/extfs/extfs.ini" permissions="0644" install="/opt/share/mc/extfs/"/> 
     47         <QPG:Add file="./vfs/extfs/extfs.ini" permissions="0644" install="/etc/mc/"/> 
    4848         <QPG:Add file="./vfs/extfs/hp48" permissions="0755" install="/opt/share/mc/extfs/"/> 
    4949         <QPG:Add file="./vfs/extfs/iso9660" permissions="0755" install="/opt/share/mc/extfs/"/> 
    5050         <QPG:Add file="./vfs/extfs/lslR" permissions="0755" install="/opt/share/mc/extfs/"/> 
     
    5252         <QPG:Add file="./vfs/extfs/patchfs" permissions="0755" install="/opt/share/mc/extfs/"/> 
    5353         <QPG:Add file="./vfs/extfs/rpm" permissions="0755" install="/opt/share/mc/extfs/"/> 
    5454         <QPG:Add file="./vfs/extfs/rpms" permissions="0755" install="/opt/share/mc/extfs/"/> 
    55          <QPG:Add file="./vfs/extfs/sfs.ini" permissions="0755" install="/opt/share/mc/extfs/"/> 
     55         <QPG:Add file="./vfs/extfs/sfs.ini" permissions="0755" install="/etc/mc/"/> 
    5656         <QPG:Add file="./vfs/extfs/trpm" permissions="0755" install="/opt/share/mc/extfs/"/> 
    5757         <QPG:Add file="./vfs/extfs/uar" permissions="0755" install="/opt/share/mc/extfs/"/> 
    5858         <QPG:Add file="./vfs/extfs/uarj" permissions="0755" install="/opt/share/mc/extfs/"/> 
     
    8181         <QPG:Add file="./doc/pl/mc.hlp.pl" permissions="0644" install="/opt/share/mc/"/> 
    8282         <QPG:Add file="./doc/ru/mc.hlp.ru" permissions="0644" install="/opt/share/mc/"/> 
    8383         <QPG:Add file="./doc/sr/mc.hlp.sr" permissions="0644" install="/opt/share/mc/"/> 
    84          <QPG:Add file="./lib/mc.lib" permissions="0644" install="/opt/share/mc/"/> 
    85          <QPG:Add file="./lib/mc.menu" permissions="0644" install="/opt/share/mc/"/> 
    86          <QPG:Add file="./lib/mc.menu.sr" permissions="0644" install="/opt/share/mc/"/> 
     84         <QPG:Add file="./lib/mc.lib" permissions="0644" install="/etc/mc/"/> 
     85         <QPG:Add file="./lib/mc.menu" permissions="0644" install="/etc/mc/"/> 
     86         <QPG:Add file="./lib/mc.menu.sr" permissions="0644" install="/etc/mc/"/> 
    8787         <QPG:Add file="./syntax/Syntax" permissions="0644" install="/opt/share/mc/syntax/"/> 
    8888         <QPG:Add file="./syntax/ada95.syntax" permissions="0644" install="/opt/share/mc/syntax/"/> 
    8989         <QPG:Add file="./syntax/aspx.syntax" permissions="0644" install="/opt/share/mc/syntax/"/> 
  • mc.spec.in

    diff --git a/mc.spec.in b/mc.spec.in
    index 2ce44bc..ba730df 100644
    a b rm -rf $RPM_BUILD_ROOT 
    7979%{_mandir}/*/man1/* 
    8080 
    8181%config %{_sysconfdir}/profile.d/* 
    82 %{_datadir}/mc/cedit.menu 
     82%{_sysconfdir}/mc/cedit.menu 
    8383%{_datadir}/mc/edit.indent.rc 
    8484%{_datadir}/mc/edit.spell.rc 
    8585%{_datadir}/mc/bin/* 
    8686%{_datadir}/mc/extfs/* 
    87 %{_datadir}/mc/mc.ext 
    88 %{_datadir}/mc/mc.lib 
    89 %{_datadir}/mc/mc.menu* 
     87%{_sysconfdir}/mc/mc.ext 
     88%{_sysconfdir}/mc/mc.lib 
     89%{_sysconfdirdir}/mc/mc.menu* 
    9090%{?_with_charset:%config %{_datadir}/mc/mc.charsets} 
    9191 
    9292%{_datadir}/mc/mc.hint* 
  • prototype.in

    diff --git a/prototype.in b/prototype.in
    index fd28cae..7bb6398 100644
    a b d none $datadir/mc/syntax 
    2020d none $docdir/mc 
    2121# 
    2222!default 644 root bin 
    23 f none $datadir/mc/cedit.menu 
     23f none $sysconfdir/mc/cedit.menu 
    2424f none $datadir/mc/edit.indent.rc 
    2525f none $datadir/mc/edit.spell.rc 
    26 f none $datadir/mc/mc.ext 
     26f none $sysconfdir/mc/mc.ext 
    2727f none $datadir/mc/mc.hint 
    2828f none $datadir/mc/mc.hint.cs 
    2929f none $datadir/mc/mc.hint.es 
    f none $datadir/mc/mc.hlp.hu 
    4040f none $datadir/mc/mc.hlp.it 
    4141f none $datadir/mc/mc.hlp.pl 
    4242f none $datadir/mc/mc.hlp.ru 
    43 f none $datadir/mc/mc.lib 
    44 f none $datadir/mc/mc.menu 
     43f none $sysconfdir/mc/mc.lib 
     44f none $sysconfdir/mc/mc.menu 
    4545# 
    4646!search $datadir/mc/bin 
    4747# 
    f none $datadir/mc/extfs/deb 
    6060f none $datadir/mc/extfs/deba 
    6161f none $datadir/mc/extfs/debd 
    6262f none $datadir/mc/extfs/dpkg 
    63 f none $datadir/mc/extfs/extfs.ini 
     63f none $sysconfdir/mc/extfs.ini 
    6464f none $datadir/mc/extfs/hp48 
    6565f none $datadir/mc/extfs/lslR 
    6666f none $datadir/mc/extfs/mailfs 
    f none $datadir/mc/extfs/patchfs 
    6868f none $datadir/mc/extfs/README 
    6969f none $datadir/mc/extfs/rpm 
    7070f none $datadir/mc/extfs/rpms 
    71 f none $datadir/mc/extfs/sfs.ini 
     71f none $sysconfdir/mc/sfs.ini 
    7272f none $datadir/mc/extfs/trpm 
    7373f none $datadir/mc/extfs/uar 
    7474f none $datadir/mc/extfs/uarj 
  • src/Makefile.am

    diff --git a/src/Makefile.am b/src/Makefile.am
    index ccf0f8b..54dcd8c 100644
    a b  
    11AM_CFLAGS = $(GLIB_CFLAGS) 
    22 
    33localedir = $(datadir)/locale 
    4 pkglibexecdir =         $(libexecdir)/@PACKAGE@ 
     4pkglibexecdir = $(libexecdir)/@PACKAGE@ 
     5pkgsysconfdir = $(sysconfdir)/@PACKAGE@ 
    56 
    67bin_PROGRAMS = mc mcmfmt 
    78 
    89if CONS_SAVER 
    910pkglibexec_PROGRAMS = cons.saver 
    10 AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" \ 
     11AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" -DMC_CONFIGDIR=\""$(pkgsysconfdir)"\" \ 
    1112        -DSAVERDIR=\""$(pkglibexecdir)"\" 
    1213else 
    13 AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" 
     14AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" -DMC_CONFIGDIR=\""$(pkgsysconfdir)"\"  
    1415endif 
    1516 
    1617noinst_PROGRAMS = man2hlp 
  • src/boxes.c

    diff --git a/src/boxes.c b/src/boxes.c
    index 0fd2a0b..b10e1c9 100644
    a b  
    3838#include "dialog.h"             /* The nice dialog manager */ 
    3939#include "widget.h"             /* The widgets for the nice dialog manager */ 
    4040#include "wtools.h" 
    41 #include "setup.h"              /* For profile_name */ 
    4241#include "profile.h"            /* Load/save user formats */ 
    4342#include "key.h"                /* XCTRL and ALT macros  */ 
    4443#include "command.h"            /* For cmdline */ 
     
    4948#include "tree.h" 
    5049#include "layout.h"             /* for get_nth_panel_name proto */ 
    5150#include "background.h"         /* task_list */ 
     51#include "mc_conf.h"            /* MC global configuration */ 
    5252 
    5353#ifdef HAVE_CHARSET 
    5454#include "charsets.h" 
    display_box (WPanel *panel, char **userp, char **minip, int *use_msformat, int n 
    232232        for (i = 0; i < LIST_TYPES; i++) 
    233233            panel->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT); 
    234234        section = g_strconcat ("Temporal:", p, (char *) NULL); 
    235         if (!profile_has_section (section, profile_name)) { 
     235        if (!profile_has_section (section, mc_current_mc_ini)) { 
    236236            g_free (section); 
    237237            section = g_strdup (p); 
    238238        } 
  • src/charsets.c

    diff --git a/src/charsets.c b/src/charsets.c
    index 5666c23..1ff2eaf 100644
    a b load_codepages_list (void) 
    4444    FILE *f; 
    4545    char *fname; 
    4646    char buf[256]; 
    47     extern char *mc_home; 
    4847    extern int display_codepage; 
    4948    char *default_codepage = NULL; 
    5049 
    51     fname = concat_dir_and_file (mc_home, CHARSETS_INDEX); 
     50    fname = _strcatdup(mc_global_datadir, PATH_SEP_STR CHARSETS_INDEX); 
    5251    if (!(f = fopen (fname, "r"))) { 
    5352        fprintf (stderr, _("Warning: file %s not found\n"), fname); 
    5453        g_free (fname); 
  • src/cmd.c

    diff --git a/src/cmd.c b/src/cmd.c
    index 01d110f..3ff7bbe 100644
    a b  
    5353#include "main.h"               /* change_panel() */ 
    5454#include "panel.h"              /* current_panel */ 
    5555#include "help.h"               /* interactive_display() */ 
    56 #include "user.h"               /* MC_GLOBAL_MENU */ 
     56#include "user.h"               /* user_menu_cmd() */ 
     57#include "profile.h"            /* sync_profile() */ 
    5758#include "command.h"            /* cmdline */ 
    5859#include "layout.h"             /* get_current_type() */ 
    5960#include "ext.h"                /* regex_command() */ 
    6061#include "boxes.h"              /* cd_dialog() */ 
    6162#include "setup.h"              /* save_setup() */ 
    62 #include "profile.h"            /* PROFILE_NAME */ 
    6363#include "execute.h"            /* toggle_panels() */ 
     64#include "mc_conf.h"            /* MC global configuration */ 
    6465 
    6566#ifndef MAP_FILE 
    6667#   define MAP_FILE 0 
    check_for_default(char *default_file, char *file) 
    553554 
    554555void ext_cmd (void) 
    555556{ 
    556     char *buffer; 
    557     char *extdir; 
    558     int  dir; 
     557    int dir = 0; 
    559558 
    560     dir = 0; 
    561     if (geteuid () == 0){ 
     559    /* when root, ask whether to add global or users extfile */ 
     560    if (geteuid () == 0)         
    562561        dir = query_dialog (_("Extension file edit"), 
    563562                            _(" Which extension file you want to edit? "), 0, 2, 
    564563                            _("&User"), _("&System Wide")); 
     564 
     565    switch(dir) 
     566    { 
     567        case 0: 
     568            check_for_default (mc_global_mc_ext, mc_user_mc_ext); 
     569            do_edit (mc_user_mc_ext); 
     570        break; 
     571        case 1: 
     572            do_edit (mc_global_mc_ext); 
    565573    } 
    566     extdir = concat_dir_and_file (mc_home, MC_LIB_EXT); 
    567574 
    568     if (dir == 0){ 
    569         buffer = concat_dir_and_file (home_dir, MC_USER_EXT); 
    570         check_for_default (extdir, buffer); 
    571         do_edit (buffer); 
    572         g_free (buffer); 
    573     } else if (dir == 1) 
    574         do_edit (extdir); 
     575    flush_extension_file (); 
     576} 
     577 
     578static inline void menu_edit_cmd_fn(const char* fn, int chm) 
     579{ 
    575580 
    576    g_free (extdir); 
    577    flush_extension_file (); 
    578581} 
    579582 
    580583/* where  = 0 - do edit file menu for mc */ 
    void ext_cmd (void) 
    582585static void 
    583586menu_edit_cmd (int where) 
    584587{ 
    585     char *buffer; 
    586     char *menufile; 
    587     int dir = 0; 
    588      
    589     dir = query_dialog ( 
     588    int dir = query_dialog ( 
    590589        _(" Menu edit "), 
    591590        _(" Which menu file do you want to edit? "),  
    592591        0, geteuid() ? 2 : 3, 
    593592        _("&Local"), _("&User"), _("&System Wide") 
    594593    ); 
    595594 
    596     menufile = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); 
     595    char* globalmenu = (where ? mc_global_cedit_menu : mc_global_mc_menu); 
     596    char* thismenu = NULL; 
    597597 
    598598    switch (dir) { 
    599599        case 0: 
    600             buffer = g_strdup (where ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU); 
    601             check_for_default (menufile, buffer); 
     600            thismenu = (where ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU); 
     601            check_for_default (globalmenu, thismenu); 
    602602            break; 
    603603 
    604604        case 1: 
    605             buffer = concat_dir_and_file (home_dir, where ? CEDIT_HOME_MENU : MC_HOME_MENU); 
    606             check_for_default (menufile, buffer); 
     605            thismenu = (where ? mc_user_cedit_menu : mc_user_mc_menu); 
     606            check_for_default (globalmenu, thismenu); 
    607607            break; 
    608          
     608 
    609609        case 2: 
    610             buffer = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); 
     610            thismenu = globalmenu; 
    611611            break; 
    612612 
    613613        default: 
    614            g_free (menufile); 
    615614            return; 
    616615    } 
    617     do_edit (buffer); 
    618         if (dir == 0) 
    619                 chmod(buffer, 0600); 
    620     g_free (buffer); 
    621     g_free (menufile); 
     616    do_edit (thismenu); 
     617    if (dir == 0) 
     618        chmod(thismenu, 0600); 
    622619} 
    623620 
    624621void quick_chdir_cmd (void) 
    edit_user_menu_cmd (void) 
    656653void 
    657654edit_syntax_cmd (void) 
    658655{ 
    659     char *buffer; 
    660     char *extdir; 
    661656    int dir = 0; 
    662657 
    663     if (geteuid () == 0) { 
     658    if (geteuid () == 0) 
    664659        dir = 
    665660            query_dialog (_("Syntax file edit"), 
    666661                          _(" Which syntax file you want to edit? "), 0, 2, 
    667662                          _("&User"), _("&System Wide")); 
    668     } 
    669     extdir = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax"); 
    670663 
    671     if (dir == 0) { 
    672         buffer = concat_dir_and_file (home_dir, SYNTAX_FILE); 
    673         check_for_default (extdir, buffer); 
    674         do_edit (buffer); 
    675         g_free (buffer); 
    676     } else if (dir == 1) 
    677         do_edit (extdir); 
    678  
    679     g_free (extdir); 
     664    switch (dir) 
     665    { 
     666        case 0: 
     667            check_for_default (mc_global_syntaxfile, mc_user_syntaxfile); 
     668            do_edit (mc_user_syntaxfile); 
     669        break; 
     670        case 1: 
     671            do_edit (mc_global_syntaxfile); 
     672        break; 
     673    } 
    680674} 
    681675#endif 
    682676 
    get_random_hint (int force) 
    10601054        return g_strdup (""); 
    10611055    last_sec = tv.tv_sec; 
    10621056 
    1063     data = load_mc_home_file (MC_HINT, NULL); 
     1057    data = load_i18n_data_file (MC_HINT, NULL); 
    10641058    if (!data) 
    10651059        return 0; 
    10661060 
    dirsizes_cmd (void) 
    12231217void 
    12241218save_setup_cmd (void) 
    12251219{ 
    1226     char *str; 
    1227      
    12281220    save_setup (); 
    12291221    sync_profiles (); 
    1230      
    1231     message (0, _(" Setup "), _(" Setup saved to ~/%s"), PROFILE_NAME); 
     1222    message (0, _(" Setup "), _(" Setup saved to ~/%s"), mc_user_mc_ini); 
    12321223} 
    12331224 
    12341225static void 
  • src/ext.c

    diff --git a/src/ext.c b/src/ext.c
    index 8e64d2c..6234925 100644
    a b  
    3636#include "ext.h" 
    3737#include "view.h" 
    3838#include "execute.h" 
    39  
     39#include "mc_conf.h" 
    4040#include "cons.saver.h" 
    4141#include "layout.h" 
    4242 
    regex_command (const char *filename, const char *action, int *move_dir) 
    436436    } 
    437437 
    438438    if (data == NULL) { 
    439         char *extension_file; 
    440         int mc_user_ext = 1; 
    441         int home_error = 0; 
    442  
    443         extension_file = concat_dir_and_file (home_dir, MC_USER_EXT); 
    444         if (!exist_file (extension_file)) { 
    445             g_free (extension_file); 
    446           check_stock_mc_ext: 
    447             extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT); 
    448             mc_user_ext = 0; 
    449         } 
    450         data = load_file (extension_file); 
    451         g_free (extension_file); 
     439        data = load_file (mc_current_mc_ext); 
    452440        if (data == NULL) 
    453441            return 0; 
    454442 
    regex_command (const char *filename, const char *action, int *move_dir) 
    457445                && !strstr (data, "type/")) { 
    458446                g_free (data); 
    459447                data = NULL; 
    460                 if (mc_user_ext) { 
    461                     home_error = 1; 
    462                     goto check_stock_mc_ext; 
    463                 } else { 
    464448                    char *title = 
    465                         g_strdup_printf (_(" %s%s file error"), 
    466                             mc_home, MC_LIB_EXT); 
    467                     message (1, title, _("The format of the %smc.ext " 
     449                        g_strdup_printf (_(" %s file error"), 
     450                            mc_global_mc_ext); 
     451                    message (1, title, _("The format of the %s " 
    468452                        "file has changed with version 3.0.  It seems that " 
    469453                        "the installation failed.  Please fetch a fresh " 
    470454                        "copy from the Midnight Commander package."), 
    471                         mc_home); 
     455                        mc_global_mc_ext); 
    472456                    g_free (title); 
    473457                    return 0; 
    474458                } 
    475             } 
    476         } 
    477         if (home_error) { 
    478             char *title = 
    479                 g_strdup_printf (_(" ~/%s file error "), MC_USER_EXT); 
    480             message (1, title, _("The format of the ~/%s file has " 
    481                 "changed with version 3.0.  You may either want to copy " 
    482                 "it from %smc.ext or use that file as an example of how " 
    483                 "to write it."), MC_USER_EXT, mc_home); 
    484             g_free (title); 
    485459        } 
    486460    } 
    487461    mc_stat (filename, &mystat); 
  • src/ext.h

    diff --git a/src/ext.h b/src/ext.h
    index c5d07f8..143b4ab 100644
    a b int regex_command (const char *filename, const char *action, int *move_dir); 
    88 */ 
    99void flush_extension_file (void); 
    1010 
    11 #define MC_USER_EXT ".mc/bindings" 
    12 #define MC_LIB_EXT  "mc.ext" 
    13  
    1411#endif 
  • src/help.c

    diff --git a/src/help.c b/src/help.c
    index 3261cbb..2dc5a0f 100644
    a b interactive_display (const char *filename, const char *node) 
    766766    if (filename) 
    767767        data = load_file (filename); 
    768768    else 
    769         data = load_mc_home_file ("mc.hlp", &hlpfile); 
     769        data = load_i18n_data_file ("mc.hlp", &hlpfile); 
    770770 
    771771    if (data == NULL) { 
    772772        message (1, MSG_ERROR, _(" Cannot open file %s \n %s "), filename ? filename : hlpfile, 
  • src/hotlist.c

    diff --git a/src/hotlist.c b/src/hotlist.c
    index a1183cb..7a0d07e 100644
    a b  
    4242#include "color.h"              /* dialog_colors */ 
    4343#include "dialog.h" 
    4444#include "widget.h" 
    45 #include "setup.h"              /* For profile_bname */ 
     45#include "mc_conf.h"            /* MC global configuration */ 
    4646#include "profile.h"            /* Load/save directories hotlist */ 
    4747#include "wtools.h"             /* QuickDialog */ 
    4848#include "panel.h"              /* current_panel */ 
    init_hotlist (int list_type) 
    615615 
    616616    hotlist_state.expanded = 
    617617        GetPrivateProfileInt ("HotlistConfig", "expanded_view_of_groups", 
    618                               0, profile_name); 
     618                              0, mc_current_mc_ini); 
    619619 
    620620    if (list_type == LIST_VFSLIST) { 
    621621        title = _("Active VFS directories"); 
    load_group (struct hotlist *grp) 
    11741174     
    11751175    group_section = find_group_section (grp); 
    11761176 
    1177     profile_keys = profile_init_iterator (group_section, profile_name); 
     1177    profile_keys = profile_init_iterator (group_section, mc_current_mc_ini); 
    11781178 
    11791179    current_group = grp; 
    11801180 
    load_group (struct hotlist *grp) 
    11841184    } 
    11851185    g_free (group_section); 
    11861186 
    1187     profile_keys = profile_init_iterator (grp->directory, profile_name); 
     1187    profile_keys = profile_init_iterator (grp->directory, mc_current_mc_ini); 
    11881188 
    11891189    while (profile_keys){ 
    11901190        profile_keys = profile_iterator_next (profile_keys, &key, &value); 
    static char *tkn_buf; 
    12091209static int  tkn_buf_length; 
    12101210static int  tkn_length; 
    12111211 
    1212 static char *hotlist_file_name; 
    12131212static FILE *hotlist_file; 
    12141213static time_t hotlist_file_mtime; 
    12151214 
    clean_up_hotlist_groups (const char *section) 
    14151414    char        *key, *value; 
    14161415 
    14171416    grp_section = g_strconcat (section, ".Group", (char *) NULL); 
    1418     if (profile_has_section (section, profile_name)) 
    1419         profile_clean_section (section, profile_name); 
    1420     if (profile_has_section (grp_section, profile_name)) { 
    1421         profile_keys = profile_init_iterator (grp_section, profile_name); 
     1417    if (profile_has_section (section, mc_current_mc_ini)) 
     1418        profile_clean_section (section, mc_current_mc_ini); 
     1419    if (profile_has_section (grp_section, mc_current_mc_ini)) { 
     1420        profile_keys = profile_init_iterator (grp_section, mc_current_mc_ini); 
    14221421 
    14231422        while (profile_keys) { 
    14241423            profile_keys = profile_iterator_next (profile_keys, &key, &value); 
    14251424            clean_up_hotlist_groups (key); 
    14261425        } 
    1427         profile_clean_section (grp_section, profile_name); 
     1426        profile_clean_section (grp_section, mc_current_mc_ini); 
    14281427    } 
    14291428    g_free (grp_section); 
    14301429} 
    load_hotlist (void) 
    14381437    struct stat stat_buf; 
    14391438 
    14401439    if (hotlist_state.loaded) { 
    1441         stat (hotlist_file_name, &stat_buf); 
     1440        stat (mc_user_hotlist, &stat_buf); 
    14421441        if (hotlist_file_mtime < stat_buf.st_mtime)  
    14431442            done_hotlist (); 
    14441443        else 
    14451444            return; 
    14461445    } 
    14471446 
    1448     if (!hotlist_file_name) 
    1449         hotlist_file_name = concat_dir_and_file (home_dir, HOTLIST_FILENAME); 
    1450      
    14511447    hotlist            = new_hotlist (); 
    14521448    hotlist->type      = HL_TYPE_GROUP; 
    14531449    hotlist->label     = g_strdup (_(" Top level group ")); 
    load_hotlist (void) 
    14571453     */ 
    14581454    hotlist->directory = g_strdup ("Hotlist"); 
    14591455 
    1460     if ((hotlist_file = fopen (hotlist_file_name, "r")) == 0) { 
     1456    if ((hotlist_file = fopen (mc_user_hotlist, "r")) == 0) { 
    14611457        int     result; 
    14621458 
    14631459        load_group (hotlist); 
    load_hotlist (void) 
    14721468            remove_old_list = 1; 
    14731469        } else { 
    14741470            message (D_ERROR, _(" Hotlist Load "), 
    1475                      _("MC was unable to write ~/%s file, your old hotlist entries were not deleted"), 
    1476                      HOTLIST_FILENAME); 
     1471                     _("MC was unable to write %s file, your old hotlist entries were not deleted"), 
     1472                     mc_user_hotlist); 
    14771473        } 
    14781474    } else { 
    14791475        hot_load_file (hotlist); 
    load_hotlist (void) 
    14861482        sync_profiles (); 
    14871483    } 
    14881484 
    1489     stat (hotlist_file_name, &stat_buf); 
     1485    stat (mc_user_hotlist, &stat_buf); 
    14901486    hotlist_file_mtime = stat_buf.st_mtime; 
    14911487    current_group = hotlist; 
    14921488} 
    save_group (struct hotlist *grp) 
    14991495 
    15001496    group_section = find_group_section (grp); 
    15011497     
    1502     profile_clean_section (group_section, profile_name); 
     1498    profile_clean_section (group_section, mc_current_mc_ini); 
    15031499    for (;current && current->type == HL_TYPE_GROUP; current = current->next){ 
    15041500        WritePrivateProfileString (group_section, 
    15051501                                   current->directory, 
    15061502                                   current->label, 
    1507                                    profile_name); 
     1503                                   mc_current_mc_ini); 
    15081504    } 
    15091505    g_free (group_section); 
    15101506 
    save_group (struct hotlist *grp) 
    15121508         current && current->type == HL_TYPE_GROUP; 
    15131509         current = current->next) 
    15141510         save_group (current); 
    1515      
    1516     profile_clean_section (grp->directory, profile_name); 
     1511 
     1512    profile_clean_section (grp->directory, mc_current_mc_ini); 
    15171513    for (;current; current = current->next){ 
    15181514        WritePrivateProfileString (grp->directory, 
    15191515                                   current->directory, 
    15201516                                   current->label, 
    1521                                    profile_name); 
     1517                                   mc_current_mc_ini); 
    15221518    } 
    15231519} 
    15241520 
    int save_hotlist (void) 
    15841580    int         saved = 0; 
    15851581    struct      stat stat_buf; 
    15861582     
    1587     if (!hotlist_state.readonly && hotlist_state.modified && hotlist_file_name) { 
    1588         char    *fbak = g_strconcat (hotlist_file_name, ".bak", (char *) NULL); 
     1583    if (!hotlist_state.readonly && hotlist_state.modified && mc_user_hotlist) { 
     1584        char    *fbak = g_strconcat (mc_user_hotlist, ".bak", (char *) NULL); 
    15891585 
    1590         rename (hotlist_file_name, fbak); 
    1591         if ((hotlist_file = fopen (hotlist_file_name, "w")) != 0) { 
     1586        rename (mc_user_hotlist, fbak); 
     1587        if ((hotlist_file = fopen (mc_user_hotlist, "w")) != 0) { 
    15921588            if (stat (fbak, &stat_buf) == 0) 
    1593                 chmod (hotlist_file_name, stat_buf.st_mode); 
     1589                chmod (mc_user_hotlist, stat_buf.st_mode); 
    15941590            else 
    1595                 chmod (hotlist_file_name, S_IRUSR | S_IWUSR); 
     1591                chmod (mc_user_hotlist, S_IRUSR | S_IWUSR); 
    15961592            hot_save_group (hotlist); 
    15971593            fclose (hotlist_file); 
    1598             stat (hotlist_file_name, &stat_buf); 
     1594            stat (mc_user_hotlist, &stat_buf); 
    15991595            hotlist_file_mtime = stat_buf.st_mtime; 
    16001596            saved = 1; 
    16011597            hotlist_state.modified = 0; 
    16021598        } else 
    1603             rename (fbak, hotlist_file_name); 
     1599            rename (fbak, mc_user_hotlist); 
    16041600        g_free (fbak); 
    16051601    } 
    16061602 
    void done_hotlist (void) 
    16231619     
    16241620    hotlist_state.loaded = 0; 
    16251621 
    1626     g_free (hotlist_file_name); 
    1627     hotlist_file_name = 0; 
    16281622    l_hotlist = 0; 
    16291623    current_group = 0; 
    16301624    if (tkn_buf){ 
  • src/learn.c

    diff --git a/src/learn.c b/src/learn.c
    index dff560c..167caa9 100644
    a b  
    4242#include "main.h" 
    4343#include "learn.h" 
    4444#include "wtools.h" 
     45#include "mc_conf.h"            /* MC global configuration */ 
    4546 
    4647#define UX              4 
    4748#define UY              3 
    learn_save (void) 
    314315        if (learnkeys [i].sequence != NULL) { 
    315316            profile_changed = 1; 
    316317            WritePrivateProfileString (section, key_name_conv_tab [i].name, 
    317                 learnkeys [i].sequence, profile_name); 
     318                learnkeys [i].sequence, mc_current_mc_ini); 
    318319        } 
    319320    } 
    320321 
  • src/logging.c

    diff --git a/src/logging.c b/src/logging.c
    index bfd48e0..f1f364c 100644
    a b  
    2929#include "global.h" 
    3030#include "logging.h" 
    3131#include "setup.h" 
     32#include "mc_conf.h"    /* MC global configuration */ 
    3233 
    3334/*** file scope functions **********************************************/ 
    3435 
    is_logging_enabled(void) 
    3738{ 
    3839        static gboolean logging_initialized = FALSE; 
    3940        static gboolean logging_enabled = FALSE; 
    40         char *mc_ini; 
    4141 
    4242        if (!logging_initialized) { 
    43                 mc_ini = g_strdup_printf("%s/%s", home_dir, PROFILE_NAME); 
    4443                logging_enabled = 
    45                     get_int(mc_ini, "development.enable_logging", FALSE); 
    46                 g_free(mc_ini); 
     44                    get_int(mc_user_mc_ini, "development.enable_logging", FALSE); 
    4745                logging_initialized = TRUE; 
    4846        } 
    4947        return logging_enabled; 
  • src/main.c

    diff --git a/src/main.c b/src/main.c
    index 949dcf9..2c78646 100644
    a b int midnight_shutdown = 0; 
    276276/* The user's shell */ 
    277277const char *shell = NULL; 
    278278 
    279 /* mc_home: The home of MC */ 
    280 char *mc_home = NULL; 
     279/* global config directory (can be set via $MC_CONFIGDIR, defaults to $sysconfdir/mc) */ 
     280char *mc_global_confdir = NULL; 
     281 
     282/* global config filenames - generated in OS_Setup() */ 
     283char *mc_global_mc_ini     = NULL; 
     284char *mc_global_mc_ext     = NULL; 
     285char *mc_global_mc_menu    = NULL; 
     286char *mc_global_mc_lib     = NULL; 
     287char *mc_global_cedit_menu = NULL; 
     288char *mc_global_datadir    = NULL; 
     289char *mc_global_syntaxdir  = NULL; 
     290char *mc_global_syntaxfile = NULL; 
     291char *mc_user_confdir      = NULL; 
     292char *mc_user_mc_ini       = NULL; 
     293char *mc_user_hotlist      = NULL; 
     294char *mc_user_mc_ext       = NULL; 
     295char *mc_user_mc_menu      = NULL; 
     296char *mc_user_cedit_menu   = NULL; 
     297char *mc_user_syntaxfile   = NULL; 
     298char *mc_current_mc_ini    = NULL; 
     299char *mc_current_mc_ext    = NULL; 
    281300 
    282301char cmd_buf[512]; 
    283302 
    static void 
    14431462done_mc_profile (void) 
    14441463{ 
    14451464    if (!auto_save_setup) 
    1446         profile_forget_profile (profile_name); 
     1465        profile_forget_profile (mc_current_mc_ini); 
    14471466    sync_profiles (); 
    14481467    done_setup (); 
    14491468    free_profiles (); 
    do_nc (void) 
    17611780static void 
    17621781OS_Setup (void) 
    17631782{ 
    1764     const char *mc_libdir; 
    17651783    shell = getenv ("SHELL"); 
    17661784    if (!shell || !*shell) { 
    17671785        struct passwd *pwd; 
    OS_Setup (void) 
    17741792 
    17751793    /* This is the directory, where MC was installed, on Unix this is DATADIR */ 
    17761794    /* and can be overriden by the MC_DATADIR environment variable */ 
    1777     if ((mc_libdir = getenv ("MC_DATADIR")) != NULL) { 
    1778         mc_home = g_strdup (mc_libdir); 
    1779     } else { 
    1780         mc_home = g_strdup (DATADIR); 
    1781     } 
     1795    if (!(mc_global_datadir = getenv("MC_DATADIR"))) 
     1796        mc_global_datadir = DATADIR; 
     1797 
     1798    /* User's home directory: used for subshell, profile location, etc */ 
     1799    if (!(home_dir = getenv ("HOME"))) 
     1800        home_dir = mc_global_datadir; 
     1801 
     1802    /* This is mc's global configuration directory, normally ${sysconfdir}/mc */ 
     1803    /* Can be overridden via MC_CONFIGDIR environment variable */ 
     1804    if (!(mc_global_confdir = getenv("MC_CONFIGDIR"))) 
     1805        mc_global_confdir = MC_CONFIGDIR; 
     1806 
     1807    /* Render the global filenames */ 
     1808    mc_global_mc_ini     = _strcatdup(mc_global_confdir,   "/mc.ini"); 
     1809    mc_global_mc_menu    = _strcatdup(mc_global_confdir,   "/mc.menu"); 
     1810    mc_global_mc_ext     = _strcatdup(mc_global_confdir,   "/mc.ext"); 
     1811    mc_global_mc_lib     = _strcatdup(mc_global_confdir,   "/mc.lib"); 
     1812    mc_global_cedit_menu = _strcatdup(mc_global_confdir,   "/cedit.menu"); 
     1813    mc_global_syntaxdir  = _strcatdup(mc_global_datadir,   "/syntax/"); // terminate with / ! 
     1814    mc_global_syntaxfile = _strcatdup(mc_global_syntaxdir, "Syntax"); 
     1815 
     1816    /* Render user's config filenames */ 
     1817    mc_user_confdir      = _strcatdup(home_dir,        "/.mc"); 
     1818    mc_user_mc_ini       = _strcatdup(mc_user_confdir, "/mc.ini"); 
     1819    mc_user_mc_ext       = _strcatdup(mc_user_confdir, "/bindings"); 
     1820    mc_user_mc_menu      = _strcatdup(mc_user_confdir, "/mc.menu"); 
     1821    mc_user_cedit_menu   = _strcatdup(mc_user_confdir, "/cedit/menu"); 
     1822    mc_user_hotlist      = _strcatdup(mc_user_confdir, "/hotlist"); 
     1823    mc_user_syntaxfile   = _strcatdup(mc_user_confdir, "/cedit/Syntax"); 
     1824 
     1825    /* Check which mc.ini to use currently */ 
     1826    if ((!exist_file(mc_user_mc_ini)) && (exist_file(mc_global_mc_ini))) 
     1827        mc_current_mc_ini = mc_global_mc_ini; 
     1828    else 
     1829        mc_current_mc_ini = mc_user_mc_ini; 
     1830 
     1831    /* Check which mc.ext to use currently */ 
     1832    mc_current_mc_ext = (exist_file(mc_user_mc_ext) ? mc_user_mc_ext : mc_global_mc_ext); 
    17821833} 
    17831834 
    17841835static void 
    process_args (poptContext ctx, int c, const char *option_arg) 
    19081959        break; 
    19091960 
    19101961    case 'f': 
    1911         printf ("%s\n", mc_home); 
     1962        printf ("%s\n", mc_global_datadir); 
    19121963        exit (0); 
    19131964        break; 
    19141965 
    main (int argc, char *argv[]) 
    21382189    /* Set up temporary directory */ 
    21392190    mc_tmpdir (); 
    21402191 
     2192    /* Initialize OS-speficic stuff, mainly config file locations, etc */ 
    21412193    OS_Setup (); 
    21422194 
    2143     /* This variable is used by the subshell */ 
    2144     home_dir = getenv ("HOME"); 
    2145     if (!home_dir) { 
    2146         /* mc_home was computed by OS_Setup */ 
    2147         home_dir = mc_home; 
    2148     } 
    2149  
     2195    /* Bring up the VFS layer */ 
    21502196    vfs_init (); 
    21512197 
    21522198#ifdef HAVE_SLANG 
    main (int argc, char *argv[]) 
    22612307    } 
    22622308    g_free (last_wd_string); 
    22632309 
    2264     g_free (mc_home); 
    22652310    done_key (); 
    22662311#ifdef HAVE_CHARSET 
    22672312    free_codepages_list (); 
  • src/main.h

    diff --git a/src/main.h b/src/main.h
    index 3f3c695..da57a88 100644
    a b void print_vfs_message(const char *msg, ...) 
    110110 
    111111extern const char *prompt; 
    112112extern const char *edit_one_file; 
    113 extern char *mc_home; 
     113 
    114114char *get_mc_lib_dir (void); 
    115115 
    116116int maybe_cd (int move_up_dir); 
  • new file src/mc_conf.h

    diff --git a/src/mc_conf.h b/src/mc_conf.h
    new file mode 100644
    index 0000000..20ae138
    - +  
     1#ifndef MC_CONF_H 
     2#define MC_CONF_H 
     3 
     4/* MC's global config directory - can be overridden by MC_CONFIGDIR environment variable */ 
     5/* defaults to $sysconfdir/mc */ 
     6extern char* mc_global_confir; 
     7 
     8/* MC's global config file names - generated from mc_configdir */ 
     9extern char* mc_global_confdir; 
     10extern char* mc_global_mc_ini; 
     11extern char* mc_global_mc_menu; 
     12extern char* mc_global_mc_ext; 
     13extern char* mc_global_mc_lib; 
     14extern char* mc_global_cedit_menu; 
     15extern char* mc_global_datadir; 
     16extern char* mc_global_syntaxdir; 
     17extern char* mc_global_syntaxfile; 
     18extern char* mc_user_confdir; 
     19extern char* mc_user_mc_ini; 
     20extern char* mc_user_hotlist; 
     21extern char* mc_user_mc_ext; 
     22extern char* mc_user_mc_menu; 
     23extern char* mc_user_cedit_menu; 
     24extern char* mc_user_syntaxfile; 
     25extern char* mc_current_mc_ini; 
     26extern char* mc_current_mc_ext; 
     27 
     28#define CEDIT_LOCAL_MENU        ".cedit.menu" 
     29#define MC_LOCAL_MENU           ".mc.menu" 
     30#define MC_HINT                 "mc.hint" 
     31 
     32#endif 
  • src/panelize.c

    diff --git a/src/panelize.c b/src/panelize.c
    index c2d2121..2071ce7 100644
    a b  
    4343#include "panel.h"              /* current_panel */ 
    4444#include "main.h"               /* repaint_screen */ 
    4545#include "panelize.h" 
     46#include "mc_conf.h"            /* MC global configuration */ 
    4647 
    4748#define UX              5 
    4849#define UY              2 
    void load_panelize (void) 
    309310    void *profile_keys; 
    310311    char *key, *value; 
    311312     
    312     profile_keys = profile_init_iterator (panelize_section, profile_name); 
     313    profile_keys = profile_init_iterator (panelize_section, mc_current_mc_ini); 
    313314     
    314315    add2panelize (g_strdup (_("Other command")), g_strdup ("")); 
    315316 
    void save_panelize (void) 
    330331{ 
    331332    struct panelize *current = panelize; 
    332333     
    333     profile_clean_section (panelize_section, profile_name); 
     334    profile_clean_section (panelize_section, mc_current_mc_ini); 
    334335    for (;current; current = current->next){ 
    335336        if (strcmp (current->label, _("Other command"))) 
    336337            WritePrivateProfileString (panelize_section, 
    337338                                       current->label, 
    338339                                       current->command, 
    339                                        profile_name); 
     340                                       mc_current_mc_ini); 
    340341    } 
    341342    sync_profiles (); 
    342343} 
  • src/profile.c

    diff --git a/src/profile.c b/src/profile.c
    index cbd60e5..b948b3b 100644
    a b static void free_profile (TProfile *p) 
    452452    g_free (p); 
    453453} 
    454454 
    455 void free_profile_name (const char *s) 
     455void free_profile_by_name (const char *s) 
    456456{ 
    457457    TProfile *p; 
    458458     
  • src/profile.h

    diff --git a/src/profile.h b/src/profile.h
    index 7600c20..080245b 100644
    a b int profile_has_section (const char *section_name, const char *profile); 
    4242/* Forgets about a .ini file, to disable updating of it */ 
    4343void profile_forget_profile (const char *file); 
    4444 
    45 /* Removes information from a profile */ 
    46 void free_profile_name (const char *s); 
     45/* Removes information coming from named profile */ 
     46void free_profile_by_name (const char *s); 
    4747 
    4848#endif 
  • src/screen.c

    diff --git a/src/screen.c b/src/screen.c
    index 74604f4..1064066 100644
    a b  
    5050#define WANT_WIDGETS 
    5151#include "main.h"               /* the_menubar */ 
    5252#include "unixcompat.h" 
     53#include "mc_conf.h"            /* MC global configuration */ 
    5354 
    5455#define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) ) 
    5556 
    panel_new (const char *panel_name) 
    10381039    panel->search_buffer[0] = 0; 
    10391040    panel->frame_size = frame_half; 
    10401041    section = g_strconcat ("Temporal:", panel->panel_name, (char *) NULL); 
    1041     if (!profile_has_section (section, profile_name)) { 
     1042    if (!profile_has_section (section, mc_current_mc_ini)) { 
    10421043        g_free (section); 
    10431044        section = g_strdup (panel->panel_name); 
    10441045    } 
  • src/setup.c

    diff --git a/src/setup.c b/src/setup.c
    index 026ac02..9e04b1d 100644
    a b  
    4242#include "win.h"                /* lookup_key */ 
    4343#include "cmd.h" 
    4444#include "file.h"               /* safe_delete */ 
     45#include "mc_conf.h"            /* MC global configuration */ 
    4546 
    4647#ifdef USE_VFS 
    4748#include "../vfs/gc.h" 
    extern char *find_ignore_dirs; 
    6566 
    6667extern int num_history_items_recorded; 
    6768 
    68 char *profile_name;             /* .mc/ini */ 
    69 char *global_profile_name;      /* mc.lib */ 
    70  
    7169char setup_color_string [4096]; 
    7270char term_color_string [4096]; 
    7371char color_terminal_string [512]; 
    7472 
    75 #define load_int(a,b,c) GetPrivateProfileInt(a,b,c,profile_name) 
    76 #define load_string(a,b,c,d,e) GetPrivateProfileString(a,b,c,d,e,profile_name) 
     73#define load_int(a,b,c) GetPrivateProfileInt(a,b,c,mc_current_mc_ini) 
     74#define load_string(a,b,c,d,e) GetPrivateProfileString(a,b,c,d,e,mc_current_mc_ini) 
    7775#define save_string WritePrivateProfileString 
    7876 
    7977int startup_left_mode; 
    panel_save_setup (struct WPanel *panel, const char *section) 
    242240    int  i; 
    243241 
    244242    g_snprintf (buffer, sizeof (buffer), "%d", panel->reverse); 
    245     save_string (section, "reverse", buffer, profile_name); 
     243    save_string (section, "reverse", buffer, mc_current_mc_ini); 
    246244    g_snprintf (buffer, sizeof (buffer), "%d", panel->case_sensitive); 
    247     save_string (section, "case_sensitive", buffer, profile_name); 
     245    save_string (section, "case_sensitive", buffer, mc_current_mc_ini); 
    248246    for (i = 0; sort_names [i].key; i++) 
    249247        if (sort_names [i].sort_type == (sortfn *) panel->sort_type){ 
    250248            save_string (section, "sort_order", 
    251                                        sort_names [i].key, profile_name); 
     249                                       sort_names [i].key, mc_current_mc_ini); 
    252250            break; 
    253251        } 
    254252 
    255253    for (i = 0; list_types [i].key; i++) 
    256254        if (list_types [i].list_type == panel->list_type){ 
    257             save_string (section, "list_mode", list_types [i].key, profile_name); 
     255            save_string (section, "list_mode", list_types [i].key, mc_current_mc_ini); 
    258256            break; 
    259257        } 
    260258 
    261259    save_string (section, "user_format", 
    262                                panel->user_format, profile_name); 
     260                               panel->user_format, mc_current_mc_ini); 
    263261 
    264262    for (i = 0; i < LIST_TYPES; i++){ 
    265263        g_snprintf (buffer, sizeof (buffer), "user_status%d", i); 
    266264        save_string (section, buffer, 
    267             panel->user_status_format [i], profile_name); 
     265            panel->user_status_format [i], mc_current_mc_ini); 
    268266    } 
    269267 
    270268    g_snprintf (buffer, sizeof (buffer), "%d", panel->user_mini_status); 
    271269    save_string (section, "user_mini_status", buffer, 
    272                                profile_name); 
     270                               mc_current_mc_ini); 
    273271} 
    274272 
    275273void 
    save_layout (void) 
    279277    int  i; 
    280278    char buffer [BUF_TINY]; 
    281279 
    282     profile = concat_dir_and_file (home_dir, PROFILE_NAME); 
    283  
    284280    /* Save integer options */ 
    285281    for (i = 0; layout [i].opt_name; i++){ 
    286282        g_snprintf (buffer, sizeof (buffer), "%d", *layout [i].opt_addr); 
    287         save_string ("Layout", layout [i].opt_name, buffer, profile); 
     283        save_string ("Layout", layout [i].opt_name, buffer, mc_user_mc_ini); 
    288284    } 
    289  
    290     g_free (profile); 
    291285} 
    292286 
    293287void 
    294288save_configure (void) 
    295289{ 
    296     char *profile; 
    297290    int  i; 
    298291 
    299     profile = concat_dir_and_file (home_dir, PROFILE_NAME); 
    300  
    301292    /* Save integer options */ 
    302293    for (i = 0; int_options[i].opt_name; i++) 
    303         set_int (profile, int_options[i].opt_name, *int_options[i].opt_addr); 
     294        set_int (mc_user_mc_ini, int_options[i].opt_name, *int_options[i].opt_addr); 
    304295 
    305296    /* Save string options */ 
    306297    for (i = 0; str_options[i].opt_name != NULL; i++) 
    307         set_config_string (profile, str_options[i].opt_name, 
     298        set_config_string (mc_user_mc_ini, str_options[i].opt_name, 
    308299            *str_options[i].opt_addr); 
    309  
    310     g_free (profile); 
    311300} 
    312301 
    313302static void 
    panel_save_type (const char *section, int type) 
    318307    for (i = 0; panel_types [i].opt_name; i++) 
    319308        if (panel_types [i].opt_type == type){ 
    320309            save_string (section, "display", panel_types [i].opt_name, 
    321                          profile_name); 
     310                         mc_current_mc_ini); 
    322311            break; 
    323312        } 
    324313} 
    save_panel_types (void) 
    341330void 
    342331save_setup (void) 
    343332{ 
    344     char *profile; 
    345  
    346333    saving_setup = 1; 
    347     profile = concat_dir_and_file (home_dir, PROFILE_NAME); 
    348334 
    349335    save_configure (); 
    350336 
    351337    save_layout (); 
    352338    save_string ("Dirs", "other_dir", 
    353339                               get_other_type () == view_listing 
    354                                ? other_panel->cwd : ".", profile); 
     340                               ? other_panel->cwd : ".", mc_user_mc_ini); 
    355341    if (current_panel != NULL) 
    356342            WritePrivateProfileString ("Dirs", "current_is_left", 
    357                                        get_current_index () == 0 ? "1" : "0", profile); 
     343                                       get_current_index () == 0 ? "1" : "0", mc_user_mc_ini); 
    358344    save_hotlist (); 
    359345 
    360346    save_panelize (); 
    save_setup (void) 
    363349 
    364350#if defined(USE_VFS) && defined (USE_NETCODE) 
    365351    WritePrivateProfileString ("Misc", "ftpfs_password", 
    366                                ftpfs_anonymous_passwd, profile); 
     352                               ftpfs_anonymous_passwd, mc_user_mc_ini); 
    367353    if (ftpfs_proxy_host) 
    368354        WritePrivateProfileString ("Misc", "ftp_proxy_host", 
    369                                    ftpfs_proxy_host, profile); 
     355                                   ftpfs_proxy_host, mc_user_mc_ini); 
    370356#endif /* USE_VFS && USE_NETCODE */ 
    371357 
    372358#ifdef HAVE_CHARSET 
    373359    save_string( "Misc", "display_codepage", 
    374                  get_codepage_id( display_codepage ), profile_name ); 
     360                 get_codepage_id( display_codepage ), mc_current_mc_ini ); 
    375361#endif /* HAVE_CHARSET */ 
    376362 
    377     g_free (profile); 
    378363    saving_setup = 0; 
    379364} 
    380365 
    panel_load_setup (WPanel *panel, const char *section) 
    409394    g_free (panel->user_format); 
    410395    panel->user_format = g_strdup (get_profile_string (section, "user_format", 
    411396                                                     DEFAULT_USER_FORMAT, 
    412                                                      profile_name)); 
     397                                                     mc_current_mc_ini)); 
    413398    for (i = 0; i < LIST_TYPES; i++){ 
    414399        g_free (panel->user_status_format [i]); 
    415400        g_snprintf (buffer, sizeof (buffer), "user_status%d", i); 
    416401        panel->user_status_format [i] = 
    417402            g_strdup (get_profile_string (section, buffer, 
    418                         DEFAULT_USER_FORMAT, profile_name)); 
     403                        DEFAULT_USER_FORMAT, mc_current_mc_ini)); 
    419404    } 
    420405 
    421406    panel->user_mini_status = 
    panel_load_setup (WPanel *panel, const char *section) 
    423408 
    424409} 
    425410 
    426 static void 
    427 load_layout (char *profile_name) 
     411static inline void 
     412load_layout () 
    428413{ 
    429414    int i; 
    430415 
    do_load_string (const char *s, const char *ss, const char *def) 
    469454} 
    470455#endif /* !USE_NETCODE */ 
    471456 
    472 char * 
    473 setup_init (void) 
    474 { 
    475     char   *profile; 
    476     char   *inifile; 
    477  
    478     if (profile_name) 
    479             return profile_name; 
    480  
    481     profile = concat_dir_and_file (home_dir, PROFILE_NAME); 
    482     if (!exist_file (profile)){ 
    483         inifile = concat_dir_and_file (mc_home, "mc.ini"); 
    484         if (exist_file (inifile)){ 
    485             g_free (profile); 
    486             profile = inifile; 
    487         } else 
    488             g_free (inifile); 
    489     } 
    490  
    491     profile_name = profile; 
    492  
    493     return profile; 
    494 } 
    495  
    496457void 
    497458load_setup (void) 
    498459{ 
    499     char *profile; 
    500460    int    i; 
    501461 
    502     profile = setup_init (); 
    503  
    504     /* mc.lib is common for all users, but has priority lower than 
    505        ~/.mc/ini.  FIXME: it's only used for keys and treestore now */ 
    506     global_profile_name = concat_dir_and_file (mc_home, "mc.lib"); 
    507  
    508462    /* Load integer boolean options */ 
    509463    for (i = 0; int_options[i].opt_name; i++) 
    510464        *int_options[i].opt_addr = 
    511             get_int (profile, int_options[i].opt_name, *int_options[i].opt_addr); 
     465            get_int (mc_current_mc_ini, int_options[i].opt_name, *int_options[i].opt_addr); 
    512466 
    513467    /* Load string options */ 
    514468    for (i = 0; str_options[i].opt_name != NULL; i++) 
    515         *str_options[i].opt_addr = get_config_string (profile, 
     469        *str_options[i].opt_addr = get_config_string (mc_current_mc_ini, 
    516470            str_options[i].opt_name, str_options[i].opt_defval); 
    517471 
    518     load_layout (profile); 
     472    load_layout (); 
    519473 
    520474    load_panelize (); 
    521475 
    load_setup (void) 
    539493    } 
    540494 
    541495    boot_current_is_left = 
    542         GetPrivateProfileInt ("Dirs", "current_is_left", 1, profile); 
     496        GetPrivateProfileInt ("Dirs", "current_is_left", 1, mc_current_mc_ini); 
    543497 
    544498#ifdef USE_NETCODE 
    545499    ftpfs_proxy_host = do_load_string ("Misc", "ftp_proxy_host", "gate"); 
    load_setup (void) 
    561515    /* Load the directory history */ 
    562516/*    directory_history_load (); */ 
    563517    /* Remove the temporal entries */ 
    564     profile_clean_section ("Temporal:New Left Panel", profile_name); 
    565     profile_clean_section ("Temporal:New Right Panel", profile_name); 
     518    profile_clean_section ("Temporal:New Left Panel", mc_current_mc_ini); 
     519    profile_clean_section ("Temporal:New Right Panel", mc_current_mc_ini); 
    566520#if defined(USE_VFS) && defined (USE_NETCODE) 
    567521    ftpfs_init_passwd (); 
    568522#endif /* USE_VFS && USE_NETCODE */ 
    load_anon_passwd () 
    596550 
    597551void done_setup (void) 
    598552{ 
    599     g_free (profile_name); 
    600     g_free (global_profile_name); 
    601553    done_hotlist (); 
    602554    done_panelize (); 
    603555/*    directory_history_free (); */ 
    void load_key_defs (void) 
    641593     * Load keys from mc.lib before ~/.mc/ini, so that the user 
    642594     * definitions override global settings. 
    643595     */ 
    644     load_keys_from_section ("general", global_profile_name); 
    645     load_keys_from_section (getenv ("TERM"), global_profile_name); 
    646     load_keys_from_section ("general", profile_name); 
    647     load_keys_from_section (getenv ("TERM"), profile_name); 
     596    load_keys_from_section ("general", mc_global_mc_lib); 
     597    load_keys_from_section (getenv ("TERM"), mc_global_mc_lib); 
     598    load_keys_from_section ("general", mc_current_mc_ini); 
     599    load_keys_from_section (getenv ("TERM"), mc_current_mc_ini); 
    648600 
    649601    /* We don't want a huge database loaded in core */ 
    650     free_profile_name (global_profile_name); 
     602    free_profile_by_name (mc_global_mc_lib); 
    651603} 
  • src/setup.h

    diff --git a/src/setup.h b/src/setup.h
    index c611e93..aa1de22 100644
    a b  
    33 
    44#include "panel.h" 
    55 
    6 char *setup_init (void); 
    76void save_layout (void); 
    87void save_configure (void); 
    98void load_setup (void); 
    char *load_anon_passwd (void); 
    1514void panel_save_setup (struct WPanel *panel, const char *section); 
    1615void panel_load_setup (struct WPanel *panel, const char *section); 
    1716 
    18 extern char *profile_name; 
    19 extern char *global_profile_name; 
    20  
    2117extern char setup_color_string[]; 
    2218extern char term_color_string[]; 
    2319extern char color_terminal_string[]; 
    extern int startup_left_mode; 
    2622extern int startup_right_mode; 
    2723extern int verbose; 
    2824 
    29 #define PROFILE_NAME     ".mc/ini" 
    30 #define HOTLIST_FILENAME ".mc/hotlist" 
    31  
    3225#endif 
  • src/treestore.c

    diff --git a/src/treestore.c b/src/treestore.c
    index 426b0c2..493f34f 100644
    a b  
    4646#include "treestore.h" 
    4747#include "profile.h" 
    4848#include "setup.h" 
     49#include "mc_conf.h"    /* MC global configuration */ 
    4950 
    5051#define TREE_SIGNATURE "Midnight Commander TreeStore v 2.0" 
    5152 
    should_skip_directory(const char *dir) 
    752753 
    753754    if (loaded == 0) { 
    754755        loaded = 1; 
    755         setup_init(); 
    756         process_special_dirs(&special_dirs, profile_name); 
    757         process_special_dirs(&special_dirs, global_profile_name); 
     756        process_special_dirs(&special_dirs, mc_current_mc_ini); 
     757        process_special_dirs(&special_dirs, mc_global_mc_lib); 
    758758    } 
    759759 
    760760    for (l = special_dirs; l; l = l->next) { 
  • src/user.c

    diff --git a/src/user.c b/src/user.c
    index 01022aa..8a0fb20 100644
    a b  
    3333#include "layout.h" 
    3434#include "execute.h" 
    3535#include "setup.h" 
     36#include "mc_conf.h" 
    3637 
    3738#include "../edit/edit.h"               /* BLOCK_FILE */ 
    3839#include "../edit/edit-widget.h"        /* WEdit */ 
    user_menu_cmd (struct WEdit *edit_widget) 
    717718        return; 
    718719    } 
    719720     
    720     menu = g_strdup (edit_widget ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU); 
     721    menu = (edit_widget ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU); 
    721722    if (!exist_file (menu) || !menu_file_own (menu)){ 
    722         g_free (menu); 
    723         menu = concat_dir_and_file \ 
    724                             (home_dir, edit_widget ? CEDIT_HOME_MENU : MC_HOME_MENU); 
     723        menu = (edit_widget ? mc_user_cedit_menu : mc_user_mc_menu); 
    725724        if (!exist_file (menu)){ 
    726             g_free (menu); 
    727             menu = concat_dir_and_file \ 
    728                         (mc_home, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); 
     725            menu = (edit_widget ? mc_global_cedit_menu : mc_global_mc_menu); 
    729726        } 
    730727    } 
    731728 
    732729    if ((data = load_file (menu)) == NULL){ 
    733730        message (1, MSG_ERROR, _(" Cannot open file %s \n %s "), 
    734731                 menu, unix_error_string (errno)); 
    735         g_free (menu); 
    736732        menu = NULL; 
    737733        return; 
    738734    } 
    739      
     735 
    740736    max_cols = 0; 
    741737    selected = 0; 
    742738    menu_limit = 0; 
    user_menu_cmd (struct WEdit *edit_widget) 
    836832    do_refresh (); 
    837833    } 
    838834 
    839     easy_patterns = old_patterns; 
    840     g_free (menu); 
    841835    menu = NULL; 
     836    easy_patterns = old_patterns; 
    842837    g_free (entries); 
    843838    g_free (data); 
    844839} 
  • src/user.h

    diff --git a/src/user.h b/src/user.h
    index 72997dc..598d6b5 100644
    a b int check_format_view (const char *); 
    99int check_format_var (const char *, char **); 
    1010int check_format_cd (const char *); 
    1111 
    12 #define CEDIT_GLOBAL_MENU    "cedit.menu" 
    13 #define CEDIT_LOCAL_MENU     ".cedit.menu" 
    14 #define CEDIT_HOME_MENU      ".mc/cedit/menu" 
    15 #define MC_GLOBAL_MENU       "mc.menu" 
    16 #define MC_LOCAL_MENU        ".mc.menu" 
    17 #define MC_HOME_MENU         ".mc/menu" 
    18 #define MC_HINT              "mc.hint" 
    19  
    2012#endif 
  • src/util.c

    diff --git a/src/util.c b/src/util.c
    index da6d1b2..20a79b4 100644
    a b  
    3737 
    3838#include "global.h" 
    3939#include "profile.h" 
    40 #include "main.h"               /* mc_home */ 
     40#include "main.h" 
     41#include "mc_conf.h"            /* MC global configuration */ 
    4142#include "cmd.h"                /* guess_message_value */ 
    4243#include "mountlist.h" 
    4344#include "win.h"                /* xterm_flag */ 
    set_config_string (const char *file, const char *key, const char *val) 
    644645    (void)WritePrivateProfileString (app_text, key, val, file); 
    645646} 
    646647 
    647 int 
    648 exist_file (const char *name) 
    649 { 
    650     return access (name, R_OK) == 0; 
    651 } 
    652  
    653648char * 
    654649load_file (const char *filename) 
    655650{ 
    load_file (const char *filename) 
    679674} 
    680675 
    681676char * 
    682 load_mc_home_file (const char *filename, char **allocated_filename) 
     677load_i18n_data_file (const char *filename, char **allocated_filename) 
    683678{ 
    684679    char *hintfile_base, *hintfile; 
    685680    char *lang; 
    686681    char *data; 
    687682 
    688     hintfile_base = concat_dir_and_file (mc_home, filename); 
     683    hintfile_base = concat_dir_and_file (mc_global_datadir, filename); 
    689684    lang = guess_message_value (); 
    690685 
    691686    hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL); 
  • src/util.h

    diff --git a/src/util.h b/src/util.h
    index 4e9a113..a26e434 100644
    a b extern char * get_config_string (const char *, const char *, const char *); 
    9292extern void set_config_string (const char *, const char *, const char *); 
    9393 
    9494char *load_file (const char *filename); 
    95 char *load_mc_home_file (const char *filename, char ** allocated_filename); 
     95char *load_i18n_data_file (const char *filename, char ** allocated_filename); 
    9696 
    9797/* uid/gid managing */ 
    9898void init_groups (void); 
    char *get_owner (int); 
    110110size_t i18n_checktimelength (void); 
    111111const char *file_date (time_t); 
    112112 
    113 int exist_file (const char *name); 
     113#define exist_file(fn) (( access(fn, R_OK) == 0 )) 
    114114 
    115115/* Returns a copy of *s until a \n is found and is below top */ 
    116116const char *extract_line (const char *s, const char *top); 
    extern int ascii_alpha_to_cntrl (int ch); 
    256256#undef Q_ 
    257257const char *Q_ (const char *s); 
    258258 
     259/* concat two strings into a new (malloc()'ed) buffer */ 
     260static inline char* _strcatdup(const char* one, const char* two) 
     261{ 
     262    int sz = strlen(one)+strlen(two)+2; 
     263    char* buf = (char*)malloc(sz); 
     264    strcpy(buf,one); 
     265    strcat(buf,two); 
     266    return buf; 
     267} 
     268 
    259269#endif 
  • vfs/extfs.c

    diff --git a/vfs/extfs.c b/vfs/extfs.c
    index d634e33..6c8eede 100644
    a b  
    4343#include "../src/execute.h"     /* For shell_execute */ 
    4444#include "vfs.h" 
    4545#include "vfs-impl.h" 
    46 #include "gc.h"         /* vfs_rmstamp */ 
     46#include "gc.h"                 /* vfs_rmstamp */ 
     47#include "../src/mc_conf.h"     /* MC global configuration */ 
    4748 
    4849#undef ERRNOR 
    4950#define ERRNOR(x,y) do { my_errno = x; return y; } while(0) 
    static char *extfs_prefixes [MAXEXTFS]; 
    109110static char extfs_need_archive [MAXEXTFS]; 
    110111static int extfs_no = 0; 
    111112 
     113static char *mc_extfs_ini; 
     114static char *mc_extfs_scripts; 
     115 
     116/* initialize and return script directory name */ 
     117static inline char* _getscriptdir() 
     118{ 
     119    if (mc_extfs_scripts) 
     120        return mc_extfs_scripts; 
     121 
     122    mc_extfs_scripts = _strcatdup(mc_global_confdir, PATH_SEP_STR "extfs" PATH_SEP_STR); 
     123    return mc_extfs_scripts; 
     124} 
     125 
     126/* initialize and return extfs.ini pathname */ 
     127static inline char* _getini() 
     128{ 
     129    if (mc_extfs_ini) 
     130        return mc_extfs_ini; 
     131 
     132    /* first try to open user's own extfs.ini, then fallback to global one */ 
     133    mc_extfs_ini = _strcatdup(mc_user_confdir, PATH_SEP_STR "extfs.ini"); 
     134    if (exist_file(mc_extfs_ini)) 
     135        return mc_extfs_ini; 
     136 
     137    free(mc_extfs_ini); 
     138    mc_extfs_ini = _strcatdup(mc_global_confdir, PATH_SEP_STR "extfs.ini"); 
     139 
     140    return mc_extfs_ini; 
     141} 
     142 
    112143static void 
    113144extfs_fill_names (struct vfs_class *me, fill_names_f func) 
    114145{ 
    extfs_open_archive (int fstype, const char *name, struct archive **pparc) 
    228259    FILE *result; 
    229260    mode_t mode; 
    230261    char *cmd; 
    231     char *mc_extfsdir; 
    232262    struct stat mystat; 
    233263    struct archive *current_archive; 
    234264    struct entry *root_entry; 
    extfs_open_archive (int fstype, const char *name, struct archive **pparc) 
    246276        tmp = name_quote (name, 0); 
    247277    } 
    248278 
    249     mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); 
    250279    cmd = 
    251         g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ", 
     280        g_strconcat (_getscriptdir(), extfs_prefixes[fstype], " list ", 
    252281                     local_name ? local_name : tmp, (char *) NULL); 
    253282    g_free (tmp); 
    254     g_free (mc_extfsdir); 
    255283    open_error_pipe (); 
    256284    result = popen (cmd, "r"); 
    257285    g_free (cmd); 
    extfs_cmd (const char *extfs_cmd, struct archive *archive, 
    611639    char *quoted_file; 
    612640    char *quoted_localname; 
    613641    char *archive_name; 
    614     char *mc_extfsdir; 
    615642    char *cmd; 
    616643    int retval; 
    617644 
    extfs_cmd (const char *extfs_cmd, struct archive *archive, 
    621648    archive_name = name_quote (extfs_get_archive_name (archive), 0); 
    622649    quoted_localname = name_quote (localname, 0); 
    623650 
    624     mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); 
    625     cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], 
     651    cmd = g_strconcat (_getscriptdir, extfs_prefixes[archive->fstype], 
    626652                       extfs_cmd, archive_name, " ", quoted_file, " ", 
    627653                       quoted_localname, (char *) NULL); 
    628654    g_free (quoted_file); 
    629655    g_free (quoted_localname); 
    630     g_free (mc_extfsdir); 
    631656    g_free (archive_name); 
    632657 
    633658    open_error_pipe (); 
    static void 
    641666extfs_run (struct vfs_class *me, const char *file) 
    642667{ 
    643668    struct archive *archive = NULL; 
    644     char *p, *q, *archive_name, *mc_extfsdir; 
     669    char *p, *q, *archive_name; 
    645670    char *cmd; 
    646671 
    647672    if ((p = extfs_get_path (me, file, &archive, 0)) == NULL) 
    extfs_run (struct vfs_class *me, const char *file) 
    650675    g_free (p); 
    651676 
    652677    archive_name = name_quote (extfs_get_archive_name (archive), 0); 
    653     mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); 
    654     cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], 
     678    cmd = g_strconcat (_getscriptdir(), extfs_prefixes[archive->fstype], 
    655679                       " run ", archive_name, " ", q, (char *) NULL); 
    656     g_free (mc_extfsdir); 
    657680    g_free (archive_name); 
    658681    g_free (q); 
    659682    shell_execute (cmd, 0); 
    extfs_ungetlocalcopy (struct vfs_class *me, const char *path, 
    12861309    } 
    12871310} 
    12881311 
    1289  
    12901312static int extfs_init (struct vfs_class *me) 
    12911313{ 
    12921314    FILE *cfg; 
    1293     char *mc_extfsini; 
    12941315    char key[256]; 
    12951316 
    12961317    (void) me; 
    12971318 
    1298     mc_extfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "extfs.ini"); 
    1299     cfg = fopen (mc_extfsini, "r"); 
    1300  
    13011319    /* We may not use vfs_die() message or message or similar, 
    13021320     * UI is not initialized at this time and message would not 
    13031321     * appear on screen. */ 
    1304     if (!cfg) { 
    1305         fprintf (stderr, _("Warning: file %s not found\n"), mc_extfsini); 
    1306         g_free (mc_extfsini); 
     1322    if ((cfg=fopen(_getini(), "r"))==NULL) { 
     1323        fprintf (stderr, _("Warning: file %s not found\n"), mc_extfs_ini); 
     1324        free (mc_extfs_ini); 
     1325        mc_extfs_ini = NULL; 
    13071326        return 0; 
    13081327    } 
    13091328 
    static int extfs_init (struct vfs_class *me) 
    13171336 
    13181337        if (*key == '[') { 
    13191338            fprintf(stderr, "Warning: You need to update your %s file.\n", 
    1320                     mc_extfsini); 
     1339                    mc_extfs_ini); 
    13211340            fclose(cfg); 
    1322             g_free (mc_extfsini); 
     1341            free (mc_extfs_ini); 
     1342            mc_extfs_ini = NULL; 
    13231343            return 0; 
    13241344        } 
    13251345        if (*key == '#' || *key == '\n') 
    static int extfs_init (struct vfs_class *me) 
    13391359        extfs_prefixes [extfs_no++] = g_strdup (key); 
    13401360    } 
    13411361    fclose(cfg); 
    1342     g_free (mc_extfsini); 
     1362    free (mc_extfs_ini); 
     1363    mc_extfs_ini = NULL; 
    13431364    return 1; 
    13441365} 
    13451366 
  • vfs/extfs/Makefile.am

    diff --git a/vfs/extfs/Makefile.am b/vfs/extfs/Makefile.am
    index e7efbe4..e4149df 100644
    a b  
    11extfsdir = $(pkgdatadir)/extfs 
     2extfsconfdir = $(sysconfdir)/mc 
     3 
     4# Extfs config files 
     5EXTFS_CONF  = extfs.ini sfs.ini 
    26 
    37# Files to install and distribute other than extfs scripts 
    4 EXTFS_MISC  = README extfs.ini sfs.ini 
     8EXTFS_MISC  = README 
    59 
    610# Scripts hat don't need adaptation to the local system 
    711EXTFS_CONST = bpp rpm trpm u7z 
    EXTFS_OUT = \ 
    5761if USE_VFS 
    5862extfs_DATA = $(EXTFS_MISC) 
    5963extfs_SCRIPTS = $(EXTFS_CONST) $(EXTFS_OUT) 
     64extfsconf_DATA = $(EXTFS_CONF) 
    6065endif 
    6166 
    6267EXTRA_DIST = $(EXTFS_MISC) $(EXTFS_CONST) 
  • vfs/ftpfs.c

    diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c
    index 43d363c..a3a511b 100644
    a b What to do with this? 
    7373#include "../src/tty.h"         /* enable/disable interrupt key */ 
    7474#include "../src/wtools.h"      /* message() */ 
    7575#include "../src/main.h"        /* print_vfs_message */ 
     76#include "../src/mc_conf.h"     /* MC global configuration */ 
    7677#include "utilvfs.h" 
    7778#include "xdirentry.h" 
    7879#include "vfs.h" 
    ftpfs_load_no_proxy_list (void) 
    554555    if (mc_file) 
    555556        return; 
    556557 
    557     mc_file = concat_dir_and_file (mc_home, "mc.no_proxy"); 
     558    mc_file = _strcatdup(mc_global_confdir, "mc.no_proxy"); 
    558559    if (exist_file (mc_file) && 
    559560        (npf = fopen (mc_file, "r"))) { 
    560561        while (fgets (s, sizeof (s), npf)) { 
  • vfs/sfs.c

    diff --git a/vfs/sfs.c b/vfs/sfs.c
    index f4989ca..cac218a 100644
    a b  
    3838#include "../src/tty.h"         /* enable/disable interrupt key */ 
    3939#include "../src/wtools.h"      /* message() */ 
    4040#include "../src/main.h"        /* print_vfs_message */ 
     41#include "../src/mc_conf.h"     /* MC global configuration */ 
    4142#include "utilvfs.h" 
    4243#include "vfs.h" 
    4344#include "vfs-impl.h" 
    sfs_ungetlocalcopy (struct vfs_class *me, const char *path, 
    330331 
    331332static int sfs_init (struct vfs_class *me) 
    332333{ 
    333     char *mc_sfsini; 
     334    char *mc_sfs_ini; 
    334335    FILE *cfg; 
    335336    char key[256]; 
    336337 
    337338    (void) me; 
    338339 
    339     mc_sfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "sfs.ini"); 
    340     cfg = fopen (mc_sfsini, "r"); 
     340    /* first try to use user's config file, then fallback to global one */ 
     341    mc_sfs_ini = _strcatdup(mc_user_confdir, PATH_SEP_STR "sfs.ini"); 
     342    if (!exist_file(mc_sfs_ini)) 
     343    { 
     344        free(mc_sfs_ini); 
     345        mc_sfs_ini = _strcatdup(mc_global_confdir, PATH_SEP_STR "sfs.ini"); 
     346    } 
    341347 
    342     if (!cfg){ 
    343         fprintf (stderr, _("Warning: file %s not found\n"), mc_sfsini); 
    344         g_free (mc_sfsini); 
     348    if ((cfg=fopen(mc_sfs_ini, "r"))==NULL) { 
     349        fprintf (stderr, _("Warning: file %s not found\n"), mc_sfs_ini); 
     350        free (mc_sfs_ini); 
    345351        return 0; 
    346352    } 
    347     g_free (mc_sfsini); 
     353    free (mc_sfs_ini); 
    348354 
    349355    sfs_no = 0; 
    350356    while (sfs_no < MAXFS && fgets (key, sizeof (key), cfg)) {