Merge branch 'master' of ssh://styx@midnight-commander.org:22/git/mc
Этот коммит содержится в:
Коммит
ae517852b0
@ -7,19 +7,15 @@
|
||||
v v v mqv v v v mqu v v mj
|
||||
qqqqqqCommanderqj
|
||||
|
||||
Ésta es la pantalla de inicio de la ayuda de
|
||||
GNU Midnight Commander.
|
||||
Ésta es la pantalla de inicio de la ayuda de GNU Midnight Commander.
|
||||
|
||||
Puede pulsar la tecla IntroHow to use help para aprender a navegar por el
|
||||
sistema de ayuda, o acceder directamente a los contenidosContents.
|
||||
Puede pulsar la tecla IntroHow to use help para aprender a navegar por el sistema de ayuda, o acceder directamente a los contenidosContents.
|
||||
|
||||
GNU Midnight Commander es obra de sus numerosos autoresAUTHORS.
|
||||
|
||||
GNU Midnight Commander NO INCLUYE NINGÚN TIPO DE GARANTÍAWarranty,
|
||||
es software libre, y se alienta su redistribución en los
|
||||
terminos y condiciones que están contenidos en la Licencia
|
||||
Pública General de GNU (GPL)Licencia GNU, de la que existe una
|
||||
traducción no oficial al españolLicencia GNU (Español).[Licencia GNU]
|
||||
GNU Midnight Commander NO INCLUYE NINGÚN TIPO DE GARANTÍAWarranty, es software libre, y se alienta su redistribución en los terminos y condiciones que están contenidos en la Licencia Pública General de GNU (GPL)Licencia GNU, de la que existe una traducción no oficial al españolLicencia GNU (Español).
|
||||
|
||||
[Licencia GNU]
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
@ -880,32 +876,22 @@ General de GNU para Bibliotecas en lugar de esta Licencia.
|
||||
[QueryBox]
|
||||
Cuadros de diálogo
|
||||
|
||||
En los cuadros de diálogo puede desplazarse con el teclado
|
||||
usando las flechas o las teclas de las letras resaltadas.
|
||||
En los cuadros de diálogo puede desplazarse con el teclado usando las flechas o las teclas de las letras resaltadas.
|
||||
|
||||
También se pueden pulsar los botones con el ratón.
|
||||
|
||||
[How to use help]
|
||||
Uso de la ayuda
|
||||
|
||||
Se pueden utilizar las flechas o el ratón para navegar
|
||||
por el sistema de ayuda.
|
||||
Se pueden utilizar las flechas o el ratón para navegar por el sistema de ayuda.
|
||||
|
||||
La flecha de abajo cambia al siguiente elemento o baja.
|
||||
La tecla de arriba vuelve al elemento anterior o sube.
|
||||
La tecla derecha sigue el enlace activo.
|
||||
La tecla izquierda vuelve a la última página visitada.
|
||||
La flecha de abajo cambia al siguiente elemento o baja. La tecla de arriba vuelve al elemento anterior o sube. La tecla derecha sigue el enlace activo. La tecla izquierda vuelve a la última página visitada.
|
||||
|
||||
Si el terminal no es compatible con las flechas de cursor
|
||||
se puede avanzar con la barra espaciadora y retroceder con
|
||||
la tecla b (back). El tabulador activa el elemento siguiente y
|
||||
con INTRO se puede entrar al enlace correspondiente.
|
||||
La tecla l (last) permite volver a la última página.
|
||||
Si el terminal no es compatible con las flechas de cursor se puede avanzar con la barra espaciadora y retroceder con la tecla b (back). El tabulador activa el elemento siguiente y con INTRO se puede entrar al enlace correspondiente. La tecla l (last) permite volver a la última página.
|
||||
|
||||
ESC pulsada dos veces permite salir de la ayuda.
|
||||
|
||||
El botón izquierdo del ratón avanza o sigue enlaces y el
|
||||
botón derecho retrocede o vuelve a la última página.
|
||||
El botón izquierdo del ratón avanza o sigue enlaces y el botón derecho retrocede o vuelve a la última página.
|
||||
|
||||
La función de todas las teclas en la ayuda:
|
||||
|
||||
|
@ -8,15 +8,11 @@
|
||||
|
||||
Ez a GNU Midnight Commander súgója.
|
||||
|
||||
Az interaktív súgó használatának megismeréséhez csak üss
|
||||
egy entertHow to use help. Itt közvetlenül a súgó tartalomjegyzékébeContents
|
||||
juthatsz.
|
||||
Az interaktív súgó használatának megismeréséhez csak üss egy entertHow to use help. Itt közvetlenül a súgó tartalomjegyzékébeContents juthatsz.
|
||||
|
||||
A Midnight Commander-t a következő szerzőkAUTHORS készítették.
|
||||
|
||||
A Midnight Commander mindenféle garanciaWarranty nélkül kerül
|
||||
kiadásra. Ez szabad szoftver, így továbbadhatod azt a
|
||||
Felhasználási engedélybenLicense meghatározott feltételekkel.
|
||||
A Midnight Commander mindenféle garanciaWarranty nélkül kerül kiadásra. Ez szabad szoftver, így továbbadhatod azt a Felhasználási engedélybenLicense meghatározott feltételekkel.
|
||||
|
||||
[License]
|
||||
Engedélyek
|
||||
@ -438,34 +434,16 @@ Library General Public License instead of this License.
|
||||
[QueryBox]
|
||||
Lekérdező box
|
||||
|
||||
A lekérdező boxban kezeléséhez a nyíl billentyűket, a
|
||||
szövegrész elejének magadásást, vagy a gombokra történő
|
||||
egérkattintást használhatod.
|
||||
A lekérdező boxban kezeléséhez a nyíl billentyűket, a szövegrész elejének magadásást, vagy a gombokra történő egérkattintást használhatod.
|
||||
|
||||
[How to use help]
|
||||
Hogyan használjuk a súgót
|
||||
|
||||
A súgóban a navigációhoz a billentyűzet gombjait és az
|
||||
egér gombjait is használhatod. A lefelé mutató nyíl
|
||||
lenyomására a következő bejegyzésre ugorhatsz, vagy
|
||||
legördítheted azt. A felfelé mutató nyíl lenyomására
|
||||
ez előző bejegyzésre ugorhatsz, vagy felhúzhatod azt.
|
||||
A jobbra mutató nyíl lenyomására a linknek megfelelő
|
||||
címre lép. A balra mutató nyíl lenyomására az előzőleg
|
||||
meglátogatott címre lépsz vissza.
|
||||
A súgóban a navigációhoz a billentyűzet gombjait és az egér gombjait is használhatod. A lefelé mutató nyíl lenyomására a következő bejegyzésre ugorhatsz, vagy legördítheted azt. A felfelé mutató nyíl lenyomására ez előző bejegyzésre ugorhatsz, vagy felhúzhatod azt. A jobbra mutató nyíl lenyomására a linknek megfelelő címre lép. A balra mutató nyíl lenyomására az előzőleg meglátogatott címre lépsz vissza.
|
||||
|
||||
Ha az általad használt terminál nem támogatja a kurzor
|
||||
gombok használatát, használd a szóköz billentyűt az
|
||||
előre lépésre, a 'b' gombot a visszalépésre. Használd a
|
||||
TAB gombot a következő bejegyzésre való ugráshoz és az
|
||||
ENTER-t a jelenlegi link által megadott címre történő
|
||||
lépéshez. Az 'l' (last=utolsó) gombot az előzőleg
|
||||
látogatott oldalra való visszalépésre használhatod. Az
|
||||
ESC lenyomásával kiléphetsz a Súgóból.
|
||||
Ha az általad használt terminál nem támogatja a kurzor gombok használatát, használd a szóköz billentyűt az előre lépésre, a 'b' gombot a visszalépésre. Használd a TAB gombot a következő bejegyzésre való ugráshoz és az ENTER-t a jelenlegi link által megadott címre történő lépéshez. Az 'l' (last=utolsó) gombot az előzőleg látogatott oldalra való visszalépésre használhatod. Az ESC lenyomásával kiléphetsz a Súgóból.
|
||||
|
||||
A bal egérgomb lenyomásával követheted a linket, vagy
|
||||
gördíthetsz. A jobb gomb lenyomásával visszatérhetsz az
|
||||
előzőleg látogatott pontra.
|
||||
A bal egérgomb lenyomásával követheted a linket, vagy gördíthetsz. A jobb gomb lenyomásával visszatérhetsz az előzőleg látogatott pontra.
|
||||
|
||||
A Súgóban használható összes gomb listája:
|
||||
|
||||
|
@ -7,18 +7,15 @@
|
||||
v v v mqv v v v mqu v v mj
|
||||
qqqqqqCommanderqj
|
||||
|
||||
Questa è la principale schermata della guida interattiva
|
||||
del GNU Midnight Commander.
|
||||
Questa è la principale schermata della guida interattiva del GNU Midnight Commander.
|
||||
|
||||
Per saperne di più su come usare la guida interattiva, premere
|
||||
semplicemente invioHow to use help. Se lo si desidera, è possibile
|
||||
consultare direttamente il sommarioContents della guida.
|
||||
Per saperne di più su come usare la guida interattiva, premere semplicemente invioHow to use help. Se lo si desidera, è possibile consultare direttamente il sommarioContents della guida.
|
||||
|
||||
Il Midnight Commander è stato scritto dai suoi autoriAUTHORS.
|
||||
|
||||
Il Midnight Commander NON E' COPERTO DA ALCUNA GARANZIAWarranty.
|
||||
Questo è software libero, lo si può ridistribuire sotto
|
||||
certe condizioniLicenza.[Licenza]
|
||||
Il Midnight Commander NON E' COPERTO DA ALCUNA GARANZIAWarranty. Questo è software libero, lo si può ridistribuire sotto certe condizioniLicenza.
|
||||
|
||||
[Licenza]
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
@ -432,38 +429,18 @@ Library General Public License instead of this License.
|
||||
[QueryBox]
|
||||
Finestre di dialogo di richiesta dati
|
||||
|
||||
Nelle finestre di dialogo di richiesta dati è possibile
|
||||
usare i tasti freccia o la prima lettera per selezionare
|
||||
una voce o cliccare con il mouse sul bottone.
|
||||
Nelle finestre di dialogo di richiesta dati è possibile usare i tasti freccia o la prima lettera per selezionare una voce o cliccare con il mouse sul bottone.
|
||||
|
||||
[How to use help]
|
||||
Come usare la guida interattiva
|
||||
|
||||
Usare i tasti del cursore o il mouse per navigare
|
||||
nel visualizzatore della guida.
|
||||
Usare i tasti del cursore o il mouse per navigare nel visualizzatore della guida.
|
||||
|
||||
Premere freccia in giù per spostarsi alla voce
|
||||
successiva o per spostarsi in basso.
|
||||
Premere freccia in su per spostarsi alla voce
|
||||
precedente o per spostarsi in alto.
|
||||
Premere freccia a destra per seguire il collegamento
|
||||
corrente.
|
||||
Premere freccia a sinistra per tornare indietro nello
|
||||
storico dei nodi visitati.
|
||||
Premere freccia in giù per spostarsi alla voce successiva o per spostarsi in basso. Premere freccia in su per spostarsi alla voce precedente o per spostarsi in alto. Premere freccia a destra per seguire il collegamento corrente. Premere freccia a sinistra per tornare indietro nello storico dei nodi visitati.
|
||||
|
||||
Se il terminale non supporta i tasti del cursore si può
|
||||
usare la barra spaziatrice per spostarsi in avanti
|
||||
ed il tasto 'b' per tornare indietro. Usare il tasto
|
||||
TAB per spostarsi sulla prossima voce e premere
|
||||
INVIO per seguire il collegamento corrente. Usare il
|
||||
tasto 'l' per tornare indietro nello storico dei nodi
|
||||
visitati.
|
||||
Premere ESC per uscire dal visualizzatore della guida.
|
||||
Se il terminale non supporta i tasti del cursore si può usare la barra spaziatrice per spostarsi in avanti ed il tasto 'b' per tornare indietro. Usare il tasto TAB per spostarsi sulla prossima voce e premere INVIO per seguire il collegamento corrente. Usare il tasto 'l' per tornare indietro nello storico dei nodi visitati. Premere ESC per uscire dal visualizzatore della guida.
|
||||
|
||||
Il tasto sinistro del mouse segue il collegamento
|
||||
o sfoglia le pagine.
|
||||
Il tasto destro del mouse torna indietro nello storico
|
||||
dei nodi visitati.
|
||||
Il tasto sinistro del mouse segue il collegamento o sfoglia le pagine. Il tasto destro del mouse torna indietro nello storico dei nodi visitati.
|
||||
|
||||
Elenco completo dei tasti del visualizzatore della guida:
|
||||
|
||||
|
@ -9,17 +9,13 @@
|
||||
|
||||
Główny ekran pomocy programu GNU Midnight Commander.
|
||||
|
||||
Aby dowiedzieć się, jak używać interaktywnej pomocy,
|
||||
należy nacisnąć klawisz EnterHow to use help. Można też
|
||||
przejść bezpośrednio do spisu treściContents.
|
||||
Aby dowiedzieć się, jak używać interaktywnej pomocy, należy nacisnąć klawisz EnterHow to use help. Można też przejść bezpośrednio do spisu treściContents.
|
||||
|
||||
Program GNU Midnight Commander został napisany przez jego
|
||||
autorówAUTHORS.
|
||||
Program GNU Midnight Commander został napisany przez jego autorówAUTHORS.
|
||||
|
||||
Program GNU Midnight Commander jest dostarczany BEZ
|
||||
JAKIEJKOLWIEK GWARANCJIWarranty. Niniejszy program jest
|
||||
wolnym oprogramowaniem; można go rozprowadzać dalej na
|
||||
warunkach GNU General Public LicenseLicense.[License]
|
||||
Program GNU Midnight Commander jest dostarczany BEZ JAKIEJKOLWIEK GWARANCJIWarranty. Niniejszy program jest wolnym oprogramowaniem; można go rozprowadzać dalej na warunkach GNU General Public LicenseLicense.
|
||||
|
||||
[License]
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
@ -433,32 +429,16 @@ Library General Public License instead of this License.
|
||||
[QueryBox]
|
||||
Okna zapytań
|
||||
|
||||
W oknach dialogowych zapytań można używać klawiszy
|
||||
strzałek lub pierwszych liter, aby wybrać element albo
|
||||
kliknąć na przycisku.
|
||||
W oknach dialogowych zapytań można używać klawiszy strzałek lub pierwszych liter, aby wybrać element albo kliknąć na przycisku.
|
||||
|
||||
[How to use help]
|
||||
Jak używać pomocy
|
||||
|
||||
Do obsługi przeglądarki można używać klawiszy kursora lub
|
||||
myszy. Naciśnięcie strzałki w dół przeniesie do następnego
|
||||
elementu lub przewinie w dół. Naciśnięcie strzałki w górę
|
||||
przeniesie do poprzedniego elementu lub przewinie w górę,
|
||||
Naciśnięcie strzałki w prawo podąży za zaznaczonym
|
||||
odnośnikiem. Naciśnięcie strzałki w lewo powróci do
|
||||
poprzednio odwiedzonego węzła.
|
||||
Do obsługi przeglądarki można używać klawiszy kursora lub myszy. Naciśnięcie strzałki w dół przeniesie do następnego elementu lub przewinie w dół. Naciśnięcie strzałki w górę przeniesie do poprzedniego elementu lub przewinie w górę, Naciśnięcie strzałki w prawo podąży za zaznaczonym odnośnikiem. Naciśnięcie strzałki w lewo powróci do poprzednio odwiedzonego węzła.
|
||||
|
||||
Jeśli terminal nie obsługuje klawiszy kursora, można używać
|
||||
spacji do przewijania do przodu i klawisz B, aby przewijać
|
||||
do tyłu. Można używać klawisza Tab, aby przechodzić do
|
||||
następnego elementu i klawisza Enter, aby podążyć za
|
||||
zaznaczonym odnośnikiem. Klawisz L może być używany do
|
||||
przechodzenia do poprzednio odwiedzonego węzła.
|
||||
Naciśnięcie klawisza Esc zakończy przeglądarkę pomocy.
|
||||
Jeśli terminal nie obsługuje klawiszy kursora, można używać spacji do przewijania do przodu i klawisz B, aby przewijać do tyłu. Można używać klawisza Tab, aby przechodzić do następnego elementu i klawisza Enter, aby podążyć za zaznaczonym odnośnikiem. Klawisz L może być używany do przechodzenia do poprzednio odwiedzonego węzła. Naciśnięcie klawisza Esc zakończy przeglądarkę pomocy.
|
||||
|
||||
Lewy przycisk myszy podąży za odnośnikiem lub przewinie
|
||||
ekran. Prawy przycisk myszy może być używany, aby
|
||||
przechodzić do poprzednio odwiedzonego węzła.
|
||||
Lewy przycisk myszy podąży za odnośnikiem lub przewinie ekran. Prawy przycisk myszy może być używany, aby przechodzić do poprzednio odwiedzonego węzła.
|
||||
|
||||
Pełna lista klawiszy przeglądarki pomocy:
|
||||
|
||||
|
@ -6,19 +6,15 @@
|
||||
v v v mqv v v v mqu v v mj
|
||||
qqqqqqCommanderqj
|
||||
|
||||
Вы сейчас видите главное окно интерактивной подсказки
|
||||
программы GNU Midnight Commander.
|
||||
Вы сейчас видите главное окно интерактивной подсказки программы GNU Midnight Commander.
|
||||
|
||||
Чтобы узнать, как пользоваться подсказкой, нажмите клавишу
|
||||
EnterHow to use help, иначе переходите к перечню разделовContents подсказки.
|
||||
Чтобы узнать, как пользоваться подсказкой, нажмите клавишу EnterHow to use help, иначе переходите к перечню разделовContents подсказки.
|
||||
|
||||
Программа Midnight Commander поставляется АБСОЛЮТНО БЕЗ
|
||||
ВСЯКИХ ГАРАНТИЙГарантия. Это свободно распространяемое программное
|
||||
обеспечение, созданное группой авторовAUTHORS. Вы можете передавать
|
||||
его другим при условии соблюдения требований лицензии GNUЛицензия (оригинал на английском)
|
||||
(прочитайте неофициальный переводЛицензия этой лицензии).
|
||||
Программа Midnight Commander поставляется АБСОЛЮТНО БЕЗ ВСЯКИХ ГАРАНТИЙГарантия. Это свободно распространяемое программное обеспечение, созданное группой авторовAUTHORS. Вы можете передавать его другим при условии соблюдения требований лицензии GNUЛицензия (оригинал на английском) (прочитайте неофициальный переводЛицензия этой лицензии).
|
||||
|
||||
Русский перевод текста подсказки - Костромин В.А., 1999 г.[Лицензия (оригинал на английском)]
|
||||
Русский перевод текста подсказки - Костромин В.А., 1999 г.
|
||||
|
||||
[Лицензия (оригинал на английском)]
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
@ -843,50 +839,21 @@ Gnomovision поставляется АБСОЛЮТНО БЕЗ КАКИХ-ЛИБ
|
||||
[QueryBox]
|
||||
Диалоговые окна запросов
|
||||
|
||||
В окнах запросов для выбора какого-либо варианта ответа
|
||||
(которые обычно задаются в виде экранных кнопок) Вы можете
|
||||
использовать либо клавиши со стрелками, либо выбрать ответ
|
||||
путем нажатия клавиши с выделенной в названии кнопки
|
||||
буквой, либо щелкнув по нужной кнопке мышкой.
|
||||
В окнах запросов для выбора какого-либо варианта ответа (которые обычно задаются в виде экранных кнопок) Вы можете использовать либо клавиши со стрелками, либо выбрать ответ путем нажатия клавиши с выделенной в названии кнопки буквой, либо щелкнув по нужной кнопке мышкой.
|
||||
|
||||
|
||||
[How to use help]
|
||||
Как пользоваться помощью
|
||||
|
||||
При работе с программой Midnight Commander практически в
|
||||
любой момент можно обратиться к интерактивной подсказке,
|
||||
вызов которой осуществляется нажатием клавиши F1. Для
|
||||
перемещения в окне просмотра подсказки Вы можете
|
||||
использовать клавиши перемещения курсора (стрелки) или
|
||||
мышь. Стрелка вниз вызывает переход к следующей ссылке
|
||||
(выделены голубым фоном) или сдвиг текста на одну строку
|
||||
вверх. Стрелка вверх вызывает переход к предыдущей ссылке
|
||||
или сдвиг текста на одну строку вверх. Стрелка вправо
|
||||
вызывает переход по ссылке, которая в данный момент
|
||||
выделена синим фоном (текущая ссылка). По стрелке влево
|
||||
происходит переход к ранее просмотренным разделам
|
||||
подсказки.
|
||||
При работе с программой Midnight Commander практически в любой момент можно обратиться к интерактивной подсказке, вызов которой осуществляется нажатием клавиши F1. Для перемещения в окне просмотра подсказки Вы можете использовать клавиши перемещения курсора (стрелки) или мышь. Стрелка вниз вызывает переход к следующей ссылке (выделены голубым фоном) или сдвиг текста на одну строку вверх. Стрелка вверх вызывает переход к предыдущей ссылке или сдвиг текста на одну строку вверх. Стрелка вправо вызывает переход по ссылке, которая в данный момент выделена синим фоном (текущая ссылка). По стрелке влево происходит переход к ранее просмотренным разделам подсказки.
|
||||
|
||||
Если Ваш терминал не поддерживает клавиши-стрелки, Вы
|
||||
можете использовать клавишу пробела для перехода к
|
||||
следующей странице подсказки и клавишу 'b' для перехода к
|
||||
предыдущей странице. Клавиша TAB вызывает переход к
|
||||
следующей ссылке, а нажатие ENTER - переход по текущей
|
||||
ссылке. При просмотре подсказки программа запоминает
|
||||
последовательность переходов по ссылкам и позволяет
|
||||
вернуться к ранее просмотренным разделам, воспользовавшись
|
||||
клавишей 'l' (last). Нажатие на ESC вызывает выход из окна
|
||||
подсказки.
|
||||
Если Ваш терминал не поддерживает клавиши-стрелки, Вы можете использовать клавишу пробела для перехода к следующей странице подсказки и клавишу 'b' для перехода к предыдущей странице. Клавиша TAB вызывает переход к следующей ссылке, а нажатие ENTER - переход по текущей ссылке. При просмотре подсказки программа запоминает последовательность переходов по ссылкам и позволяет вернуться к ранее просмотренным разделам, воспользовавшись клавишей 'l' (last). Нажатие на ESC вызывает выход из окна подсказки.
|
||||
|
||||
По щелчку левой клавиши мыши происходит переход по ссылке
|
||||
или перемещение по тексту подсказки. Щелчок правой кнопкой
|
||||
мыши используется для переход к ранее просмотренным
|
||||
разделам.
|
||||
По щелчку левой клавиши мыши происходит переход по ссылке или перемещение по тексту подсказки. Щелчок правой кнопкой мыши используется для переход к ранее просмотренным разделам.
|
||||
|
||||
Полный список управляющих комбинаций для окна просмотра
|
||||
подсказки:
|
||||
Полный список управляющих комбинаций для окна просмотра подсказки:
|
||||
|
||||
Работают все клавиши управления перемещениемGeneral Movement Keys.
|
||||
Работают все клавиши управления перемещениемGeneral Movement Keys.
|
||||
|
||||
tab Переход на следующую ссылку.
|
||||
M-tab Переход на предыдущую ссылку.
|
||||
|
@ -10,20 +10,14 @@
|
||||
|
||||
Ово је главни екран помоћи за ГНУ-овог поноћног наредника.
|
||||
|
||||
Да бисте сазнали више о томе како да користите интерактивни
|
||||
систем помоћи потребно је да притиснете EnterHow to use help.
|
||||
Можете и одмах отићи на садржајContents помоћи.
|
||||
Да бисте сазнали више о томе како да користите интерактивни систем помоћи потребно је да притиснете EnterHow to use help. Можете и одмах отићи на садржајContents помоћи.
|
||||
|
||||
ГНУ-овог поноћног наредника су написали његови ауториAUTHORS.
|
||||
|
||||
ГНУ-ов поноћни наредник се испоручује БЕЗ ИКАКВЕ ГАРАНЦИЈЕWarranty.
|
||||
Ово је слободни софтвер, а ви сте позвани да га
|
||||
расподелите под одредбама ГНУ-ове опште јавне лиценцеЛиценца (оригинал на енглеском).
|
||||
Погледајте и незваничан превод ГНУ-ове ОЈЛ на српскиЛиценца (на српском).
|
||||
ГНУ-ов поноћни наредник се испоручује БЕЗ ИКАКВЕ ГАРАНЦИЈЕWarranty. Ово је слободни софтвер, а ви сте позвани да га расподелите под одредбама ГНУ-ове опште јавне лиценцеЛиценца (оригинал на енглеском). Погледајте и незваничан превод ГНУ-ове ОЈЛ на српскиЛиценца (на српском).
|
||||
|
||||
Превод Поноћног наредника и ове датотеке помоћи на српски: Страхиња Радић, <mr99164@alas.matf.bg.ac.yu> СРД `Уликс', http://uliks.sourceforge.net
|
||||
|
||||
Превод Поноћног наредника и ове датотеке помоћи на српски:
|
||||
Страхиња Радић, <mr99164@alas.matf.bg.ac.yu>
|
||||
СРД `Уликс', http://uliks.sourceforge.net
|
||||
[Лиценца (оригинал на енглеском)]
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
@ -883,35 +877,16 @@ Library General Public License instead of this License.
|
||||
[QueryBox]
|
||||
Прозори упита
|
||||
|
||||
У дијалозима упита можете да користите тастере са
|
||||
стрелицама или прво слово да бисте изабрали ставку или
|
||||
можете да притиснете дугме миша када се показивач налази
|
||||
изнад дугмета на екрану.
|
||||
У дијалозима упита можете да користите тастере са стрелицама или прво слово да бисте изабрали ставку или можете да притиснете дугме миша када се показивач налази изнад дугмета на екрану.
|
||||
|
||||
[How to use help]
|
||||
Како користити помоћ
|
||||
|
||||
Можете да користите курсорске тастере да бисте се кретали
|
||||
у оквиру прегледача помоћи. Притисните стрелицу надоле
|
||||
да бисте се померили на следећу ставку или клизали надоле.
|
||||
Притисните стрелицу нагоре да бисте се померили на
|
||||
претходну ставку или клизали нагоре. Притисните стрелицу
|
||||
надесно да бисте пратили текућу везу. Притисните
|
||||
стрелицу налево да бисте се вратили уназад у оквиру
|
||||
историје посећених чворова.
|
||||
Можете да користите курсорске тастере да бисте се кретали у оквиру прегледача помоћи. Притисните стрелицу надоле да бисте се померили на следећу ставку или клизали надоле. Притисните стрелицу нагоре да бисте се померили на претходну ставку или клизали нагоре. Притисните стрелицу надесно да бисте пратили текућу везу. Притисните стрелицу налево да бисте се вратили уназад у оквиру историје посећених чворова.
|
||||
|
||||
Ако ваш терминал не подржава курсорске тастере, можете да
|
||||
користите размакницу да бисте клизали унапред и b
|
||||
(латинично б) да бисте клизали уназад. Користите тастер
|
||||
TAB да бисте прешли на следећу ставку а ENTER да
|
||||
бисте пратили текућу везу. Тастер l (латинично л) се
|
||||
може користити за враћање уназад у историји чворова које
|
||||
сте посетили. Притисните тастер ESC да бисте изашли из
|
||||
прегледача помоћи.
|
||||
Ако ваш терминал не подржава курсорске тастере, можете да користите размакницу да бисте клизали унапред и b (латинично б) да бисте клизали уназад. Користите тастер TAB да бисте прешли на следећу ставку а ENTER да бисте пратили текућу везу. Тастер l (латинично л) се може користити за враћање уназад у историји чворова које сте посетили. Притисните тастер ESC да бисте изашли из прегледача помоћи.
|
||||
|
||||
Притиском на лево дугме миша ћете пратити везу или
|
||||
клизати. Притиском на десно дугме миша ћете се враћати
|
||||
уназад у историји чворова.
|
||||
Притиском на лево дугме миша ћете пратити везу или клизати. Притиском на десно дугме миша ћете се враћати уназад у историји чворова.
|
||||
|
||||
Потпун списак тастера прегледача помоћи:
|
||||
|
||||
|
@ -9,15 +9,13 @@
|
||||
|
||||
This is the main help screen for GNU Midnight Commander.
|
||||
|
||||
To learn more on how to use the interactive help facility
|
||||
just press EnterHow to use help. You may want to go directly to the help
|
||||
contentsContents.
|
||||
To learn more on how to use the interactive help facility just press EnterHow to use help. You may want to go directly to the help contentsContents.
|
||||
|
||||
GNU Midnight Commander is written by its authorsAUTHORS.
|
||||
|
||||
GNU Midnight Commander comes with ABSOLUTELY NO WARRANTYWarranty.
|
||||
This is free software, and you are welcome to redistribute
|
||||
it under terms of GNU General Public LicenseLicense.[License]
|
||||
GNU Midnight Commander comes with ABSOLUTELY NO WARRANTYWarranty. This is free software, and you are welcome to redistribute it under terms of GNU General Public LicenseLicense.
|
||||
|
||||
[License]
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
@ -431,30 +429,16 @@ Library General Public License instead of this License.
|
||||
[QueryBox]
|
||||
Query boxes
|
||||
|
||||
In the query dialog box you can use the arrow keys or the
|
||||
first letter to select an item or click with the mouse on
|
||||
the button.
|
||||
In the query dialog box you can use the arrow keys or the first letter to select an item or click with the mouse on the button.
|
||||
|
||||
[How to use help]
|
||||
How to use help
|
||||
|
||||
You can use the cursor keys or mouse to navigate in the
|
||||
help viewer. Press down arrow to move to the next item or
|
||||
scroll down. Press up arrow to move to the previous item
|
||||
or scroll up. Press right arrow to follow the current
|
||||
link. Press left arrow to go back in the history of nodes
|
||||
that you have visited.
|
||||
You can use the cursor keys or mouse to navigate in the help viewer. Press down arrow to move to the next item or scroll down. Press up arrow to move to the previous item or scroll up. Press right arrow to follow the current link. Press left arrow to go back in the history of nodes that you have visited.
|
||||
|
||||
If you terminal doesn't support the cursor keys you can
|
||||
use the space bar to scroll forward and the b (back) key
|
||||
scroll back. Use the TAB key to move to the next item and
|
||||
press ENTER to follow the current link. The l (last) key
|
||||
can be used to go back in the history of nodes you have
|
||||
visited. Press ESC to exit the help viewer.
|
||||
If you terminal doesn't support the cursor keys you can use the space bar to scroll forward and the b (back) key scroll back. Use the TAB key to move to the next item and press ENTER to follow the current link. The l (last) key can be used to go back in the history of nodes you have visited. Press ESC to exit the help viewer.
|
||||
|
||||
The left mouse button will follow the link or scroll. The
|
||||
right mouse button can be used to go back in the history
|
||||
of nodes.
|
||||
The left mouse button will follow the link or scroll. The right mouse button can be used to go back in the history of nodes.
|
||||
|
||||
The full key list of the help viewer:
|
||||
|
||||
|
@ -44,8 +44,7 @@ mc_config_t *mc_panels_config;
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
static gboolean
|
||||
mc_config_new_or_override_file (mc_config_t * mc_config, const gchar * ini_path,
|
||||
GError **error)
|
||||
mc_config_new_or_override_file (mc_config_t * mc_config, const gchar * ini_path, GError ** error)
|
||||
{
|
||||
gchar *data, *written_data;
|
||||
gsize len, total_written;
|
||||
@ -54,7 +53,8 @@ mc_config_new_or_override_file (mc_config_t * mc_config, const gchar * ini_path,
|
||||
ssize_t cur_written;
|
||||
|
||||
data = g_key_file_to_data (mc_config->handle, &len, NULL);
|
||||
if (!exist_file (ini_path)) {
|
||||
if (!exist_file (ini_path))
|
||||
{
|
||||
ret = g_file_set_contents (ini_path, data, len, error);
|
||||
g_free (data);
|
||||
return ret;
|
||||
@ -62,9 +62,12 @@ mc_config_new_or_override_file (mc_config_t * mc_config, const gchar * ini_path,
|
||||
mc_util_make_backup_if_possible (ini_path, "~");
|
||||
|
||||
fd = mc_open (ini_path, O_WRONLY | O_TRUNC | O_SYNC, 0);
|
||||
if (fd == -1) {
|
||||
g_propagate_error (error, g_error_new (mc_main_error_quark() ,0, "%s", unix_error_string (errno)));
|
||||
g_free(data);
|
||||
if (fd == -1)
|
||||
{
|
||||
g_propagate_error (error,
|
||||
g_error_new (mc_main_error_quark (), 0, "%s",
|
||||
unix_error_string (errno)));
|
||||
g_free (data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -74,9 +77,12 @@ mc_config_new_or_override_file (mc_config_t * mc_config, const gchar * ini_path,
|
||||
mc_close (fd);
|
||||
g_free (data);
|
||||
|
||||
if (cur_written == -1) {
|
||||
if (cur_written == -1)
|
||||
{
|
||||
mc_util_restore_from_backup_if_possible (ini_path, "~");
|
||||
g_propagate_error (error, g_error_new (mc_main_error_quark() ,0, "%s", unix_error_string (errno)));
|
||||
g_propagate_error (error,
|
||||
g_error_new (mc_main_error_quark (), 0, "%s",
|
||||
unix_error_string (errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -100,15 +106,18 @@ mc_config_init (const gchar * ini_path)
|
||||
return NULL;
|
||||
|
||||
mc_config->handle = g_key_file_new ();
|
||||
if (mc_config->handle == NULL) {
|
||||
if (mc_config->handle == NULL)
|
||||
{
|
||||
g_free (mc_config);
|
||||
return NULL;
|
||||
}
|
||||
if (!ini_path || !exist_file (ini_path)) {
|
||||
if (!ini_path || !exist_file (ini_path))
|
||||
{
|
||||
return mc_config;
|
||||
}
|
||||
|
||||
if (!mc_stat (ini_path, &st) && st.st_size) {
|
||||
if (!mc_stat (ini_path, &st) && st.st_size)
|
||||
{
|
||||
/* file present and not empty */
|
||||
g_key_file_load_from_file (mc_config->handle, ini_path, G_KEY_FILE_KEEP_COMMENTS, NULL);
|
||||
}
|
||||
@ -195,7 +204,8 @@ mc_config_read_file (mc_config_t * mc_config, const gchar * ini_path)
|
||||
gchar **keys, **curr_key;
|
||||
gchar *value;
|
||||
|
||||
if (mc_config == NULL) {
|
||||
if (mc_config == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -206,11 +216,16 @@ mc_config_read_file (mc_config_t * mc_config, const gchar * ini_path)
|
||||
groups = mc_config_get_groups (tmp_config, NULL);
|
||||
|
||||
if (groups == NULL)
|
||||
{
|
||||
mc_config_deinit (tmp_config);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (curr_grp = groups; *curr_grp != NULL; curr_grp++) {
|
||||
for (curr_grp = groups; *curr_grp != NULL; curr_grp++)
|
||||
{
|
||||
keys = mc_config_get_keys (tmp_config, *curr_grp, NULL);
|
||||
for (curr_key = keys; *curr_key != NULL; curr_key++) {
|
||||
for (curr_key = keys; *curr_key != NULL; curr_key++)
|
||||
{
|
||||
value = g_key_file_get_value (tmp_config->handle, *curr_grp, *curr_key, NULL);
|
||||
if (value == NULL)
|
||||
continue;
|
||||
@ -228,9 +243,10 @@ mc_config_read_file (mc_config_t * mc_config, const gchar * ini_path)
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
gboolean
|
||||
mc_config_save_file (mc_config_t * mc_config, GError **error)
|
||||
mc_config_save_file (mc_config_t * mc_config, GError ** error)
|
||||
{
|
||||
if (mc_config == NULL || mc_config->ini_path == NULL) {
|
||||
if (mc_config == NULL || mc_config->ini_path == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return mc_config_new_or_override_file (mc_config, mc_config->ini_path, error);
|
||||
@ -239,10 +255,10 @@ mc_config_save_file (mc_config_t * mc_config, GError **error)
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
gboolean
|
||||
mc_config_save_to_file (mc_config_t * mc_config, const gchar * ini_path, GError **error)
|
||||
mc_config_save_to_file (mc_config_t * mc_config, const gchar * ini_path, GError ** error)
|
||||
{
|
||||
|
||||
if (mc_config == NULL) {
|
||||
if (mc_config == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return mc_config_new_or_override_file (mc_config, ini_path, error);
|
||||
|
@ -44,7 +44,8 @@
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
REPLACE_T_NO_TRANSFORM = 0,
|
||||
REPLACE_T_UPP_TRANSFORM_CHAR = 1,
|
||||
REPLACE_T_LOW_TRANSFORM_CHAR = 2,
|
||||
@ -81,18 +82,24 @@ mc_search__regex_str_append_if_special (GString * copy_to, GString * regex_str,
|
||||
|
||||
tmp_regex_str = &(regex_str->str[*offset]);
|
||||
|
||||
while (*spec_chr) {
|
||||
while (*spec_chr)
|
||||
{
|
||||
spec_chr_len = strlen (*spec_chr);
|
||||
if (!strncmp (tmp_regex_str, *spec_chr, spec_chr_len)) {
|
||||
if (!strutils_is_char_escaped (regex_str->str, tmp_regex_str)) {
|
||||
if (!strncmp ("\\x", *spec_chr, spec_chr_len)) {
|
||||
if (*(tmp_regex_str + spec_chr_len) == '{') {
|
||||
if (!strncmp (tmp_regex_str, *spec_chr, spec_chr_len))
|
||||
{
|
||||
if (!strutils_is_char_escaped (regex_str->str, tmp_regex_str))
|
||||
{
|
||||
if (!strncmp ("\\x", *spec_chr, spec_chr_len))
|
||||
{
|
||||
if (*(tmp_regex_str + spec_chr_len) == '{')
|
||||
{
|
||||
while ((spec_chr_len < regex_str->len - *offset)
|
||||
&& *(tmp_regex_str + spec_chr_len) != '}')
|
||||
spec_chr_len++;
|
||||
if (*(tmp_regex_str + spec_chr_len) == '}')
|
||||
spec_chr_len++;
|
||||
} else
|
||||
}
|
||||
else
|
||||
spec_chr_len += 2;
|
||||
}
|
||||
g_string_append_len (copy_to, tmp_regex_str, spec_chr_len);
|
||||
@ -118,16 +125,20 @@ mc_search__cond_struct_new_regex_hex_add (const char *charset, GString * str_to,
|
||||
upp = mc_search__toupper_case_str (charset, one_char, str_len);
|
||||
low = mc_search__tolower_case_str (charset, one_char, str_len);
|
||||
|
||||
for (loop = 0; loop < upp->len; loop++) {
|
||||
for (loop = 0; loop < upp->len; loop++)
|
||||
{
|
||||
|
||||
if (loop < low->len) {
|
||||
if (loop < low->len)
|
||||
{
|
||||
if (upp->str[loop] == low->str[loop])
|
||||
tmp_str = g_strdup_printf ("\\x%02X", (unsigned char) upp->str[loop]);
|
||||
else
|
||||
tmp_str =
|
||||
g_strdup_printf ("[\\x%02X\\x%02X]", (unsigned char) upp->str[loop],
|
||||
(unsigned char) low->str[loop]);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_str = g_strdup_printf ("\\x%02X", (unsigned char) upp->str[loop]);
|
||||
}
|
||||
g_string_append (str_to, tmp_str);
|
||||
@ -144,31 +155,34 @@ mc_search__cond_struct_new_regex_accum_append (const char *charset, GString * st
|
||||
GString * str_from)
|
||||
{
|
||||
GString *recoded_part;
|
||||
gsize loop = 0;
|
||||
|
||||
recoded_part = g_string_sized_new (32);
|
||||
|
||||
while (loop < str_from->len)
|
||||
{
|
||||
gchar *one_char;
|
||||
gsize loop;
|
||||
gsize one_char_len;
|
||||
gboolean just_letters;
|
||||
|
||||
loop = 0;
|
||||
recoded_part = g_string_new ("");
|
||||
|
||||
while (loop < str_from->len) {
|
||||
one_char =
|
||||
mc_search__get_one_symbol (charset, &(str_from->str[loop]),
|
||||
(str_from->len - loop > 6) ? 6 : str_from->len - loop,
|
||||
&just_letters);
|
||||
if (!strlen (one_char)) {
|
||||
min (str_from->len - loop, 6), &just_letters);
|
||||
one_char_len = strlen (one_char);
|
||||
|
||||
if (one_char_len == 0)
|
||||
loop++;
|
||||
continue;
|
||||
}
|
||||
if (just_letters) {
|
||||
else
|
||||
{
|
||||
loop += one_char_len;
|
||||
|
||||
if (just_letters)
|
||||
mc_search__cond_struct_new_regex_hex_add (charset, recoded_part, one_char,
|
||||
strlen (one_char));
|
||||
} else {
|
||||
g_string_append (recoded_part, one_char);
|
||||
one_char_len);
|
||||
else
|
||||
g_string_append_len (recoded_part, one_char, one_char_len);
|
||||
}
|
||||
loop += strlen (one_char);
|
||||
if (!strlen (one_char))
|
||||
loop++;
|
||||
|
||||
g_free (one_char);
|
||||
}
|
||||
|
||||
@ -193,20 +207,23 @@ mc_search__cond_struct_new_regex_ci_str (const char *charset, const char *str, g
|
||||
spec_char = g_string_new ("");
|
||||
loop = 0;
|
||||
|
||||
while (loop <= str_len) {
|
||||
if (mc_search__regex_str_append_if_special (spec_char, tmp, &loop)) {
|
||||
while (loop <= str_len)
|
||||
{
|
||||
if (mc_search__regex_str_append_if_special (spec_char, tmp, &loop))
|
||||
{
|
||||
mc_search__cond_struct_new_regex_accum_append (charset, ret_str, accumulator);
|
||||
g_string_append_len (ret_str, spec_char->str, spec_char->len);
|
||||
g_string_set_size (spec_char, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tmp->str[loop] == '[' && !strutils_is_char_escaped (tmp->str, &(tmp->str[loop]))) {
|
||||
if (tmp->str[loop] == '[' && !strutils_is_char_escaped (tmp->str, &(tmp->str[loop])))
|
||||
{
|
||||
mc_search__cond_struct_new_regex_accum_append (charset, ret_str, accumulator);
|
||||
|
||||
while (loop < str_len && !(tmp->str[loop] == ']'
|
||||
&& !strutils_is_char_escaped (tmp->str,
|
||||
&(tmp->str[loop])))) {
|
||||
&& !strutils_is_char_escaped (tmp->str, &(tmp->str[loop]))))
|
||||
{
|
||||
g_string_append_c (ret_str, tmp->str[loop]);
|
||||
loop++;
|
||||
|
||||
@ -240,12 +257,15 @@ mc_search__regex_found_cond_one (mc_search_t * lc_mc_search, mc_search_regex_t *
|
||||
|
||||
if (!g_regex_match_full
|
||||
(regex, search_str->str, -1, 0, G_REGEX_MATCH_NEWLINE_ANY, &lc_mc_search->regex_match_info,
|
||||
&error)) {
|
||||
&error))
|
||||
{
|
||||
g_match_info_free (lc_mc_search->regex_match_info);
|
||||
lc_mc_search->regex_match_info = NULL;
|
||||
if (error) {
|
||||
if (error)
|
||||
{
|
||||
lc_mc_search->error = MC_SEARCH_E_REGEX;
|
||||
lc_mc_search->error_str = str_conv_gerror_message (error, _(" Regular expression error "));
|
||||
lc_mc_search->error_str =
|
||||
str_conv_gerror_message (error, _(" Regular expression error "));
|
||||
g_error_free (error);
|
||||
return COND__FOUND_ERROR;
|
||||
}
|
||||
@ -254,9 +274,10 @@ mc_search__regex_found_cond_one (mc_search_t * lc_mc_search, mc_search_regex_t *
|
||||
lc_mc_search->num_rezults = g_match_info_get_match_count (lc_mc_search->regex_match_info);
|
||||
#else /* SEARCH_TYPE_GLIB */
|
||||
lc_mc_search->num_rezults = pcre_exec (regex, lc_mc_search->regex_match_info,
|
||||
search_str->str, search_str->len - 1, 0, 0, lc_mc_search->iovector,
|
||||
MC_SEARCH__NUM_REPLACE_ARGS);
|
||||
if (lc_mc_search->num_rezults < 0) {
|
||||
search_str->str, search_str->len - 1, 0, 0,
|
||||
lc_mc_search->iovector, MC_SEARCH__NUM_REPLACE_ARGS);
|
||||
if (lc_mc_search->num_rezults < 0)
|
||||
{
|
||||
return COND__NOT_FOUND;
|
||||
}
|
||||
#endif /* SEARCH_TYPE_GLIB */
|
||||
@ -273,13 +294,16 @@ mc_search__regex_found_cond (mc_search_t * lc_mc_search, GString * search_str)
|
||||
mc_search_cond_t *mc_search_cond;
|
||||
mc_search__found_cond_t ret;
|
||||
|
||||
for (loop1 = 0; loop1 < lc_mc_search->conditions->len; loop1++) {
|
||||
for (loop1 = 0; loop1 < lc_mc_search->conditions->len; loop1++)
|
||||
{
|
||||
mc_search_cond = (mc_search_cond_t *) g_ptr_array_index (lc_mc_search->conditions, loop1);
|
||||
|
||||
if (!mc_search_cond->regex_handle)
|
||||
continue;
|
||||
|
||||
ret = mc_search__regex_found_cond_one (lc_mc_search, mc_search_cond->regex_handle, search_str);
|
||||
ret =
|
||||
mc_search__regex_found_cond_one (lc_mc_search, mc_search_cond->regex_handle,
|
||||
search_str);
|
||||
|
||||
if (ret != COND__NOT_FOUND)
|
||||
return ret;
|
||||
@ -294,15 +318,18 @@ mc_search_regex__get_max_num_of_replace_tokens (const gchar * str, gsize len)
|
||||
{
|
||||
int max_token = 0;
|
||||
gsize loop;
|
||||
for (loop = 0; loop < len - 1; loop++) {
|
||||
if (str[loop] == '\\' && (str[loop + 1] & (char) 0xf0) == 0x30 /* 0-9 */ ) {
|
||||
for (loop = 0; loop < len - 1; loop++)
|
||||
{
|
||||
if (str[loop] == '\\' && (str[loop + 1] & (char) 0xf0) == 0x30 /* 0-9 */ )
|
||||
{
|
||||
if (strutils_is_char_escaped (str, &str[loop]))
|
||||
continue;
|
||||
if (max_token < str[loop + 1] - '0')
|
||||
max_token = str[loop + 1] - '0';
|
||||
continue;
|
||||
}
|
||||
if (str[loop] == '$' && str[loop + 1] == '{') {
|
||||
if (str[loop] == '$' && str[loop + 1] == '{')
|
||||
{
|
||||
gsize tmp_len;
|
||||
char *tmp_str;
|
||||
int tmp_token;
|
||||
@ -312,7 +339,8 @@ mc_search_regex__get_max_num_of_replace_tokens (const gchar * str, gsize len)
|
||||
for (tmp_len = 0;
|
||||
loop + tmp_len + 2 < len && (str[loop + 2 + tmp_len] & (char) 0xf0) == 0x30;
|
||||
tmp_len++);
|
||||
if (str[loop + 2 + tmp_len] == '}') {
|
||||
if (str[loop + 2 + tmp_len] == '}')
|
||||
{
|
||||
tmp_str = g_strndup (&str[loop + 2], tmp_len);
|
||||
tmp_token = atoi (tmp_str);
|
||||
if (max_token < tmp_token)
|
||||
@ -359,8 +387,10 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
|
||||
|
||||
*skip_len = 0;
|
||||
|
||||
if (*curr_str == '$' && *(curr_str + 1) == '{' && (*(curr_str + 2) & (char) 0xf0) == 0x30) {
|
||||
if (strutils_is_char_escaped (replace_str->str, curr_str)) {
|
||||
if (*curr_str == '$' && *(curr_str + 1) == '{' && (*(curr_str + 2) & (char) 0xf0) == 0x30)
|
||||
{
|
||||
if (strutils_is_char_escaped (replace_str->str, curr_str))
|
||||
{
|
||||
*skip_len = 1;
|
||||
return -1;
|
||||
}
|
||||
@ -383,20 +413,24 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (*curr_str == '\\') {
|
||||
if (strutils_is_char_escaped (replace_str->str, curr_str)) {
|
||||
if (*curr_str == '\\')
|
||||
{
|
||||
if (strutils_is_char_escaped (replace_str->str, curr_str))
|
||||
{
|
||||
*skip_len = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((*(curr_str + 1) & (char) 0xf0) == 0x30) {
|
||||
if ((*(curr_str + 1) & (char) 0xf0) == 0x30)
|
||||
{
|
||||
ret = *(curr_str + 1) - '0';
|
||||
*skip_len = 2; /* \\ and one digit */
|
||||
return ret;
|
||||
}
|
||||
ret = -2;
|
||||
*skip_len += 2;
|
||||
switch (*(curr_str + 1)) {
|
||||
switch (*(curr_str + 1))
|
||||
{
|
||||
case 'U':
|
||||
*replace_flags |= REPLACE_T_UPP_TRANSFORM;
|
||||
*replace_flags &= ~REPLACE_T_LOW_TRANSFORM;
|
||||
@ -430,39 +464,50 @@ mc_search_regex__process_append_str (GString * dest_str, const char *from, gsize
|
||||
char *tmp_str;
|
||||
GString *tmp_string;
|
||||
|
||||
if (len == (gsize) -1)
|
||||
if (len == (gsize) - 1)
|
||||
len = strlen (from);
|
||||
|
||||
if (*replace_flags == REPLACE_T_NO_TRANSFORM) {
|
||||
if (*replace_flags == REPLACE_T_NO_TRANSFORM)
|
||||
{
|
||||
g_string_append_len (dest_str, from, len);
|
||||
return;
|
||||
}
|
||||
while (loop < len) {
|
||||
while (loop < len)
|
||||
{
|
||||
tmp_str = mc_search__get_one_symbol (NULL, from + loop, len - loop, NULL);
|
||||
char_len = strlen (tmp_str);
|
||||
if (*replace_flags & REPLACE_T_UPP_TRANSFORM_CHAR) {
|
||||
if (*replace_flags & REPLACE_T_UPP_TRANSFORM_CHAR)
|
||||
{
|
||||
*replace_flags &= !REPLACE_T_UPP_TRANSFORM_CHAR;
|
||||
tmp_string = mc_search__toupper_case_str (NULL, tmp_str, char_len);
|
||||
g_string_append (dest_str, tmp_string->str);
|
||||
g_string_free (tmp_string, TRUE);
|
||||
|
||||
} else if (*replace_flags & REPLACE_T_LOW_TRANSFORM_CHAR) {
|
||||
}
|
||||
else if (*replace_flags & REPLACE_T_LOW_TRANSFORM_CHAR)
|
||||
{
|
||||
*replace_flags &= !REPLACE_T_LOW_TRANSFORM_CHAR;
|
||||
tmp_string = mc_search__toupper_case_str (NULL, tmp_str, char_len);
|
||||
g_string_append (dest_str, tmp_string->str);
|
||||
g_string_free (tmp_string, TRUE);
|
||||
|
||||
} else if (*replace_flags & REPLACE_T_UPP_TRANSFORM) {
|
||||
}
|
||||
else if (*replace_flags & REPLACE_T_UPP_TRANSFORM)
|
||||
{
|
||||
tmp_string = mc_search__toupper_case_str (NULL, tmp_str, char_len);
|
||||
g_string_append (dest_str, tmp_string->str);
|
||||
g_string_free (tmp_string, TRUE);
|
||||
|
||||
} else if (*replace_flags & REPLACE_T_LOW_TRANSFORM) {
|
||||
}
|
||||
else if (*replace_flags & REPLACE_T_LOW_TRANSFORM)
|
||||
{
|
||||
tmp_string = mc_search__tolower_case_str (NULL, tmp_str, char_len);
|
||||
g_string_append (dest_str, tmp_string->str);
|
||||
g_string_free (tmp_string, TRUE);
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
g_string_append (dest_str, tmp_str);
|
||||
}
|
||||
g_free (tmp_str);
|
||||
@ -485,7 +530,8 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_
|
||||
int erroffset;
|
||||
#endif /* SEARCH_TYPE_GLIB */
|
||||
|
||||
if (!lc_mc_search->is_case_sentitive) {
|
||||
if (!lc_mc_search->is_case_sentitive)
|
||||
{
|
||||
tmp = g_string_new_len (mc_search_cond->str->str, mc_search_cond->str->len);
|
||||
g_string_free (mc_search_cond->str, TRUE);
|
||||
mc_search_cond->str = mc_search__cond_struct_new_regex_ci_str (charset, tmp->str, tmp->len);
|
||||
@ -496,7 +542,8 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_
|
||||
g_regex_new (mc_search_cond->str->str, G_REGEX_OPTIMIZE | G_REGEX_RAW | G_REGEX_DOTALL, 0,
|
||||
&error);
|
||||
|
||||
if (error != NULL) {
|
||||
if (error != NULL)
|
||||
{
|
||||
lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE;
|
||||
lc_mc_search->error_str = str_conv_gerror_message (error, _(" Regular expression error "));
|
||||
g_error_free (error);
|
||||
@ -505,14 +552,17 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_
|
||||
#else /* SEARCH_TYPE_GLIB */
|
||||
mc_search_cond->regex_handle =
|
||||
pcre_compile (mc_search_cond->str->str, PCRE_EXTRA, &error, &erroffset, NULL);
|
||||
if (mc_search_cond->regex_handle == NULL) {
|
||||
if (mc_search_cond->regex_handle == NULL)
|
||||
{
|
||||
lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE;
|
||||
lc_mc_search->error_str = g_strdup (error);
|
||||
return;
|
||||
}
|
||||
lc_mc_search->regex_match_info = pcre_study (mc_search_cond->regex_handle, 0, &error);
|
||||
if (lc_mc_search->regex_match_info == NULL) {
|
||||
if (error) {
|
||||
if (lc_mc_search->regex_match_info == NULL)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE;
|
||||
lc_mc_search->error_str = g_strdup (error);
|
||||
g_free (mc_search_cond->regex_handle);
|
||||
@ -540,11 +590,13 @@ mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data,
|
||||
lc_mc_search->regex_buffer = g_string_new ("");
|
||||
|
||||
virtual_pos = current_pos = start_search;
|
||||
while (virtual_pos <= end_search) {
|
||||
while (virtual_pos <= end_search)
|
||||
{
|
||||
g_string_set_size (lc_mc_search->regex_buffer, 0);
|
||||
lc_mc_search->start_buffer = current_pos;
|
||||
|
||||
while (1) {
|
||||
while (1)
|
||||
{
|
||||
current_chr = mc_search__get_char (lc_mc_search, user_data, current_pos);
|
||||
if (current_chr == MC_SEARCH_CB_ABORT)
|
||||
break;
|
||||
@ -566,7 +618,8 @@ mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data,
|
||||
break;
|
||||
|
||||
}
|
||||
switch (mc_search__regex_found_cond (lc_mc_search, lc_mc_search->regex_buffer)) {
|
||||
switch (mc_search__regex_found_cond (lc_mc_search, lc_mc_search->regex_buffer))
|
||||
{
|
||||
case COND__FOUND_OK:
|
||||
#ifdef SEARCH_TYPE_GLIB
|
||||
g_match_info_fetch_pos (lc_mc_search->regex_match_info, 0, &start_pos, &end_pos);
|
||||
@ -587,8 +640,8 @@ mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data,
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
if (( lc_mc_search->update_fn != NULL ) &&
|
||||
( (lc_mc_search->update_fn) (user_data, current_pos) == MC_SEARCH_CB_ABORT))
|
||||
if ((lc_mc_search->update_fn != NULL) &&
|
||||
((lc_mc_search->update_fn) (user_data, current_pos) == MC_SEARCH_CB_ABORT))
|
||||
current_chr = MC_SEARCH_CB_ABORT;
|
||||
|
||||
if (current_chr == MC_SEARCH_CB_ABORT)
|
||||
@ -626,7 +679,8 @@ mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * repla
|
||||
return g_string_new_len (replace_str->str, replace_str->len);
|
||||
|
||||
if (num_replace_tokens > lc_mc_search->num_rezults - 1
|
||||
|| num_replace_tokens > MC_SEARCH__NUM_REPLACE_ARGS) {
|
||||
|| num_replace_tokens > MC_SEARCH__NUM_REPLACE_ARGS)
|
||||
{
|
||||
lc_mc_search->error = MC_SEARCH_E_REGEX_REPLACE;
|
||||
lc_mc_search->error_str = g_strdup (STR_E_RPL_NOT_EQ_TO_FOUND);
|
||||
return NULL;
|
||||
@ -634,11 +688,14 @@ mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * repla
|
||||
|
||||
ret = g_string_new ("");
|
||||
prev_str = replace_str->str;
|
||||
for (loop = 0; loop < replace_str->len - 1; loop++) {
|
||||
for (loop = 0; loop < replace_str->len - 1; loop++)
|
||||
{
|
||||
lc_index = mc_search_regex__process_replace_str (replace_str, loop, &len, &replace_flags);
|
||||
|
||||
if (lc_index == -1) {
|
||||
if (len != 0) {
|
||||
if (lc_index == -1)
|
||||
{
|
||||
if (len != 0)
|
||||
{
|
||||
mc_search_regex__process_append_str (ret, prev_str,
|
||||
replace_str->str - prev_str + loop,
|
||||
&replace_flags);
|
||||
@ -650,7 +707,8 @@ mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * repla
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lc_index == -2) {
|
||||
if (lc_index == -2)
|
||||
{
|
||||
if (loop)
|
||||
mc_search_regex__process_append_str (ret, prev_str,
|
||||
replace_str->str - prev_str + loop,
|
||||
@ -660,7 +718,8 @@ mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * repla
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lc_index > lc_mc_search->num_rezults) {
|
||||
if (lc_index > lc_mc_search->num_rezults)
|
||||
{
|
||||
g_string_free (ret, TRUE);
|
||||
lc_mc_search->error = MC_SEARCH_E_REGEX_REPLACE;
|
||||
lc_mc_search->error_str = g_strdup_printf (STR_E_RPL_INVALID_TOKEN, lc_index);
|
||||
|
@ -663,6 +663,7 @@ load_mc_home_file (const char *_mc_home, const char *_mc_home_alt, const char *f
|
||||
/* Fall back to the two-letter language code */
|
||||
if (lang[0] && lang[1])
|
||||
lang[2] = 0;
|
||||
g_free (hintfile);
|
||||
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
|
||||
data = load_file (hintfile);
|
||||
|
||||
|
@ -102,27 +102,34 @@ vfs_s_free_inode (struct vfs_class *me, struct vfs_s_inode *ino)
|
||||
vfs_die ("Don't pass NULL to me");
|
||||
|
||||
/* ==0 can happen if freshly created entry is deleted */
|
||||
if (ino->st.st_nlink <= 1){
|
||||
while (ino->subdir){
|
||||
if (ino->st.st_nlink <= 1)
|
||||
{
|
||||
while (ino->subdir)
|
||||
{
|
||||
vfs_s_free_entry (me, ino->subdir);
|
||||
}
|
||||
|
||||
CALL (free_inode) (me, ino);
|
||||
g_free (ino->linkname);
|
||||
if (ino->localname){
|
||||
if (ino->localname)
|
||||
{
|
||||
unlink (ino->localname);
|
||||
g_free(ino->localname);
|
||||
g_free (ino->localname);
|
||||
}
|
||||
total_inodes--;
|
||||
ino->super->ino_usage--;
|
||||
g_free(ino);
|
||||
} else ino->st.st_nlink--;
|
||||
g_free (ino);
|
||||
}
|
||||
else
|
||||
ino->st.st_nlink--;
|
||||
}
|
||||
|
||||
void
|
||||
vfs_s_free_entry (struct vfs_class *me, struct vfs_s_entry *ent)
|
||||
{
|
||||
if (ent->prevp){ /* It is possible that we are deleting freshly created entry */
|
||||
if (ent->prevp)
|
||||
{
|
||||
/* It is possible that we are deleting freshly created entry */
|
||||
*ent->prevp = ent->next;
|
||||
if (ent->next)
|
||||
ent->next->prevp = ent->prevp;
|
||||
@ -131,14 +138,15 @@ vfs_s_free_entry (struct vfs_class *me, struct vfs_s_entry *ent)
|
||||
g_free (ent->name);
|
||||
ent->name = NULL;
|
||||
|
||||
if (ent->ino){
|
||||
if (ent->ino)
|
||||
{
|
||||
ent->ino->ent = NULL;
|
||||
vfs_s_free_inode (me, ent->ino);
|
||||
ent->ino = NULL;
|
||||
}
|
||||
|
||||
total_entries--;
|
||||
g_free(ent);
|
||||
g_free (ent);
|
||||
}
|
||||
|
||||
void
|
||||
@ -183,7 +191,8 @@ vfs_s_default_stat (struct vfs_class *me, mode_t mode)
|
||||
}
|
||||
|
||||
struct vfs_s_entry *
|
||||
vfs_s_generate_entry (struct vfs_class *me, const char *name, struct vfs_s_inode *parent, mode_t mode)
|
||||
vfs_s_generate_entry (struct vfs_class *me, const char *name, struct vfs_s_inode *parent,
|
||||
mode_t mode)
|
||||
{
|
||||
struct vfs_s_inode *inode;
|
||||
struct stat *st;
|
||||
@ -214,8 +223,7 @@ vfs_s_automake (struct vfs_class *me, struct vfs_s_inode *dir, char *path, int f
|
||||
|
||||
/* If the entry is a symlink, find the entry for its target */
|
||||
static struct vfs_s_entry *
|
||||
vfs_s_resolve_symlink (struct vfs_class *me, struct vfs_s_entry *entry,
|
||||
int follow)
|
||||
vfs_s_resolve_symlink (struct vfs_class *me, struct vfs_s_entry *entry, int follow)
|
||||
{
|
||||
char *linkname;
|
||||
char *fullname = NULL;
|
||||
@ -235,18 +243,18 @@ vfs_s_resolve_symlink (struct vfs_class *me, struct vfs_s_entry *entry,
|
||||
ERRNOR (EFAULT, NULL);
|
||||
|
||||
/* make full path from relative */
|
||||
if (*linkname != PATH_SEP) {
|
||||
if (*linkname != PATH_SEP)
|
||||
{
|
||||
char *fullpath = vfs_s_fullpath (me, entry->dir);
|
||||
if (fullpath) {
|
||||
if (fullpath)
|
||||
{
|
||||
fullname = g_strconcat (fullpath, "/", linkname, (char *) NULL);
|
||||
linkname = fullname;
|
||||
g_free (fullpath);
|
||||
}
|
||||
}
|
||||
|
||||
target =
|
||||
(MEDATA->find_entry) (me, entry->dir->super->root, linkname,
|
||||
follow - 1, 0);
|
||||
target = (MEDATA->find_entry) (me, entry->dir->super->root, linkname, follow - 1, 0);
|
||||
g_free (fullname);
|
||||
return target;
|
||||
}
|
||||
@ -261,17 +269,19 @@ vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
|
||||
{
|
||||
size_t pseg;
|
||||
struct vfs_s_entry *ent = NULL;
|
||||
char * const pathref = g_strdup (a_path);
|
||||
char *const pathref = g_strdup (a_path);
|
||||
char *path = pathref;
|
||||
|
||||
/* canonicalize as well, but don't remove '../' from path */
|
||||
custom_canonicalize_pathname (path, CANON_PATH_ALL & (~CANON_PATH_REMDOUBLEDOTS));
|
||||
|
||||
while (root) {
|
||||
while (root)
|
||||
{
|
||||
while (*path == PATH_SEP) /* Strip leading '/' */
|
||||
path++;
|
||||
|
||||
if (!path[0]) {
|
||||
if (!path[0])
|
||||
{
|
||||
g_free (pathref);
|
||||
return ent;
|
||||
}
|
||||
@ -279,30 +289,26 @@ vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
|
||||
for (pseg = 0; path[pseg] && path[pseg] != PATH_SEP; pseg++);
|
||||
|
||||
for (ent = root->subdir; ent != NULL; ent = ent->next)
|
||||
if (strlen (ent->name) == pseg
|
||||
&& (!strncmp (ent->name, path, pseg)))
|
||||
if (strlen (ent->name) == pseg && (!strncmp (ent->name, path, pseg)))
|
||||
/* FOUND! */
|
||||
break;
|
||||
|
||||
if (!ent && (flags & (FL_MKFILE | FL_MKDIR)))
|
||||
ent = vfs_s_automake (me, root, path, flags);
|
||||
if (!ent) {
|
||||
if (!ent)
|
||||
{
|
||||
me->verrno = ENOENT;
|
||||
goto cleanup;
|
||||
}
|
||||
path += pseg;
|
||||
/* here we must follow leading directories always;
|
||||
only the actual file is optional */
|
||||
ent =
|
||||
vfs_s_resolve_symlink (me, ent,
|
||||
strchr (path,
|
||||
PATH_SEP) ? LINK_FOLLOW :
|
||||
follow);
|
||||
ent = vfs_s_resolve_symlink (me, ent, strchr (path, PATH_SEP) ? LINK_FOLLOW : follow);
|
||||
if (!ent)
|
||||
goto cleanup;
|
||||
root = ent->ino;
|
||||
}
|
||||
cleanup:
|
||||
cleanup:
|
||||
g_free (pathref);
|
||||
return NULL;
|
||||
}
|
||||
@ -315,11 +321,14 @@ split_dir_name (struct vfs_class *me, char *path, char **dir, char **name, char
|
||||
(void) me;
|
||||
|
||||
s = strrchr (path, PATH_SEP);
|
||||
if (s == NULL) {
|
||||
if (s == NULL)
|
||||
{
|
||||
*save = NULL;
|
||||
*name = path;
|
||||
*dir = path + strlen(path); /* an empty string */
|
||||
} else {
|
||||
*dir = path + strlen (path); /* an empty string */
|
||||
}
|
||||
else
|
||||
{
|
||||
*save = s;
|
||||
*dir = path;
|
||||
*s++ = '\0';
|
||||
@ -332,7 +341,7 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
|
||||
const char *a_path, int follow, int flags)
|
||||
{
|
||||
struct vfs_s_entry *ent = NULL;
|
||||
char * const path = g_strdup (a_path);
|
||||
char *const path = g_strdup (a_path);
|
||||
struct vfs_s_entry *retval = NULL;
|
||||
|
||||
if (root->super->root != root)
|
||||
@ -341,13 +350,12 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
|
||||
/* canonicalize as well, but don't remove '../' from path */
|
||||
custom_canonicalize_pathname (path, CANON_PATH_ALL & (~CANON_PATH_REMDOUBLEDOTS));
|
||||
|
||||
if (!(flags & FL_DIR)) {
|
||||
if (!(flags & FL_DIR))
|
||||
{
|
||||
char *dirname, *name, *save;
|
||||
struct vfs_s_inode *ino;
|
||||
split_dir_name (me, path, &dirname, &name, &save);
|
||||
ino =
|
||||
vfs_s_find_inode (me, root->super, dirname, follow,
|
||||
flags | FL_DIR);
|
||||
ino = vfs_s_find_inode (me, root->super, dirname, follow, flags | FL_DIR);
|
||||
if (save)
|
||||
*save = PATH_SEP;
|
||||
retval = vfs_s_find_entry_tree (me, ino, name, follow, flags);
|
||||
@ -359,7 +367,8 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
|
||||
if (!strcmp (ent->name, path))
|
||||
break;
|
||||
|
||||
if (ent && (!(MEDATA->dir_uptodate) (me, ent->ino))) {
|
||||
if (ent && (!(MEDATA->dir_uptodate) (me, ent->ino)))
|
||||
{
|
||||
#if 1
|
||||
print_vfs_message (_("Directory cache expired for %s"), path);
|
||||
#endif
|
||||
@ -367,14 +376,14 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
|
||||
ent = NULL;
|
||||
}
|
||||
|
||||
if (!ent) {
|
||||
if (!ent)
|
||||
{
|
||||
struct vfs_s_inode *ino;
|
||||
|
||||
ino =
|
||||
vfs_s_new_inode (me, root->super,
|
||||
vfs_s_default_stat (me, S_IFDIR | 0755));
|
||||
ino = vfs_s_new_inode (me, root->super, vfs_s_default_stat (me, S_IFDIR | 0755));
|
||||
ent = vfs_s_new_entry (me, path, ino);
|
||||
if ((MEDATA->dir_load) (me, ino, path) == -1) {
|
||||
if ((MEDATA->dir_load) (me, ino, path) == -1)
|
||||
{
|
||||
vfs_s_free_entry (me, ent);
|
||||
g_free (path);
|
||||
return NULL;
|
||||
@ -389,7 +398,8 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
|
||||
vfs_die ("find_linear: success but directory is not there\n");
|
||||
|
||||
#if 0
|
||||
if (!vfs_s_resolve_symlink (me, ent, follow)) {
|
||||
if (!vfs_s_resolve_symlink (me, ent, follow))
|
||||
{
|
||||
g_free (path);
|
||||
return NULL;
|
||||
}
|
||||
@ -438,7 +448,8 @@ vfs_s_insert_super (struct vfs_class *me, struct vfs_s_super *super)
|
||||
static void
|
||||
vfs_s_free_super (struct vfs_class *me, struct vfs_s_super *super)
|
||||
{
|
||||
if (super->root){
|
||||
if (super->root)
|
||||
{
|
||||
vfs_s_free_inode (me, super->root);
|
||||
super->root = NULL;
|
||||
}
|
||||
@ -447,14 +458,14 @@ vfs_s_free_super (struct vfs_class *me, struct vfs_s_super *super)
|
||||
/* FIXME: We currently leak small ammount of memory, sometimes. Fix it if you can. */
|
||||
if (super->ino_usage)
|
||||
message (D_ERROR, " Direntry warning ",
|
||||
"Super ino_usage is %d, memory leak",
|
||||
super->ino_usage);
|
||||
"Super ino_usage is %d, memory leak", super->ino_usage);
|
||||
|
||||
if (super->want_stale)
|
||||
message (D_ERROR, " Direntry warning ", "Super has want_stale set");
|
||||
#endif
|
||||
|
||||
if (super->prevp){
|
||||
if (super->prevp)
|
||||
{
|
||||
*super->prevp = super->next;
|
||||
if (super->next)
|
||||
super->next->prevp = super->prevp;
|
||||
@ -462,7 +473,7 @@ vfs_s_free_super (struct vfs_class *me, struct vfs_s_super *super)
|
||||
|
||||
CALL (free_archive) (me, super);
|
||||
g_free (super->name);
|
||||
g_free(super);
|
||||
g_free (super);
|
||||
}
|
||||
|
||||
|
||||
@ -471,8 +482,7 @@ vfs_s_free_super (struct vfs_class *me, struct vfs_s_super *super)
|
||||
* can be changed and the result may point inside the original string.
|
||||
*/
|
||||
const char *
|
||||
vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
|
||||
struct vfs_s_super **archive, int flags)
|
||||
vfs_s_get_path_mangle (struct vfs_class *me, char *inname, struct vfs_s_super **archive, int flags)
|
||||
{
|
||||
const char *retval;
|
||||
char *local, *op;
|
||||
@ -489,10 +499,12 @@ vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
|
||||
if (!(cookie = MEDATA->archive_check (me, archive_name, op)))
|
||||
return NULL;
|
||||
|
||||
for (super = MEDATA->supers; super != NULL; super = super->next) {
|
||||
for (super = MEDATA->supers; super != NULL; super = super->next)
|
||||
{
|
||||
/* 0 == other, 1 == same, return it, 2 == other but stop scanning */
|
||||
int i = MEDATA->archive_same (me, super, archive_name, op, cookie);
|
||||
if (i != 0) {
|
||||
if (i != 0)
|
||||
{
|
||||
if (i == 1)
|
||||
goto return_success;
|
||||
else
|
||||
@ -505,7 +517,8 @@ vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
|
||||
|
||||
super = vfs_s_new_super (me);
|
||||
result = MEDATA->open_archive (me, super, archive_name, op);
|
||||
if (result == -1) {
|
||||
if (result == -1)
|
||||
{
|
||||
vfs_s_free_super (me, super);
|
||||
ERRNOR (EIO, NULL);
|
||||
}
|
||||
@ -528,8 +541,7 @@ vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
|
||||
* The result should be freed.
|
||||
*/
|
||||
static char *
|
||||
vfs_s_get_path (struct vfs_class *me, const char *inname,
|
||||
struct vfs_s_super **archive, int flags)
|
||||
vfs_s_get_path (struct vfs_class *me, const char *inname, struct vfs_s_super **archive, int flags)
|
||||
{
|
||||
char *buf, *retval;
|
||||
|
||||
@ -542,7 +554,8 @@ vfs_s_get_path (struct vfs_class *me, const char *inname,
|
||||
void
|
||||
vfs_s_invalidate (struct vfs_class *me, struct vfs_s_super *super)
|
||||
{
|
||||
if (!super->want_stale){
|
||||
if (!super->want_stale)
|
||||
{
|
||||
vfs_s_free_inode (me, super->root);
|
||||
super->root = vfs_s_new_inode (me, super, vfs_s_default_stat (me, S_IFDIR | 0755));
|
||||
}
|
||||
@ -554,11 +567,13 @@ vfs_s_fullpath (struct vfs_class *me, struct vfs_s_inode *ino)
|
||||
if (!ino->ent)
|
||||
ERRNOR (EAGAIN, NULL);
|
||||
|
||||
if (!(MEDATA->flags & VFS_S_REMOTE)) {
|
||||
if (!(MEDATA->flags & VFS_S_REMOTE))
|
||||
{
|
||||
/* archives */
|
||||
char *newpath;
|
||||
char *path = g_strdup (ino->ent->name);
|
||||
while (1) {
|
||||
while (1)
|
||||
{
|
||||
ino = ino->ent->dir;
|
||||
if (ino == ino->super->root)
|
||||
break;
|
||||
@ -573,8 +588,7 @@ vfs_s_fullpath (struct vfs_class *me, struct vfs_s_inode *ino)
|
||||
if ((!ino->ent->dir) || (!ino->ent->dir->ent))
|
||||
return g_strdup (ino->ent->name);
|
||||
|
||||
return g_strconcat (ino->ent->dir->ent->name, PATH_SEP_STR,
|
||||
ino->ent->name, (char *) NULL);
|
||||
return g_strconcat (ino->ent->dir->ent->name, PATH_SEP_STR, ino->ent->name, (char *) NULL);
|
||||
}
|
||||
|
||||
/* Support of archives */
|
||||
@ -592,20 +606,19 @@ vfs_s_inode_from_path (struct vfs_class *me, const char *name, int flags)
|
||||
|
||||
ino =
|
||||
vfs_s_find_inode (me, super, q,
|
||||
flags & FL_FOLLOW ? LINK_FOLLOW : LINK_NO_FOLLOW,
|
||||
flags & ~FL_FOLLOW);
|
||||
flags & FL_FOLLOW ? LINK_FOLLOW : LINK_NO_FOLLOW, flags & ~FL_FOLLOW);
|
||||
if ((!ino) && (!*q))
|
||||
/* We are asking about / directory of ftp server: assume it exists */
|
||||
ino =
|
||||
vfs_s_find_inode (me, super, q,
|
||||
flags & FL_FOLLOW ? LINK_FOLLOW :
|
||||
LINK_NO_FOLLOW,
|
||||
FL_DIR | (flags & ~FL_FOLLOW));
|
||||
LINK_NO_FOLLOW, FL_DIR | (flags & ~FL_FOLLOW));
|
||||
g_free (q);
|
||||
return ino;
|
||||
}
|
||||
|
||||
struct dirhandle {
|
||||
struct dirhandle
|
||||
{
|
||||
struct vfs_s_entry *cur;
|
||||
struct vfs_s_inode *dir;
|
||||
};
|
||||
@ -635,7 +648,7 @@ vfs_s_opendir (struct vfs_class *me, const char *dirname)
|
||||
}
|
||||
|
||||
static void *
|
||||
vfs_s_readdir(void *data)
|
||||
vfs_s_readdir (void *data)
|
||||
{
|
||||
static union vfs_dirent dir;
|
||||
struct dirhandle *info = (struct dirhandle *) data;
|
||||
@ -643,13 +656,16 @@ vfs_s_readdir(void *data)
|
||||
if (!(info->cur))
|
||||
return NULL;
|
||||
|
||||
if (info->cur->name) {
|
||||
if (info->cur->name)
|
||||
{
|
||||
g_strlcpy (dir.dent.d_name, info->cur->name, MC_MAXPATHLEN);
|
||||
} else {
|
||||
vfs_die("Null in structure-cannot happen");
|
||||
}
|
||||
else
|
||||
{
|
||||
vfs_die ("Null in structure-cannot happen");
|
||||
}
|
||||
|
||||
compute_namelen(&dir.dent);
|
||||
compute_namelen (&dir.dent);
|
||||
info->cur = info->cur->next;
|
||||
|
||||
return (void *) &dir;
|
||||
@ -744,18 +760,21 @@ vfs_s_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
if ((q = vfs_s_get_path (me, file, &super, 0)) == NULL)
|
||||
return NULL;
|
||||
ino = vfs_s_find_inode (me, super, q, LINK_FOLLOW, FL_NONE);
|
||||
if (ino && ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))) {
|
||||
if (ino && ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)))
|
||||
{
|
||||
g_free (q);
|
||||
ERRNOR (EEXIST, NULL);
|
||||
}
|
||||
if (!ino) {
|
||||
if (!ino)
|
||||
{
|
||||
char *dirname, *name, *save;
|
||||
struct vfs_s_entry *ent;
|
||||
struct vfs_s_inode *dir;
|
||||
int tmp_handle;
|
||||
|
||||
/* If the filesystem is read-only, disable file creation */
|
||||
if (!(flags & O_CREAT) || !(me->write)) {
|
||||
if (!(flags & O_CREAT) || !(me->write))
|
||||
{
|
||||
g_free (q);
|
||||
return NULL;
|
||||
}
|
||||
@ -769,7 +788,8 @@ vfs_s_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
ino = ent->ino;
|
||||
vfs_s_insert_entry (me, dir, ent);
|
||||
tmp_handle = vfs_mkstemps (&ino->localname, me->name, name);
|
||||
if (tmp_handle == -1) {
|
||||
if (tmp_handle == -1)
|
||||
{
|
||||
g_free (q);
|
||||
return NULL;
|
||||
}
|
||||
@ -789,20 +809,25 @@ vfs_s_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
fh->changed = was_changed;
|
||||
fh->linear = 0;
|
||||
|
||||
if (IS_LINEAR (flags)) {
|
||||
if (MEDATA->linear_start) {
|
||||
if (IS_LINEAR (flags))
|
||||
{
|
||||
if (MEDATA->linear_start)
|
||||
{
|
||||
print_vfs_message (_("Starting linear transfer..."));
|
||||
fh->linear = LS_LINEAR_PREOPEN;
|
||||
}
|
||||
} else if ((MEDATA->fh_open)
|
||||
&& (MEDATA->fh_open (me, fh, flags, mode))) {
|
||||
}
|
||||
else if ((MEDATA->fh_open) && (MEDATA->fh_open (me, fh, flags, mode)))
|
||||
{
|
||||
g_free (fh);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fh->ino->localname) {
|
||||
if (fh->ino->localname)
|
||||
{
|
||||
fh->handle = open (fh->ino->localname, NO_LINEAR (flags), mode);
|
||||
if (fh->handle == -1) {
|
||||
if (fh->handle == -1)
|
||||
{
|
||||
g_free (fh);
|
||||
ERRNOR (errno, NULL);
|
||||
}
|
||||
@ -821,7 +846,8 @@ vfs_s_read (void *fh, char *buffer, int count)
|
||||
int n;
|
||||
struct vfs_class *me = FH_SUPER->me;
|
||||
|
||||
if (FH->linear == LS_LINEAR_PREOPEN) {
|
||||
if (FH->linear == LS_LINEAR_PREOPEN)
|
||||
{
|
||||
if (!MEDATA->linear_start (me, FH, FH->pos))
|
||||
return -1;
|
||||
}
|
||||
@ -832,7 +858,8 @@ vfs_s_read (void *fh, char *buffer, int count)
|
||||
if (FH->linear == LS_LINEAR_OPEN)
|
||||
return MEDATA->linear_read (me, FH, buffer, count);
|
||||
|
||||
if (FH->handle != -1){
|
||||
if (FH->handle != -1)
|
||||
{
|
||||
n = read (FH->handle, buffer, count);
|
||||
if (n < 0)
|
||||
me->verrno = errno;
|
||||
@ -852,7 +879,8 @@ vfs_s_write (void *fh, const char *buffer, int count)
|
||||
vfs_die ("no writing to linear files, please");
|
||||
|
||||
FH->changed = 1;
|
||||
if (FH->handle != -1){
|
||||
if (FH->handle != -1)
|
||||
{
|
||||
n = write (FH->handle, buffer, count);
|
||||
if (n < 0)
|
||||
me->verrno = errno;
|
||||
@ -870,18 +898,22 @@ vfs_s_lseek (void *fh, off_t offset, int whence)
|
||||
if (FH->linear == LS_LINEAR_OPEN)
|
||||
vfs_die ("cannot lseek() after linear_read!");
|
||||
|
||||
if (FH->handle != -1){ /* If we have local file opened, we want to work with it */
|
||||
if (FH->handle != -1)
|
||||
{ /* If we have local file opened, we want to work with it */
|
||||
int retval = lseek (FH->handle, offset, whence);
|
||||
if (retval == -1)
|
||||
FH->ino->super->me->verrno = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
switch (whence){
|
||||
switch (whence)
|
||||
{
|
||||
case SEEK_CUR:
|
||||
offset += FH->pos; break;
|
||||
offset += FH->pos;
|
||||
break;
|
||||
case SEEK_END:
|
||||
offset += size; break;
|
||||
offset += size;
|
||||
break;
|
||||
}
|
||||
if (offset < 0)
|
||||
FH->pos = 0;
|
||||
@ -906,11 +938,13 @@ vfs_s_close (void *fh)
|
||||
MEDATA->linear_close (me, fh);
|
||||
if (MEDATA->fh_close)
|
||||
res = MEDATA->fh_close (me, fh);
|
||||
if (FH->changed && MEDATA->file_store){
|
||||
if (FH->changed && MEDATA->file_store)
|
||||
{
|
||||
char *s = vfs_s_fullpath (me, FH->ino);
|
||||
if (!s)
|
||||
res = -1;
|
||||
else {
|
||||
else
|
||||
{
|
||||
res = MEDATA->file_store (me, fh, s, FH->ino->localname);
|
||||
g_free (s);
|
||||
}
|
||||
@ -931,19 +965,17 @@ vfs_s_print_stats (const char *fs_name, const char *action,
|
||||
static const char *i18n_percent_transf_format = NULL;
|
||||
static const char *i18n_transf_format = NULL;
|
||||
|
||||
if (i18n_percent_transf_format == NULL) {
|
||||
i18n_percent_transf_format =
|
||||
_("%s: %s: %s %3d%% (%lu bytes transferred)");
|
||||
if (i18n_percent_transf_format == NULL)
|
||||
{
|
||||
i18n_percent_transf_format = _("%s: %s: %s %3d%% (%lu bytes transferred)");
|
||||
i18n_transf_format = _("%s: %s: %s %lu bytes transferred");
|
||||
}
|
||||
|
||||
if (need)
|
||||
print_vfs_message (i18n_percent_transf_format, fs_name, action,
|
||||
file_name, (int) ((double) have * 100 / need),
|
||||
(unsigned long) have);
|
||||
file_name, (int) ((double) have * 100 / need), (unsigned long) have);
|
||||
else
|
||||
print_vfs_message (i18n_transf_format, fs_name, action, file_name,
|
||||
(unsigned long) have);
|
||||
print_vfs_message (i18n_transf_format, fs_name, action, file_name, (unsigned long) have);
|
||||
}
|
||||
|
||||
int
|
||||
@ -962,7 +994,8 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
|
||||
fh.handle = -1;
|
||||
|
||||
handle = vfs_mkstemps (&ino->localname, me->name, ino->ent->name);
|
||||
if (handle == -1) {
|
||||
if (handle == -1)
|
||||
{
|
||||
me->verrno = errno;
|
||||
goto error_4;
|
||||
}
|
||||
@ -974,20 +1007,21 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
|
||||
tty_got_interrupt ();
|
||||
tty_enable_interrupt_key ();
|
||||
|
||||
while ((n = MEDATA->linear_read (me, &fh, buffer, sizeof (buffer)))) {
|
||||
while ((n = MEDATA->linear_read (me, &fh, buffer, sizeof (buffer))))
|
||||
{
|
||||
int t;
|
||||
if (n < 0)
|
||||
goto error_1;
|
||||
|
||||
total += n;
|
||||
vfs_s_print_stats (me->name, _("Getting file"), ino->ent->name,
|
||||
total, stat_size);
|
||||
vfs_s_print_stats (me->name, _("Getting file"), ino->ent->name, total, stat_size);
|
||||
|
||||
if (tty_got_interrupt ())
|
||||
goto error_1;
|
||||
|
||||
t = write (handle, buffer, n);
|
||||
if (t != n) {
|
||||
if (t != n)
|
||||
{
|
||||
if (t == -1)
|
||||
me->verrno = errno;
|
||||
goto error_1;
|
||||
@ -1019,10 +1053,11 @@ vfs_s_fill_names (struct vfs_class *me, fill_names_f func)
|
||||
struct vfs_s_super *a = MEDATA->supers;
|
||||
char *name;
|
||||
|
||||
while (a){
|
||||
name = g_strconcat ( a->name, "#", me->prefix, "/",
|
||||
while (a)
|
||||
{
|
||||
name = g_strconcat (a->name, "#", me->prefix, "/",
|
||||
/* a->current_dir->name, */ (char *) NULL);
|
||||
(*func)(name);
|
||||
(*func) (name);
|
||||
g_free (name);
|
||||
a = a->next;
|
||||
}
|
||||
@ -1042,14 +1077,18 @@ static char *
|
||||
vfs_s_getlocalcopy (struct vfs_class *me, const char *path)
|
||||
{
|
||||
struct vfs_s_fh *fh;
|
||||
char *local;
|
||||
char *local = NULL;
|
||||
|
||||
fh = vfs_s_open (me, path, O_RDONLY, 0);
|
||||
if (!fh || !fh->ino || !fh->ino->localname)
|
||||
return NULL;
|
||||
|
||||
if (fh != NULL)
|
||||
{
|
||||
if ((fh->ino != NULL) && (fh->ino->localname != NULL))
|
||||
local = g_strdup (fh->ino->localname);
|
||||
|
||||
vfs_s_close (fh);
|
||||
}
|
||||
|
||||
return local;
|
||||
}
|
||||
|
||||
@ -1058,8 +1097,7 @@ vfs_s_getlocalcopy (struct vfs_class *me, const char *path)
|
||||
* the cache will be removed when the archive is closed.
|
||||
*/
|
||||
static int
|
||||
vfs_s_ungetlocalcopy (struct vfs_class *me, const char *path,
|
||||
const char *local, int has_changed)
|
||||
vfs_s_ungetlocalcopy (struct vfs_class *me, const char *path, const char *local, int has_changed)
|
||||
{
|
||||
(void) me;
|
||||
(void) path;
|
||||
@ -1071,7 +1109,8 @@ vfs_s_ungetlocalcopy (struct vfs_class *me, const char *path,
|
||||
static int
|
||||
vfs_s_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
||||
{
|
||||
switch (ctlop) {
|
||||
switch (ctlop)
|
||||
{
|
||||
case VFS_SETCTL_STALE_DATA:
|
||||
{
|
||||
struct vfs_s_inode *ino = vfs_s_inode_from_path (me, path, 0);
|
||||
@ -1080,7 +1119,8 @@ vfs_s_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
||||
return 0;
|
||||
if (arg)
|
||||
ino->super->want_stale = 1;
|
||||
else {
|
||||
else
|
||||
{
|
||||
ino->super->want_stale = 0;
|
||||
vfs_s_invalidate (me, ino->super);
|
||||
}
|
||||
@ -1107,7 +1147,7 @@ vfs_s_getid (struct vfs_class *me, const char *path)
|
||||
|
||||
if (!(p = vfs_s_get_path (me, path, &archive, FL_NO_OPEN)))
|
||||
return NULL;
|
||||
g_free(p);
|
||||
g_free (p);
|
||||
return (vfsid) archive;
|
||||
}
|
||||
|
||||
@ -1122,7 +1162,7 @@ vfs_s_nothingisopen (vfsid id)
|
||||
static void
|
||||
vfs_s_free (vfsid id)
|
||||
{
|
||||
vfs_s_free_super (((struct vfs_s_super *)id)->me, (struct vfs_s_super *)id);
|
||||
vfs_s_free_super (((struct vfs_s_super *) id)->me, (struct vfs_s_super *) id);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1130,12 +1170,13 @@ vfs_s_dir_uptodate (struct vfs_class *me, struct vfs_s_inode *ino)
|
||||
{
|
||||
struct timeval tim;
|
||||
|
||||
if (MEDATA->flush) {
|
||||
if (MEDATA->flush)
|
||||
{
|
||||
MEDATA->flush = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
gettimeofday(&tim, NULL);
|
||||
gettimeofday (&tim, NULL);
|
||||
if (tim.tv_sec < ino->timestamp.tv_sec)
|
||||
return 1;
|
||||
return 0;
|
||||
@ -1150,7 +1191,8 @@ vfs_s_init_class (struct vfs_class *vclass, struct vfs_s_subclass *sub)
|
||||
vclass->open = vfs_s_open;
|
||||
vclass->close = vfs_s_close;
|
||||
vclass->read = vfs_s_read;
|
||||
if (!(sub->flags & VFS_S_READONLY)) {
|
||||
if (!(sub->flags & VFS_S_READONLY))
|
||||
{
|
||||
vclass->write = vfs_s_write;
|
||||
}
|
||||
vclass->opendir = vfs_s_opendir;
|
||||
@ -1166,11 +1208,14 @@ vfs_s_init_class (struct vfs_class *vclass, struct vfs_s_subclass *sub)
|
||||
vclass->getid = vfs_s_getid;
|
||||
vclass->nothingisopen = vfs_s_nothingisopen;
|
||||
vclass->free = vfs_s_free;
|
||||
if (sub->flags & VFS_S_REMOTE) {
|
||||
if (sub->flags & VFS_S_REMOTE)
|
||||
{
|
||||
vclass->getlocalcopy = vfs_s_getlocalcopy;
|
||||
vclass->ungetlocalcopy = vfs_s_ungetlocalcopy;
|
||||
sub->find_entry = vfs_s_find_entry_linear;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
sub->find_entry = vfs_s_find_entry_tree;
|
||||
}
|
||||
vclass->setctl = vfs_s_setctl;
|
||||
@ -1210,14 +1255,17 @@ vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char ter
|
||||
int i;
|
||||
char c;
|
||||
|
||||
for (i = 0; i < buf_len - 1; i++, buf++){
|
||||
if (read (sock, buf, sizeof(char)) <= 0)
|
||||
for (i = 0; i < buf_len - 1; i++, buf++)
|
||||
{
|
||||
if (read (sock, buf, sizeof (char)) <= 0)
|
||||
return 0;
|
||||
if (logfile){
|
||||
if (logfile)
|
||||
{
|
||||
fwrite (buf, 1, 1, logfile);
|
||||
fflush (logfile);
|
||||
}
|
||||
if (*buf == term){
|
||||
if (*buf == term)
|
||||
{
|
||||
*buf = 0;
|
||||
return 1;
|
||||
}
|
||||
@ -1225,8 +1273,10 @@ vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char ter
|
||||
|
||||
/* Line is too long - terminate buffer and discard the rest of line */
|
||||
*buf = 0;
|
||||
while (read (sock, &c, sizeof (c)) > 0) {
|
||||
if (logfile){
|
||||
while (read (sock, &c, sizeof (c)) > 0)
|
||||
{
|
||||
if (logfile)
|
||||
{
|
||||
fwrite (&c, 1, 1, logfile);
|
||||
fflush (logfile);
|
||||
}
|
||||
@ -1245,23 +1295,27 @@ vfs_s_get_line_interruptible (struct vfs_class *me, char *buffer, int size, int
|
||||
(void) me;
|
||||
|
||||
tty_enable_interrupt_key ();
|
||||
for (i = 0; i < size-1; i++){
|
||||
n = read (fd, buffer+i, 1);
|
||||
for (i = 0; i < size - 1; i++)
|
||||
{
|
||||
n = read (fd, buffer + i, 1);
|
||||
tty_disable_interrupt_key ();
|
||||
if (n == -1 && errno == EINTR){
|
||||
buffer [i] = 0;
|
||||
if (n == -1 && errno == EINTR)
|
||||
{
|
||||
buffer[i] = 0;
|
||||
return EINTR;
|
||||
}
|
||||
if (n == 0){
|
||||
buffer [i] = 0;
|
||||
if (n == 0)
|
||||
{
|
||||
buffer[i] = 0;
|
||||
return 0;
|
||||
}
|
||||
if (buffer [i] == '\n'){
|
||||
buffer [i] = 0;
|
||||
if (buffer[i] == '\n')
|
||||
{
|
||||
buffer[i] = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
buffer [size-1] = 0;
|
||||
buffer[size - 1] = 0;
|
||||
return 0;
|
||||
}
|
||||
#endif /* USE_NETCODE */
|
||||
|
@ -486,7 +486,7 @@ extfs_read_archive (int fstype, const char *name, struct archive **pparc)
|
||||
*(p++) = '\0';
|
||||
q = cfn;
|
||||
}
|
||||
if (S_ISDIR (hstat.st_mode) && (strcmp (p, ".") || !strcmp (p, "..") == 0))
|
||||
if (S_ISDIR (hstat.st_mode) && (strcmp (p, ".") == 0 || strcmp (p, "..") == 0))
|
||||
goto read_extfs_continue;
|
||||
pent = extfs_find_entry (current_archive->root_entry, q, TRUE, FALSE);
|
||||
if (pent == NULL)
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -75,13 +75,15 @@
|
||||
static struct vfs_class *current_vfs;
|
||||
static char *current_dir;
|
||||
|
||||
struct vfs_openfile {
|
||||
struct vfs_openfile
|
||||
{
|
||||
int handle;
|
||||
struct vfs_class *vclass;
|
||||
void *fsinfo;
|
||||
};
|
||||
|
||||
struct vfs_dirinfo{
|
||||
struct vfs_dirinfo
|
||||
{
|
||||
DIR *info;
|
||||
GIConv converter;
|
||||
};
|
||||
@ -121,11 +123,14 @@ vfs_new_handle (struct vfs_class *vclass, void *fsinfo)
|
||||
|
||||
/* Allocate the first free handle */
|
||||
h->handle = vfs_free_handle_list;
|
||||
if (h->handle == -1) {
|
||||
if (h->handle == -1)
|
||||
{
|
||||
/* No free allocated handles, allocate one */
|
||||
h->handle = vfs_openfiles->len;
|
||||
g_ptr_array_add (vfs_openfiles, h);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
vfs_free_handle_list = (long) g_ptr_array_index (vfs_openfiles, vfs_free_handle_list);
|
||||
g_ptr_array_index (vfs_openfiles, h->handle) = h;
|
||||
}
|
||||
@ -140,12 +145,10 @@ vfs_op (int handle)
|
||||
{
|
||||
struct vfs_openfile *h;
|
||||
|
||||
if (handle < VFS_FIRST_HANDLE ||
|
||||
(guint)(handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
|
||||
if (handle < VFS_FIRST_HANDLE || (guint) (handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
|
||||
return NULL;
|
||||
|
||||
h = (struct vfs_openfile *) g_ptr_array_index (
|
||||
vfs_openfiles, handle - VFS_FIRST_HANDLE);
|
||||
h = (struct vfs_openfile *) g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE);
|
||||
if (!h)
|
||||
return NULL;
|
||||
|
||||
@ -160,12 +163,10 @@ vfs_info (int handle)
|
||||
{
|
||||
struct vfs_openfile *h;
|
||||
|
||||
if (handle < VFS_FIRST_HANDLE ||
|
||||
(guint)(handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
|
||||
if (handle < VFS_FIRST_HANDLE || (guint) (handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
|
||||
return NULL;
|
||||
|
||||
h = (struct vfs_openfile *) g_ptr_array_index (
|
||||
vfs_openfiles, handle - VFS_FIRST_HANDLE);
|
||||
h = (struct vfs_openfile *) g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE);
|
||||
if (!h)
|
||||
return NULL;
|
||||
|
||||
@ -178,13 +179,17 @@ vfs_info (int handle)
|
||||
static void
|
||||
vfs_free_handle (int handle)
|
||||
{
|
||||
if (handle < VFS_FIRST_HANDLE ||
|
||||
(guint)(handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
|
||||
return;
|
||||
const int idx = handle - VFS_FIRST_HANDLE;
|
||||
|
||||
g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE) =
|
||||
(void *) vfs_free_handle_list;
|
||||
vfs_free_handle_list = handle - VFS_FIRST_HANDLE;
|
||||
if (handle >= VFS_FIRST_HANDLE && (guint) idx < vfs_openfiles->len)
|
||||
{
|
||||
struct vfs_openfile *h;
|
||||
|
||||
h = (struct vfs_openfile *) g_ptr_array_index (vfs_openfiles, idx);
|
||||
g_free (h);
|
||||
g_ptr_array_index (vfs_openfiles, idx) = (void *) vfs_free_handle_list;
|
||||
vfs_free_handle_list = idx;
|
||||
}
|
||||
}
|
||||
|
||||
static struct vfs_class *vfs_list;
|
||||
@ -193,7 +198,7 @@ int
|
||||
vfs_register_class (struct vfs_class *vfs)
|
||||
{
|
||||
if (vfs->init) /* vfs has own initialization function */
|
||||
if (!(*vfs->init)(vfs)) /* but it failed */
|
||||
if (!(*vfs->init) (vfs)) /* but it failed */
|
||||
return 0;
|
||||
|
||||
vfs->next = vfs_list;
|
||||
@ -209,14 +214,15 @@ vfs_prefix_to_class (char *prefix)
|
||||
struct vfs_class *vfs;
|
||||
|
||||
/* Avoid last class (localfs) that would accept any prefix */
|
||||
for (vfs = vfs_list; vfs->next; vfs = vfs->next) {
|
||||
if (vfs->which) {
|
||||
for (vfs = vfs_list; vfs->next; vfs = vfs->next)
|
||||
{
|
||||
if (vfs->which)
|
||||
{
|
||||
if ((*vfs->which) (vfs, prefix) == -1)
|
||||
continue;
|
||||
return vfs;
|
||||
}
|
||||
if (vfs->prefix
|
||||
&& !strncmp (prefix, vfs->prefix, strlen (vfs->prefix)))
|
||||
if (vfs->prefix && !strncmp (prefix, vfs->prefix, strlen (vfs->prefix)))
|
||||
return vfs;
|
||||
}
|
||||
return NULL;
|
||||
@ -241,15 +247,17 @@ vfs_strip_suffix_from_filename (const char *filename)
|
||||
return p;
|
||||
|
||||
/* Avoid last class (localfs) that would accept any prefix */
|
||||
for (vfs = vfs_list; vfs->next; vfs = vfs->next) {
|
||||
if (vfs->which) {
|
||||
for (vfs = vfs_list; vfs->next; vfs = vfs->next)
|
||||
{
|
||||
if (vfs->which)
|
||||
{
|
||||
if ((*vfs->which) (vfs, semi + 1) == -1)
|
||||
continue;
|
||||
*semi = '\0'; /* Found valid suffix */
|
||||
return p;
|
||||
}
|
||||
if (vfs->prefix
|
||||
&& !strncmp (semi + 1, vfs->prefix, strlen (vfs->prefix))) {
|
||||
if (vfs->prefix && !strncmp (semi + 1, vfs->prefix, strlen (vfs->prefix)))
|
||||
{
|
||||
*semi = '\0'; /* Found valid suffix */
|
||||
return p;
|
||||
}
|
||||
@ -262,7 +270,7 @@ path_magic (const char *path)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (!stat(path, &buf))
|
||||
if (!stat (path, &buf))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
@ -287,10 +295,10 @@ vfs_split (char *path, char **inpath, char **op)
|
||||
struct vfs_class *ret;
|
||||
|
||||
if (!path)
|
||||
vfs_die("Cannot split NULL");
|
||||
vfs_die ("Cannot split NULL");
|
||||
|
||||
semi = strrchr (path, '#');
|
||||
if (!semi || !path_magic(path))
|
||||
if (!semi || !path_magic (path))
|
||||
return NULL;
|
||||
|
||||
slash = strchr (semi, PATH_SEP);
|
||||
@ -305,7 +313,8 @@ vfs_split (char *path, char **inpath, char **op)
|
||||
if (slash)
|
||||
*slash = 0;
|
||||
|
||||
if ((ret = vfs_prefix_to_class (semi+1))){
|
||||
if ((ret = vfs_prefix_to_class (semi + 1)))
|
||||
{
|
||||
if (op)
|
||||
*op = semi + 1;
|
||||
if (inpath)
|
||||
@ -328,7 +337,7 @@ _vfs_get_class (char *path)
|
||||
char *slash;
|
||||
struct vfs_class *ret;
|
||||
|
||||
g_return_val_if_fail(path, NULL);
|
||||
g_return_val_if_fail (path, NULL);
|
||||
|
||||
semi = strrchr (path, '#');
|
||||
if (!semi || !path_magic (path))
|
||||
@ -339,7 +348,7 @@ _vfs_get_class (char *path)
|
||||
if (slash)
|
||||
*slash = 0;
|
||||
|
||||
ret = vfs_prefix_to_class (semi+1);
|
||||
ret = vfs_prefix_to_class (semi + 1);
|
||||
|
||||
if (slash)
|
||||
*slash = PATH_SEP;
|
||||
@ -376,16 +385,19 @@ vfs_get_encoding (const char *path)
|
||||
work = g_strdup (path);
|
||||
semi = g_strrstr (work, "#enc:");
|
||||
|
||||
if (semi != NULL) {
|
||||
semi+= 5 * sizeof (char);
|
||||
if (semi != NULL)
|
||||
{
|
||||
semi += 5 * sizeof (char);
|
||||
slash = strchr (semi, PATH_SEP);
|
||||
if (slash != NULL)
|
||||
slash[0] = '\0';
|
||||
|
||||
g_strlcpy (result, semi, sizeof(result));
|
||||
g_strlcpy (result, semi, sizeof (result));
|
||||
g_free (work);
|
||||
return result;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (work);
|
||||
return NULL;
|
||||
}
|
||||
@ -394,12 +406,14 @@ vfs_get_encoding (const char *path)
|
||||
/* return if encoding can by used in vfs (is ascci full compactible) */
|
||||
/* contains only a few encoding now */
|
||||
static int
|
||||
vfs_supported_enconding (const char *encoding) {
|
||||
vfs_supported_enconding (const char *encoding)
|
||||
{
|
||||
int t;
|
||||
int result = 0;
|
||||
|
||||
for (t = 0; supported_encodings[t] != NULL; t++) {
|
||||
result+= (g_ascii_strncasecmp (encoding, supported_encodings[t],
|
||||
for (t = 0; supported_encodings[t] != NULL; t++)
|
||||
{
|
||||
result += (g_ascii_strncasecmp (encoding, supported_encodings[t],
|
||||
strlen (supported_encodings[t])) == 0);
|
||||
}
|
||||
|
||||
@ -415,8 +429,7 @@ vfs_supported_enconding (const char *encoding) {
|
||||
* buffer - used to store result of translation
|
||||
*/
|
||||
static estr_t
|
||||
_vfs_translate_path (const char *path, int size,
|
||||
GIConv defcnv, GString *buffer)
|
||||
_vfs_translate_path (const char *path, int size, GIConv defcnv, GString * buffer)
|
||||
{
|
||||
const char *semi;
|
||||
const char *ps;
|
||||
@ -426,18 +439,21 @@ _vfs_translate_path (const char *path, int size,
|
||||
GIConv coder;
|
||||
int ms;
|
||||
|
||||
if (size == 0) return 0;
|
||||
size = ( size > 0) ? size : (signed int)strlen (path);
|
||||
if (size == 0)
|
||||
return 0;
|
||||
size = (size > 0) ? size : (signed int) strlen (path);
|
||||
|
||||
/* try found #end: */
|
||||
semi = g_strrstr_len (path, size, "#enc:");
|
||||
if (semi != NULL) {
|
||||
if (semi != NULL)
|
||||
{
|
||||
/* first must be translated part before #enc: */
|
||||
ms = semi - path;
|
||||
|
||||
/* remove '/' before #enc */
|
||||
ps = str_cget_prev_char (semi);
|
||||
if (ps[0] == PATH_SEP) ms = ps - path;
|
||||
if (ps[0] == PATH_SEP)
|
||||
ms = ps - path;
|
||||
|
||||
state = _vfs_translate_path (path, ms, defcnv, buffer);
|
||||
|
||||
@ -445,32 +461,40 @@ _vfs_translate_path (const char *path, int size,
|
||||
return state;
|
||||
/* now can be translated part after #enc: */
|
||||
|
||||
semi+= 5;
|
||||
semi += 5;
|
||||
slash = strchr (semi, PATH_SEP);
|
||||
/* ignore slashes after size; */
|
||||
if (slash - path >= size) slash = NULL;
|
||||
if (slash - path >= size)
|
||||
slash = NULL;
|
||||
|
||||
ms = (slash != NULL) ? slash - semi : (int) strlen (semi);
|
||||
ms = min ((unsigned int) ms, sizeof (encoding) - 1);
|
||||
/* limit encoding size (ms) to path size (size) */
|
||||
if (semi + ms > path + size) ms = path + size - semi;
|
||||
if (semi + ms > path + size)
|
||||
ms = path + size - semi;
|
||||
memcpy (encoding, semi, ms);
|
||||
encoding[ms] = '\0';
|
||||
|
||||
switch (vfs_supported_enconding (encoding)) {
|
||||
switch (vfs_supported_enconding (encoding))
|
||||
{
|
||||
case 1:
|
||||
coder = str_crt_conv_to (encoding);
|
||||
if (coder != INVALID_CONV) {
|
||||
if (slash != NULL) {
|
||||
state = str_vfs_convert_to (coder, slash,
|
||||
path + size - slash, buffer);
|
||||
} else if (buffer->str[0] == '\0') {
|
||||
if (coder != INVALID_CONV)
|
||||
{
|
||||
if (slash != NULL)
|
||||
{
|
||||
state = str_vfs_convert_to (coder, slash, path + size - slash, buffer);
|
||||
}
|
||||
else if (buffer->str[0] == '\0')
|
||||
{
|
||||
/* exmaple "/#enc:utf-8" */
|
||||
g_string_append_c(buffer, PATH_SEP);
|
||||
g_string_append_c (buffer, PATH_SEP);
|
||||
}
|
||||
str_close_conv (coder);
|
||||
return state;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
errno = EINVAL;
|
||||
return ESTR_FAILURE;
|
||||
}
|
||||
@ -479,7 +503,9 @@ _vfs_translate_path (const char *path, int size,
|
||||
errno = EINVAL;
|
||||
return ESTR_FAILURE;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* path can be translated whole at once */
|
||||
state = str_vfs_convert_to (defcnv, path, size, buffer);
|
||||
return state;
|
||||
@ -493,7 +519,7 @@ vfs_translate_path (const char *path)
|
||||
{
|
||||
estr_t state;
|
||||
|
||||
g_string_set_size(vfs_str_buffer,0);
|
||||
g_string_set_size (vfs_str_buffer, 0);
|
||||
state = _vfs_translate_path (path, -1, str_cnv_from_term, vfs_str_buffer);
|
||||
/*
|
||||
strict version
|
||||
@ -528,7 +554,7 @@ vfs_canon_and_translate (const char *path)
|
||||
static int
|
||||
ferrno (struct vfs_class *vfs)
|
||||
{
|
||||
return vfs->ferrno ? (*vfs->ferrno)(vfs) : E_UNKNOWN;
|
||||
return vfs->ferrno ? (*vfs->ferrno) (vfs) : E_UNKNOWN;
|
||||
/* Hope that error message is obscure enough ;-) */
|
||||
}
|
||||
|
||||
@ -540,18 +566,22 @@ mc_open (const char *filename, int flags, ...)
|
||||
va_list ap;
|
||||
|
||||
char *file = vfs_canon_and_translate (filename);
|
||||
if (file != NULL) {
|
||||
if (file != NULL)
|
||||
{
|
||||
struct vfs_class *vfs = vfs_get_class (file);
|
||||
|
||||
/* Get the mode flag */
|
||||
if (flags & O_CREAT) {
|
||||
if (flags & O_CREAT)
|
||||
{
|
||||
va_start (ap, flags);
|
||||
mode = va_arg (ap, int);
|
||||
va_end (ap);
|
||||
} else
|
||||
}
|
||||
else
|
||||
mode = 0;
|
||||
|
||||
if (!vfs->open) {
|
||||
if (!vfs->open)
|
||||
{
|
||||
g_free (file);
|
||||
errno = -EOPNOTSUPP;
|
||||
return -1;
|
||||
@ -559,13 +589,16 @@ mc_open (const char *filename, int flags, ...)
|
||||
|
||||
info = (*vfs->open) (vfs, file, flags, mode); /* open must be supported */
|
||||
g_free (file);
|
||||
if (!info){
|
||||
if (!info)
|
||||
{
|
||||
errno = ferrno (vfs);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return vfs_new_handle (vfs, info);
|
||||
} else return -1;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -591,15 +624,13 @@ int mc_##name inarg \
|
||||
|
||||
MC_NAMEOP (chmod, (const char *path, mode_t mode), (vfs, mpath, mode))
|
||||
MC_NAMEOP (chown, (const char *path, uid_t owner, gid_t group), (vfs, mpath, owner, group))
|
||||
MC_NAMEOP (utime, (const char *path, struct utimbuf *times), (vfs, mpath, times))
|
||||
MC_NAMEOP (utime, (const char *path, struct utimbuf * times), (vfs, mpath, times))
|
||||
MC_NAMEOP (readlink, (const char *path, char *buf, int bufsiz), (vfs, mpath, buf, bufsiz))
|
||||
MC_NAMEOP (unlink, (const char *path), (vfs, mpath))
|
||||
MC_NAMEOP (mkdir, (const char *path, mode_t mode), (vfs, mpath, mode))
|
||||
MC_NAMEOP (rmdir, (const char *path), (vfs, mpath))
|
||||
MC_NAMEOP (mknod, (const char *path, mode_t mode, dev_t dev), (vfs, mpath, mode, dev))
|
||||
|
||||
int
|
||||
mc_symlink (const char *name1, const char *path)
|
||||
int mc_symlink (const char *name1, const char *path)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
int result;
|
||||
@ -608,12 +639,14 @@ mc_symlink (const char *name1, const char *path)
|
||||
char *tmp;
|
||||
|
||||
mpath = vfs_canon_and_translate (path);
|
||||
if (mpath != NULL) {
|
||||
if (mpath != NULL)
|
||||
{
|
||||
tmp = g_strdup (name1);
|
||||
lpath = vfs_translate_path_n (tmp);
|
||||
g_free (tmp);
|
||||
|
||||
if (lpath != NULL) {
|
||||
if (lpath != NULL)
|
||||
{
|
||||
vfs = vfs_get_class (mpath);
|
||||
result = vfs->symlink ? (*vfs->symlink) (vfs, lpath, mpath) : -1;
|
||||
g_free (lpath);
|
||||
@ -644,10 +677,8 @@ ssize_t mc_##name inarg \
|
||||
return result; \
|
||||
}
|
||||
|
||||
MC_HANDLEOP(read, (int handle, void *buffer, int count), (vfs_info (handle), buffer, count))
|
||||
MC_HANDLEOP(write, (int handle, const void *buf, int nbyte), (vfs_info (handle), buf, nbyte))
|
||||
|
||||
|
||||
MC_HANDLEOP (read, (int handle, void *buffer, int count), (vfs_info (handle), buffer, count))
|
||||
MC_HANDLEOP (write, (int handle, const void *buf, int nbyte), (vfs_info (handle), buf, nbyte))
|
||||
#define MC_RENAMEOP(name) \
|
||||
int mc_##name (const char *fname1, const char *fname2) \
|
||||
{ \
|
||||
@ -677,20 +708,16 @@ int mc_##name (const char *fname1, const char *fname2) \
|
||||
} \
|
||||
} else return -1; \
|
||||
}
|
||||
|
||||
MC_RENAMEOP (link)
|
||||
MC_RENAMEOP (rename)
|
||||
|
||||
|
||||
int
|
||||
mc_ctl (int handle, int ctlop, void *arg)
|
||||
MC_RENAMEOP (link) MC_RENAMEOP (rename)
|
||||
int
|
||||
mc_ctl (int handle, int ctlop, void *arg)
|
||||
{
|
||||
struct vfs_class *vfs = vfs_op (handle);
|
||||
|
||||
if (vfs == NULL)
|
||||
return 0;
|
||||
|
||||
return vfs->ctl ? (*vfs->ctl)(vfs_info (handle), ctlop, arg) : 0;
|
||||
return vfs->ctl ? (*vfs->ctl) (vfs_info (handle), ctlop, arg) : 0;
|
||||
}
|
||||
|
||||
int
|
||||
@ -701,15 +728,18 @@ mc_setctl (const char *path, int ctlop, void *arg)
|
||||
char *mpath;
|
||||
|
||||
if (!path)
|
||||
vfs_die("You don't want to pass NULL to mc_setctl.");
|
||||
vfs_die ("You don't want to pass NULL to mc_setctl.");
|
||||
|
||||
mpath = vfs_canon_and_translate (path);
|
||||
if (mpath != NULL) {
|
||||
if (mpath != NULL)
|
||||
{
|
||||
vfs = vfs_get_class (mpath);
|
||||
result = vfs->setctl ? (*vfs->setctl)(vfs, mpath, ctlop, arg) : 0;
|
||||
result = vfs->setctl ? (*vfs->setctl) (vfs, mpath, ctlop, arg) : 0;
|
||||
g_free (mpath);
|
||||
return result;
|
||||
} else return -1;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
@ -730,7 +760,7 @@ mc_close (int handle)
|
||||
|
||||
if (!vfs->close)
|
||||
vfs_die ("VFS must support close.\n");
|
||||
result = (*vfs->close)(vfs_info (handle));
|
||||
result = (*vfs->close) (vfs_info (handle));
|
||||
vfs_free_handle (handle);
|
||||
if (result == -1)
|
||||
errno = ferrno (vfs);
|
||||
@ -752,12 +782,14 @@ mc_opendir (const char *dirname)
|
||||
canon = vfs_canon (dirname);
|
||||
dname = vfs_translate_path_n (canon);
|
||||
|
||||
if (dname != NULL) {
|
||||
if (dname != NULL)
|
||||
{
|
||||
vfs = vfs_get_class (dname);
|
||||
info = vfs->opendir ? (*vfs->opendir)(vfs, dname) : NULL;
|
||||
info = vfs->opendir ? (*vfs->opendir) (vfs, dname) : NULL;
|
||||
g_free (dname);
|
||||
|
||||
if (info == NULL) {
|
||||
if (info == NULL)
|
||||
{
|
||||
errno = vfs->opendir ? ferrno (vfs) : E_NOTSUPP;
|
||||
g_free (canon);
|
||||
return NULL;
|
||||
@ -768,25 +800,27 @@ mc_opendir (const char *dirname)
|
||||
|
||||
encoding = vfs_get_encoding (canon);
|
||||
g_free (canon);
|
||||
dirinfo->converter = (encoding != NULL) ? str_crt_conv_from (encoding) :
|
||||
str_cnv_from_term;
|
||||
if (dirinfo->converter == INVALID_CONV) dirinfo->converter =str_cnv_from_term;
|
||||
dirinfo->converter = (encoding != NULL) ? str_crt_conv_from (encoding) : str_cnv_from_term;
|
||||
if (dirinfo->converter == INVALID_CONV)
|
||||
dirinfo->converter = str_cnv_from_term;
|
||||
|
||||
handle = vfs_new_handle (vfs, dirinfo);
|
||||
|
||||
handlep = g_new (int, 1);
|
||||
*handlep = handle;
|
||||
return (DIR *) handlep;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (canon);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static struct dirent * mc_readdir_result = NULL;
|
||||
static struct dirent *mc_readdir_result = NULL;
|
||||
|
||||
struct dirent *
|
||||
mc_readdir (DIR *dirp)
|
||||
mc_readdir (DIR * dirp)
|
||||
{
|
||||
int handle;
|
||||
struct vfs_class *vfs;
|
||||
@ -806,10 +840,11 @@ mc_readdir (DIR *dirp)
|
||||
* structures, holding dirent size. But we don't use it in libc infrastructure.
|
||||
* TODO: to make simpler homemade dirent-alike structure.
|
||||
*/
|
||||
mc_readdir_result = (struct dirent *) g_malloc (sizeof(struct dirent) + MAXNAMLEN + 1);
|
||||
mc_readdir_result = (struct dirent *) g_malloc (sizeof (struct dirent) + MAXNAMLEN + 1);
|
||||
}
|
||||
|
||||
if (!dirp) {
|
||||
if (!dirp)
|
||||
{
|
||||
errno = EFAULT;
|
||||
return NULL;
|
||||
}
|
||||
@ -820,41 +855,48 @@ mc_readdir (DIR *dirp)
|
||||
return NULL;
|
||||
|
||||
dirinfo = vfs_info (handle);
|
||||
if (vfs->readdir) {
|
||||
if (vfs->readdir)
|
||||
{
|
||||
entry = (*vfs->readdir) (dirinfo->info);
|
||||
if (entry == NULL) return NULL;
|
||||
g_string_set_size(vfs_str_buffer,0);
|
||||
state = str_vfs_convert_from (dirinfo->converter,
|
||||
entry->d_name, vfs_str_buffer);
|
||||
if (entry == NULL)
|
||||
return NULL;
|
||||
g_string_set_size (vfs_str_buffer, 0);
|
||||
state = str_vfs_convert_from (dirinfo->converter, entry->d_name, vfs_str_buffer);
|
||||
mc_readdir_result->d_ino = entry->d_ino;
|
||||
g_strlcpy (mc_readdir_result->d_name, vfs_str_buffer->str, MAXNAMLEN + 1);
|
||||
}
|
||||
if (entry == NULL) errno = vfs->readdir ? ferrno (vfs) : E_NOTSUPP;
|
||||
if (entry == NULL)
|
||||
errno = vfs->readdir ? ferrno (vfs) : E_NOTSUPP;
|
||||
return (entry != NULL) ? mc_readdir_result : NULL;
|
||||
}
|
||||
|
||||
int
|
||||
mc_closedir (DIR *dirp)
|
||||
mc_closedir (DIR * dirp)
|
||||
{
|
||||
int handle = *(int *) dirp;
|
||||
struct vfs_class *vfs = vfs_op (handle);
|
||||
int result;
|
||||
struct vfs_class *vfs;
|
||||
int result = -1;
|
||||
|
||||
vfs = vfs_op (handle);
|
||||
if (vfs != NULL)
|
||||
{
|
||||
struct vfs_dirinfo *dirinfo;
|
||||
|
||||
if (vfs == NULL)
|
||||
return -1;
|
||||
|
||||
dirinfo = vfs_info (handle);
|
||||
if (dirinfo->converter != str_cnv_from_term) str_close_conv (dirinfo->converter);
|
||||
if (dirinfo->converter != str_cnv_from_term)
|
||||
str_close_conv (dirinfo->converter);
|
||||
|
||||
result = vfs->closedir ? (*vfs->closedir)(dirinfo->info) : -1;
|
||||
result = vfs->closedir ? (*vfs->closedir) (dirinfo->info) : -1;
|
||||
vfs_free_handle (handle);
|
||||
g_free (dirinfo);
|
||||
}
|
||||
g_free (dirp);
|
||||
return result;
|
||||
}
|
||||
|
||||
int mc_stat (const char *filename, struct stat *buf) {
|
||||
int
|
||||
mc_stat (const char *filename, struct stat *buf)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
int result;
|
||||
char *path;
|
||||
@ -866,7 +908,8 @@ int mc_stat (const char *filename, struct stat *buf) {
|
||||
|
||||
vfs = vfs_get_class (path);
|
||||
|
||||
if (vfs == NULL) {
|
||||
if (vfs == NULL)
|
||||
{
|
||||
g_free (path);
|
||||
return -1;
|
||||
}
|
||||
@ -880,7 +923,9 @@ int mc_stat (const char *filename, struct stat *buf) {
|
||||
return result;
|
||||
}
|
||||
|
||||
int mc_lstat (const char *filename, struct stat *buf) {
|
||||
int
|
||||
mc_lstat (const char *filename, struct stat *buf)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
int result;
|
||||
char *path;
|
||||
@ -891,7 +936,8 @@ int mc_lstat (const char *filename, struct stat *buf) {
|
||||
return -1;
|
||||
|
||||
vfs = vfs_get_class (path);
|
||||
if (vfs == NULL) {
|
||||
if (vfs == NULL)
|
||||
{
|
||||
g_free (path);
|
||||
return -1;
|
||||
}
|
||||
@ -903,7 +949,9 @@ int mc_lstat (const char *filename, struct stat *buf) {
|
||||
return result;
|
||||
}
|
||||
|
||||
int mc_fstat (int handle, struct stat *buf) {
|
||||
int
|
||||
mc_fstat (int handle, struct stat *buf)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
int result;
|
||||
|
||||
@ -931,14 +979,17 @@ _vfs_get_cwd (void)
|
||||
|
||||
trans = vfs_translate_path_n (current_dir);
|
||||
|
||||
if (_vfs_get_class (trans) == NULL) {
|
||||
if (_vfs_get_class (trans) == NULL)
|
||||
{
|
||||
const char *encoding = vfs_get_encoding (current_dir);
|
||||
|
||||
if (encoding == NULL) {
|
||||
if (encoding == NULL)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
tmp = g_get_current_dir ();
|
||||
if (tmp != NULL) { /* One of the directories in the path is not readable */
|
||||
if (tmp != NULL)
|
||||
{ /* One of the directories in the path is not readable */
|
||||
estr_t state;
|
||||
char *sys_cwd;
|
||||
|
||||
@ -947,16 +998,17 @@ _vfs_get_cwd (void)
|
||||
g_free (tmp);
|
||||
|
||||
sys_cwd = (state == ESTR_SUCCESS) ? g_strdup (vfs_str_buffer->str) : NULL;
|
||||
if (sys_cwd != NULL) {
|
||||
if (sys_cwd != NULL)
|
||||
{
|
||||
struct stat my_stat, my_stat2;
|
||||
/* Check if it is O.K. to use the current_dir */
|
||||
if (cd_symlinks
|
||||
&& mc_stat (sys_cwd, &my_stat) == 0
|
||||
&& mc_stat (current_dir, &my_stat2) == 0
|
||||
&& my_stat.st_ino == my_stat2.st_ino
|
||||
&& my_stat.st_dev == my_stat2.st_dev)
|
||||
&& my_stat.st_ino == my_stat2.st_ino && my_stat.st_dev == my_stat2.st_dev)
|
||||
g_free (sys_cwd);
|
||||
else {
|
||||
else
|
||||
{
|
||||
g_free (current_dir);
|
||||
current_dir = sys_cwd;
|
||||
}
|
||||
@ -1003,7 +1055,8 @@ vfs_get_current_dir (void)
|
||||
return current_dir;
|
||||
}
|
||||
|
||||
off_t mc_lseek (int fd, off_t offset, int whence)
|
||||
off_t
|
||||
mc_lseek (int fd, off_t offset, int whence)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
int result;
|
||||
@ -1015,7 +1068,7 @@ off_t mc_lseek (int fd, off_t offset, int whence)
|
||||
if (vfs == NULL)
|
||||
return -1;
|
||||
|
||||
result = vfs->lseek ? (*vfs->lseek)(vfs_info (fd), offset, whence) : -1;
|
||||
result = vfs->lseek ? (*vfs->lseek) (vfs_info (fd), offset, whence) : -1;
|
||||
if (result == -1)
|
||||
errno = vfs->lseek ? ferrno (vfs) : E_NOTSUPP;
|
||||
return result;
|
||||
@ -1031,10 +1084,11 @@ char *
|
||||
vfs_canon (const char *path)
|
||||
{
|
||||
if (!path)
|
||||
vfs_die("Cannot canonicalize NULL");
|
||||
vfs_die ("Cannot canonicalize NULL");
|
||||
|
||||
/* Relative to current directory */
|
||||
if (*path != PATH_SEP){
|
||||
if (*path != PATH_SEP)
|
||||
{
|
||||
char *local, *result;
|
||||
|
||||
local = concat_dir_and_file (current_dir, path);
|
||||
@ -1070,9 +1124,11 @@ mc_chdir (const char *path)
|
||||
|
||||
new_dir = vfs_canon (path);
|
||||
trans_dir = vfs_translate_path_n (new_dir);
|
||||
if (trans_dir != NULL) {
|
||||
if (trans_dir != NULL)
|
||||
{
|
||||
new_vfs = vfs_get_class (trans_dir);
|
||||
if (!new_vfs->chdir) {
|
||||
if (!new_vfs->chdir)
|
||||
{
|
||||
g_free (new_dir);
|
||||
g_free (trans_dir);
|
||||
return -1;
|
||||
@ -1080,7 +1136,8 @@ mc_chdir (const char *path)
|
||||
|
||||
result = (*new_vfs->chdir) (new_vfs, trans_dir);
|
||||
|
||||
if (result == -1) {
|
||||
if (result == -1)
|
||||
{
|
||||
errno = ferrno (new_vfs);
|
||||
g_free (new_dir);
|
||||
g_free (trans_dir);
|
||||
@ -1099,7 +1156,8 @@ mc_chdir (const char *path)
|
||||
vfs_stamp_create (old_vfs, old_vfsid);
|
||||
|
||||
/* Sometimes we assume no trailing slash on cwd */
|
||||
if (*current_dir) {
|
||||
if (*current_dir)
|
||||
{
|
||||
char *p;
|
||||
p = strchr (current_dir, 0) - 1;
|
||||
if (*p == PATH_SEP && p > current_dir)
|
||||
@ -1108,7 +1166,9 @@ mc_chdir (const char *path)
|
||||
|
||||
g_free (trans_dir);
|
||||
return 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (new_dir);
|
||||
return -1;
|
||||
}
|
||||
@ -1129,11 +1189,14 @@ vfs_file_class_flags (const char *filename)
|
||||
char *fname;
|
||||
|
||||
fname = vfs_canon_and_translate (filename);
|
||||
if (fname != NULL) {
|
||||
if (fname != NULL)
|
||||
{
|
||||
vfs = vfs_get_class (fname);
|
||||
g_free (fname);
|
||||
return vfs->flags;
|
||||
} else return -1;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
static char *
|
||||
@ -1153,7 +1216,8 @@ mc_def_getlocalcopy (const char *filename)
|
||||
|
||||
if (fdout == -1)
|
||||
goto fail;
|
||||
while ((i = mc_read (fdin, buffer, sizeof (buffer))) > 0) {
|
||||
while ((i = mc_read (fdin, buffer, sizeof (buffer))) > 0)
|
||||
{
|
||||
if (write (fdout, buffer, i) != i)
|
||||
goto fail;
|
||||
}
|
||||
@ -1163,12 +1227,14 @@ mc_def_getlocalcopy (const char *filename)
|
||||
fdin = -1;
|
||||
if (i == -1)
|
||||
goto fail;
|
||||
if (close (fdout) == -1) {
|
||||
if (close (fdout) == -1)
|
||||
{
|
||||
fdout = -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (mc_stat (filename, &mystat) != -1) {
|
||||
if (mc_stat (filename, &mystat) != -1)
|
||||
{
|
||||
chmod (tmp, mystat.st_mode);
|
||||
}
|
||||
return tmp;
|
||||
@ -1189,16 +1255,18 @@ mc_getlocalcopy (const char *pathname)
|
||||
char *path;
|
||||
|
||||
path = vfs_canon_and_translate (pathname);
|
||||
if (path != NULL) {
|
||||
if (path != NULL)
|
||||
{
|
||||
struct vfs_class *vfs = vfs_get_class (path);
|
||||
|
||||
result = vfs->getlocalcopy ? (*vfs->getlocalcopy)(vfs, path) :
|
||||
mc_def_getlocalcopy (path);
|
||||
result = vfs->getlocalcopy ? (*vfs->getlocalcopy) (vfs, path) : mc_def_getlocalcopy (path);
|
||||
g_free (path);
|
||||
if (!result)
|
||||
errno = ferrno (vfs);
|
||||
return result;
|
||||
} else return NULL;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1206,7 +1274,8 @@ mc_def_ungetlocalcopy (struct vfs_class *vfs, const char *filename,
|
||||
const char *local, int has_changed)
|
||||
{
|
||||
int fdin = -1, fdout = -1, i;
|
||||
if (has_changed) {
|
||||
if (has_changed)
|
||||
{
|
||||
char buffer[8192];
|
||||
|
||||
if (!vfs->write)
|
||||
@ -1218,19 +1287,22 @@ mc_def_ungetlocalcopy (struct vfs_class *vfs, const char *filename,
|
||||
fdout = mc_open (filename, O_WRONLY | O_TRUNC);
|
||||
if (fdout == -1)
|
||||
goto failed;
|
||||
while ((i = read (fdin, buffer, sizeof (buffer))) > 0) {
|
||||
while ((i = read (fdin, buffer, sizeof (buffer))) > 0)
|
||||
{
|
||||
if (mc_write (fdout, buffer, i) != i)
|
||||
goto failed;
|
||||
}
|
||||
if (i == -1)
|
||||
goto failed;
|
||||
|
||||
if (close (fdin) == -1) {
|
||||
if (close (fdin) == -1)
|
||||
{
|
||||
fdin = -1;
|
||||
goto failed;
|
||||
}
|
||||
fdin = -1;
|
||||
if (mc_close (fdout) == -1) {
|
||||
if (mc_close (fdout) == -1)
|
||||
{
|
||||
fdout = -1;
|
||||
goto failed;
|
||||
}
|
||||
@ -1255,15 +1327,18 @@ mc_ungetlocalcopy (const char *pathname, const char *local, int has_changed)
|
||||
char *path;
|
||||
|
||||
path = vfs_canon_and_translate (pathname);
|
||||
if (path != NULL) {
|
||||
if (path != NULL)
|
||||
{
|
||||
struct vfs_class *vfs = vfs_get_class (path);
|
||||
|
||||
return_value = vfs->ungetlocalcopy ?
|
||||
(*vfs->ungetlocalcopy)(vfs, path, local, has_changed) :
|
||||
(*vfs->ungetlocalcopy) (vfs, path, local, has_changed) :
|
||||
mc_def_ungetlocalcopy (vfs, path, local, has_changed);
|
||||
g_free (path);
|
||||
return return_value;
|
||||
} else return -1;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -1273,9 +1348,9 @@ vfs_init (void)
|
||||
/* create the VFS handle array */
|
||||
vfs_openfiles = g_ptr_array_new ();
|
||||
|
||||
vfs_str_buffer = g_string_new("");
|
||||
vfs_str_buffer = g_string_new ("");
|
||||
/* localfs needs to be the first one */
|
||||
init_localfs();
|
||||
init_localfs ();
|
||||
/* fallback value for vfs_get_class() */
|
||||
localfs_class = vfs_list;
|
||||
|
||||
@ -1329,7 +1404,7 @@ vfs_fill_names (fill_names_f func)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
|
||||
for (vfs=vfs_list; vfs; vfs=vfs->next)
|
||||
for (vfs = vfs_list; vfs; vfs = vfs->next)
|
||||
if (vfs->fill_names)
|
||||
(*vfs->fill_names) (vfs, func);
|
||||
}
|
||||
@ -1339,16 +1414,21 @@ vfs_fill_names (fill_names_f func)
|
||||
* not recognized as url, g_strdup(url) is returned.
|
||||
*/
|
||||
|
||||
static const struct {
|
||||
static const struct
|
||||
{
|
||||
const char *name;
|
||||
size_t name_len;
|
||||
const char *substitute;
|
||||
} url_table[] = { {"ftp://", 6, "/#ftp:"},
|
||||
{"mc://", 5, "/#mc:"},
|
||||
{"smb://", 6, "/#smb:"},
|
||||
{"sh://", 5, "/#sh:"},
|
||||
{"ssh://", 6, "/#sh:"},
|
||||
{"a:", 2, "/#a"}
|
||||
} url_table[] =
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
{ "ftp://", 6, "/#ftp:" },
|
||||
{ "mc://", 5, "/#mc:" },
|
||||
{ "smb://", 6, "/#smb:" },
|
||||
{ "sh://", 5, "/#sh:" },
|
||||
{ "ssh://", 6, "/#sh:" },
|
||||
{ "a:", 2, "/#a" }
|
||||
/* *INDENT-ON* */
|
||||
};
|
||||
|
||||
char *
|
||||
@ -1356,14 +1436,16 @@ vfs_translate_url (const char *url)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < sizeof (url_table)/sizeof (url_table[0]); i++)
|
||||
for (i = 0; i < sizeof (url_table) / sizeof (url_table[0]); i++)
|
||||
if (strncmp (url, url_table[i].name, url_table[i].name_len) == 0)
|
||||
return g_strconcat (url_table[i].substitute, url + url_table[i].name_len, (char*) NULL);
|
||||
return g_strconcat (url_table[i].substitute, url + url_table[i].name_len,
|
||||
(char *) NULL);
|
||||
|
||||
return g_strdup (url);
|
||||
}
|
||||
|
||||
int vfs_file_is_local (const char *filename)
|
||||
int
|
||||
vfs_file_is_local (const char *filename)
|
||||
{
|
||||
return vfs_file_class_flags (filename) & VFSF_LOCAL;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ context default
|
||||
keyword = brightcyan
|
||||
keyword ; brightmagenta
|
||||
keyword whole extensions yellow
|
||||
keyword whole extensions_case yellow
|
||||
keyword whole type yellow
|
||||
keyword DEVICE brightred
|
||||
keyword DIR brightred
|
||||
|
47
po/ko.po
47
po/ko.po
@ -14,9 +14,9 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Country: KOREA, REPUBLIC OF\n"
|
||||
"X-Poedit-Language: Korean\n"
|
||||
"X-Poedit-SourceCharset: utf-8\n"
|
||||
"X-Poedit-Country: KOREA, REPUBLIC OF\n"
|
||||
|
||||
msgid " Search string not found "
|
||||
msgstr "글월을 찾을 수 없군요 "
|
||||
@ -25,7 +25,7 @@ msgid " Not implemented yet "
|
||||
msgstr "아직 구현되지 않았습니다."
|
||||
|
||||
msgid " Num of replace tokens not equal to num of found tokens "
|
||||
msgstr " Num of replace tokens not equal to num of found tokens "
|
||||
msgstr "Num of replace tokens not equal to num of found tokens "
|
||||
|
||||
#, c-format
|
||||
msgid " Invalid token number %d "
|
||||
@ -35,7 +35,7 @@ msgid "Normal"
|
||||
msgstr "일반"
|
||||
|
||||
msgid "&Regular expression"
|
||||
msgstr "정규표현식(&R)"
|
||||
msgstr "정규 표현식(&R)"
|
||||
|
||||
msgid "Hexadecimal"
|
||||
msgstr "16진수"
|
||||
@ -395,7 +395,7 @@ msgid ""
|
||||
"%s"
|
||||
msgstr ""
|
||||
"파일의 끝에 알 수 없습니다\n"
|
||||
"% s"
|
||||
"%s"
|
||||
|
||||
#, c-format
|
||||
msgid "Directory cache expired for %s"
|
||||
@ -406,11 +406,11 @@ msgstr "선형 전송 시작..."
|
||||
|
||||
#, c-format
|
||||
msgid "%s: %s: %s %3d%% (%lu bytes transferred)"
|
||||
msgstr "%s: %s: %s %3d%% (%lu 바이트 전송됨)"
|
||||
msgstr "%s: %s: %s %3d%% (%lu 바이트 전송 됨)"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: %s: %s %lu bytes transferred"
|
||||
msgstr "%s: %s: %s %lu 바이트 전송됨"
|
||||
msgstr "%s: %s: %s %lu 바이트 전송 됨"
|
||||
|
||||
msgid "Getting file"
|
||||
msgstr "파일 받기"
|
||||
@ -432,7 +432,7 @@ msgstr "경고: %s 디렉터리을 바꿀 수 없습니다\n"
|
||||
|
||||
#, c-format
|
||||
msgid "fish: Disconnecting from %s"
|
||||
msgstr "fish : %s에서 분리중"
|
||||
msgstr "fish : %s에서 분리 중"
|
||||
|
||||
msgid "fish: Waiting for initial line..."
|
||||
msgstr "fish: 초기 라인을 기다림..."
|
||||
@ -457,7 +457,7 @@ msgstr "fish: 현재 디렉터리의 설정..."
|
||||
|
||||
#, c-format
|
||||
msgid "fish: Connected, home %s."
|
||||
msgstr "fish: 홈 %s , 접속됨."
|
||||
msgstr "fish: 홈 %s, 접속됨."
|
||||
|
||||
#, c-format
|
||||
msgid "fish: Reading directory %s..."
|
||||
@ -473,7 +473,7 @@ msgstr "%s: 실패"
|
||||
|
||||
#, c-format
|
||||
msgid "fish: store %s: sending command..."
|
||||
msgstr "fish: % s : 명령을 보내는 중..."
|
||||
msgstr "fish: %s : 명령을 보내는 중..."
|
||||
|
||||
msgid "fish: Local read failed, sending zeros"
|
||||
msgstr "fish: 상태 읽기 실패, 전송 제로"
|
||||
@ -547,7 +547,7 @@ msgstr " ftpfs: 서버로 연결할 수 없음: %s "
|
||||
|
||||
#, c-format
|
||||
msgid "Waiting to retry... %d (Control-C to cancel)"
|
||||
msgstr "재시도를 기다리는 중 ... % d (컨트롤 - C를 취소)"
|
||||
msgstr "재시도를 기다리는 중 ... %d (Contro-C로 취소)"
|
||||
|
||||
msgid "ftpfs: invalid address family"
|
||||
msgstr "ftpfs: 잘못된 주소 목록"
|
||||
@ -575,7 +575,7 @@ msgstr "ftpfs: 중지 실패"
|
||||
|
||||
#, fuzzy
|
||||
msgid "ftpfs: CWD failed."
|
||||
msgstr "ftpfs: CWD실패."
|
||||
msgstr "ftpfs : CWD에 실패했습니다."
|
||||
|
||||
msgid "ftpfs: couldn't resolve symlink"
|
||||
msgstr "ftpfs: 심볼릭 링크 해결 못함"
|
||||
@ -841,7 +841,7 @@ msgstr "모드"
|
||||
|
||||
#, c-format
|
||||
msgid "%6d of %d"
|
||||
msgstr "%6d of %d"
|
||||
msgstr "%6d 의 %d"
|
||||
|
||||
msgid " Chown advanced command "
|
||||
msgstr " 고급 chown 명령 "
|
||||
@ -1035,7 +1035,7 @@ msgid "Listing mode"
|
||||
msgstr "목록보기 설정"
|
||||
|
||||
msgid "user &Mini status"
|
||||
msgstr "사용자 &미니 상태 바(&M)"
|
||||
msgstr "사용자 미니 상태 바(&M)"
|
||||
|
||||
msgid "&OK"
|
||||
msgstr "확인(&O)"
|
||||
@ -1098,7 +1098,7 @@ msgid "Other 8 bit"
|
||||
msgstr "다른 8 비트"
|
||||
|
||||
msgid "Input / display codepage:"
|
||||
msgstr "입출력 코드페이지:"
|
||||
msgstr "입/출력 코드페이지:"
|
||||
|
||||
msgid "&Select"
|
||||
msgstr "선택(&S)"
|
||||
@ -1355,7 +1355,7 @@ msgid " Which menu file do you want to edit? "
|
||||
msgstr "어떤 메뉴 파일을 편집하고 싶으세요? "
|
||||
|
||||
msgid "&Local"
|
||||
msgstr "로칼(&L)"
|
||||
msgstr "로컬(&L)"
|
||||
|
||||
msgid "Highlighting groups file edit"
|
||||
msgstr "선택 표시된 그룹 파일을 수정"
|
||||
@ -1560,7 +1560,7 @@ msgid "&Safe save"
|
||||
msgstr "안전한 저장(&S)"
|
||||
|
||||
msgid "&Do backups with following extension:"
|
||||
msgstr "확장명을 다음과 같이 백업하지 않음(&D) :"
|
||||
msgstr "확장명을 다음과 같이 백업하지 않음(&D):"
|
||||
|
||||
msgid "Check &POSIX new line"
|
||||
msgstr "체크 POSIX의 새로운 라인(&P)"
|
||||
@ -1584,7 +1584,7 @@ msgid "&Windows/DOS format (CR LF)"
|
||||
msgstr "MS 도스/윈도우즈 포맷(&W) (CR LF)"
|
||||
|
||||
msgid "&Macintosh format (CR)"
|
||||
msgstr "메캔토시 포맷(&M) (CR)"
|
||||
msgstr "매캔토시 포맷(&M) (CR)"
|
||||
|
||||
msgid "Change line breaks to:"
|
||||
msgstr "깨진 라인 바꾸기:"
|
||||
@ -1629,7 +1629,7 @@ msgid " Load macro "
|
||||
msgstr "매크로 불러오기"
|
||||
|
||||
msgid " Confirm save file? : "
|
||||
msgstr "저장하시겠습니까? "
|
||||
msgstr "저장하시겠습니까? :"
|
||||
|
||||
msgid " Save file "
|
||||
msgstr "파일 저장"
|
||||
@ -1645,7 +1645,7 @@ msgstr ""
|
||||
" 저장 안하고 계속하실 겁니까? "
|
||||
|
||||
msgid "Syntax file edit"
|
||||
msgstr "문법 파일 수정(&M)"
|
||||
msgstr "문법 파일 수정"
|
||||
|
||||
msgid " Which syntax file you want to edit? "
|
||||
msgstr "수정하기를 원하는 문법 파일은? "
|
||||
@ -1676,7 +1676,7 @@ msgid "&Cancel quit"
|
||||
msgstr "끝내기 취소(&C)"
|
||||
|
||||
msgid " Error "
|
||||
msgstr "에러"
|
||||
msgstr "오류"
|
||||
|
||||
msgid " This function is not implemented. "
|
||||
msgstr "이 기능은 구현되지 않습니다."
|
||||
@ -1751,7 +1751,7 @@ msgid "Script created:"
|
||||
msgstr "스크립트 만듬:"
|
||||
|
||||
msgid "Process block"
|
||||
msgstr "Process block"
|
||||
msgstr "프로세스 블럭"
|
||||
|
||||
msgid " Copies to"
|
||||
msgstr "복사"
|
||||
@ -1811,7 +1811,7 @@ msgid "A&ll"
|
||||
msgstr "모두(&L)"
|
||||
|
||||
msgid " Replace with: "
|
||||
msgstr " ...로 바꿈: "
|
||||
msgstr "함께 바꿈: "
|
||||
|
||||
msgid " Confirm replace "
|
||||
msgstr "바꾸기 확인 "
|
||||
@ -2758,7 +2758,7 @@ msgid "Fr&ee VFSs now"
|
||||
msgstr "VFS를 지금 해제(&E)"
|
||||
|
||||
msgid "Change &To"
|
||||
msgstr "로 바꾸기(&T)"
|
||||
msgstr "바꾸기(&T)"
|
||||
|
||||
msgid "Subgroup - press ENTER to see list"
|
||||
msgstr "하위집단 - 보려면 엔터키를 누르십시오"
|
||||
@ -3755,4 +3755,3 @@ msgstr "기록을 삭제하기를 원하십니까?"
|
||||
|
||||
msgid "Background process:"
|
||||
msgstr "배경 프로세스:"
|
||||
|
||||
|
68
po/uk.po
68
po/uk.po
@ -15,8 +15,8 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Lokalize 1.0\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
msgid " Search string not found "
|
||||
msgstr " Така стрічка не знайдена "
|
||||
@ -340,7 +340,7 @@ msgstr "Тимчасові файли створюватися не будуть
|
||||
|
||||
#, c-format
|
||||
msgid "Press any key to continue..."
|
||||
msgstr "Натисніть пробіл для продовження..."
|
||||
msgstr "Натисніть пробіл для продовження…"
|
||||
|
||||
msgid "Warning"
|
||||
msgstr "Попередження"
|
||||
@ -404,7 +404,7 @@ msgid "Directory cache expired for %s"
|
||||
msgstr "Кеш каталога застарів для %s"
|
||||
|
||||
msgid "Starting linear transfer..."
|
||||
msgstr "Початок лінійного перенесення..."
|
||||
msgstr "Початок лінійного перенесення…"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: %s: %s %3d%% (%lu bytes transferred)"
|
||||
@ -438,7 +438,7 @@ msgid "fish: Disconnecting from %s"
|
||||
msgstr "fish: від'єднуюсь від %s"
|
||||
|
||||
msgid "fish: Waiting for initial line..."
|
||||
msgstr "fish: чекаю початковий рядок..."
|
||||
msgstr "fish: чекаю початковий рядок…"
|
||||
|
||||
msgid "Sorry, we cannot do password authenticated connections for now."
|
||||
msgstr "Вибачте, зараз неможливо створювати з'єднання, авторизовані паролем."
|
||||
@ -447,16 +447,16 @@ msgid " fish: Password required for "
|
||||
msgstr " fish: вимагається пароль для "
|
||||
|
||||
msgid "fish: Sending password..."
|
||||
msgstr "fish: відсилаю пароль..."
|
||||
msgstr "fish: відсилаю пароль…"
|
||||
|
||||
msgid "fish: Sending initial line..."
|
||||
msgstr "fish: відсилаю початковий рядок..."
|
||||
msgstr "fish: відсилаю початковий рядок…"
|
||||
|
||||
msgid "fish: Handshaking version..."
|
||||
msgstr "fish: домовляюсь про версію..."
|
||||
msgstr "fish: домовляюсь про версію…"
|
||||
|
||||
msgid "fish: Setting up current directory..."
|
||||
msgstr "fish: встановлюю поточний каталог..."
|
||||
msgstr "fish: встановлюю поточний каталог…"
|
||||
|
||||
#, c-format
|
||||
msgid "fish: Connected, home %s."
|
||||
@ -464,7 +464,7 @@ msgstr "fish: з'єднався, домашній каталог %s."
|
||||
|
||||
#, c-format
|
||||
msgid "fish: Reading directory %s..."
|
||||
msgstr "fish: читаю каталог %s..."
|
||||
msgstr "fish: читаю каталог %s…"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: done."
|
||||
@ -476,7 +476,7 @@ msgstr "%s: збій"
|
||||
|
||||
#, c-format
|
||||
msgid "fish: store %s: sending command..."
|
||||
msgstr "fish: запис %s: відсилаю команду..."
|
||||
msgstr "fish: запис %s: відсилаю команду…"
|
||||
|
||||
msgid "fish: Local read failed, sending zeros"
|
||||
msgstr "fish: Збій локального читання, відсилаються нулі"
|
||||
@ -492,7 +492,7 @@ msgid "file"
|
||||
msgstr "файл"
|
||||
|
||||
msgid "Aborting transfer..."
|
||||
msgstr "Переривання перенесення..."
|
||||
msgstr "Переривання перенесення…"
|
||||
|
||||
msgid "Error reported after abort."
|
||||
msgstr "Повідомлена помилка після переривання."
|
||||
@ -550,7 +550,7 @@ msgstr "ftpfs: збій з'єднання з сервером: %s"
|
||||
|
||||
#, c-format
|
||||
msgid "Waiting to retry... %d (Control-C to cancel)"
|
||||
msgstr "Очікування повтору спроби... %d (Control-C для скасування)"
|
||||
msgstr "Очікування повтору спроби… %d (Control-C для скасування)"
|
||||
|
||||
msgid "ftpfs: invalid address family"
|
||||
msgstr "ftpfs: неправильний рід адреси"
|
||||
@ -585,11 +585,11 @@ msgid "ftpfs: couldn't resolve symlink"
|
||||
msgstr "ftpfs: не зміг розпізнати символьне посилання"
|
||||
|
||||
msgid "Resolving symlink..."
|
||||
msgstr "Розпізнається символьне посилання..."
|
||||
msgstr "Розпізнається символьне посилання…"
|
||||
|
||||
#, c-format
|
||||
msgid "ftpfs: Reading FTP directory %s... %s%s"
|
||||
msgstr "ftpfs: Читання каталога FTP %s... %s%s"
|
||||
msgstr "ftpfs: Читання каталога FTP %s… %s%s"
|
||||
|
||||
msgid "(strict rfc959)"
|
||||
msgstr "(обмеження rfc959)"
|
||||
@ -724,7 +724,7 @@ msgid ""
|
||||
"%s\n"
|
||||
"doesn't look like a tar archive."
|
||||
msgstr ""
|
||||
"Гм,...\n"
|
||||
"Гм,…\n"
|
||||
"%s\n"
|
||||
"не схожий на tar-архів."
|
||||
|
||||
@ -768,25 +768,25 @@ msgid " Cannot open file %s "
|
||||
msgstr " Не вдалося відкрити файл %s "
|
||||
|
||||
msgid "undelfs: reading inode bitmap..."
|
||||
msgstr "undelfs: читання бітової мапи i-вузлів..."
|
||||
msgstr "undelfs: читання бітової карти i-вузлів…"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Cannot load inode bitmap from: \n"
|
||||
" %s \n"
|
||||
msgstr ""
|
||||
" Не вдалося завантажити бітову мапу i-вузлів з:\n"
|
||||
" Не вдалося завантажити бітову карту i-вузлів з:\n"
|
||||
" %s \n"
|
||||
|
||||
msgid "undelfs: reading block bitmap..."
|
||||
msgstr "undelfs: читання блоку бітової мапи..."
|
||||
msgstr "undelfs: читання блоку бітової карти…"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Cannot load block bitmap from: \n"
|
||||
" %s \n"
|
||||
msgstr ""
|
||||
" Не вдалося завантажити блок бітової мапи з:\n"
|
||||
" Не вдалося завантажити блок бітової карти з:\n"
|
||||
" %s \n"
|
||||
|
||||
msgid " vfs_info is not fs! "
|
||||
@ -1847,7 +1847,7 @@ msgid "&Ignore lock"
|
||||
msgstr "Ігнорувати замок"
|
||||
|
||||
msgid "&Open file..."
|
||||
msgstr "&Відкрити файл..."
|
||||
msgstr "&Відкрити файл…"
|
||||
|
||||
msgid "&New"
|
||||
msgstr "Новий"
|
||||
@ -1994,7 +1994,7 @@ msgid "&External formatter"
|
||||
msgstr "З&овнішня програма форматування"
|
||||
|
||||
msgid "&General... "
|
||||
msgstr "&Загальні... "
|
||||
msgstr "&Загальні…"
|
||||
|
||||
msgid "Save &mode..."
|
||||
msgstr "Режим &збереження…"
|
||||
@ -2973,7 +2973,7 @@ msgid " Panel split "
|
||||
msgstr " Розбиття панелей "
|
||||
|
||||
msgid " Highlight... "
|
||||
msgstr " Підсвітка... "
|
||||
msgstr " Підсвітка…"
|
||||
|
||||
msgid " Other options "
|
||||
msgstr " Інші параметри "
|
||||
@ -3054,7 +3054,7 @@ msgid " Do you really want to quit the Midnight Commander? "
|
||||
msgstr " Ви дійсно хочете вийти з Midnight Commander? "
|
||||
|
||||
msgid "&Listing mode..."
|
||||
msgstr "Фор&мат списку..."
|
||||
msgstr "Фор&мат списку…"
|
||||
|
||||
msgid "&Quick view"
|
||||
msgstr "Швидкий перегляд"
|
||||
@ -3063,25 +3063,25 @@ msgid "&Info"
|
||||
msgstr "Інформація"
|
||||
|
||||
msgid "&Sort order..."
|
||||
msgstr "Порядок &сортування"
|
||||
msgstr "Порядок &сортування…"
|
||||
|
||||
msgid "&Filter..."
|
||||
msgstr "&Фільтр..."
|
||||
msgstr "&Фільтр…"
|
||||
|
||||
msgid "&Encoding..."
|
||||
msgstr "Кодування…"
|
||||
|
||||
msgid "&Network link..."
|
||||
msgstr "Ме&режне з'єднання..."
|
||||
msgstr "Ме&режне з'єднання…"
|
||||
|
||||
msgid "FT&P link..."
|
||||
msgstr "&FTP-з'єднання..."
|
||||
msgstr "&FTP-з'єднання…"
|
||||
|
||||
msgid "S&hell link..."
|
||||
msgstr "Зв'язок через &shell..."
|
||||
msgstr "Зв'язок через &shell…"
|
||||
|
||||
msgid "SM&B link..."
|
||||
msgstr "Зв'язок через &SMB..."
|
||||
msgstr "Зв'язок через &SMB…"
|
||||
|
||||
msgid "&Rescan"
|
||||
msgstr "Пересканувати"
|
||||
@ -3189,19 +3189,19 @@ msgid "Edit hi&ghlighting group file"
|
||||
msgstr "Редагувати файл підсвітки груп"
|
||||
|
||||
msgid "&Configuration..."
|
||||
msgstr "&Конфігурація..."
|
||||
msgstr "&Конфігурація…"
|
||||
|
||||
msgid "&Layout..."
|
||||
msgstr "&Макет..."
|
||||
msgstr "&Макет…"
|
||||
|
||||
msgid "C&onfirmation..."
|
||||
msgstr "&Підтвердження…"
|
||||
|
||||
msgid "&Display bits..."
|
||||
msgstr "&Відображення символів..."
|
||||
msgstr "&Відображення символів…"
|
||||
|
||||
msgid "&Virtual FS..."
|
||||
msgstr "Віртуальні &ФС..."
|
||||
msgstr "Віртуальні &ФС…"
|
||||
|
||||
msgid "&Above"
|
||||
msgstr "Верхня"
|
||||
@ -3325,7 +3325,7 @@ msgid " Panel options "
|
||||
msgstr " Параметри панелей "
|
||||
|
||||
msgid " Pause after run... "
|
||||
msgstr " Пауза після виконання... "
|
||||
msgstr " Пауза після виконання…"
|
||||
|
||||
msgid "Configure options"
|
||||
msgstr "Параметри конфігурації"
|
||||
|
498
src/complete.c
498
src/complete.c
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
1382
src/editor/edit.c
1382
src/editor/edit.c
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1881,7 +1881,6 @@ void
|
||||
edit_search_cmd (WEdit * edit, int again)
|
||||
{
|
||||
char *search_string = NULL, *search_string_dup = NULL;
|
||||
|
||||
gsize len = 0;
|
||||
|
||||
if (!edit)
|
||||
@ -1910,36 +1909,45 @@ edit_search_cmd (WEdit * edit, int again)
|
||||
{
|
||||
#ifdef HAVE_CHARSET
|
||||
GString *tmp;
|
||||
|
||||
if (search_string && *search_string)
|
||||
{
|
||||
tmp = str_convert_to_display (search_string);
|
||||
|
||||
g_free (search_string_dup);
|
||||
search_string_dup = NULL;
|
||||
|
||||
if (tmp && tmp->len)
|
||||
search_string = search_string_dup = tmp->str;
|
||||
g_string_free (tmp, FALSE);
|
||||
if (tmp != NULL)
|
||||
{
|
||||
if (tmp->len == 0)
|
||||
g_string_free (tmp, TRUE);
|
||||
else
|
||||
{
|
||||
g_free (search_string);
|
||||
search_string = search_string_dup = g_string_free (tmp, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_CHARSET */
|
||||
editcmd_dialog_search_show (edit, &search_string);
|
||||
g_free (search_string_dup);
|
||||
search_string_dup = NULL;
|
||||
#ifdef HAVE_CHARSET
|
||||
if (search_string && *search_string)
|
||||
{
|
||||
tmp = str_convert_to_input (search_string);
|
||||
if (tmp && tmp->len)
|
||||
search_string = tmp->str;
|
||||
|
||||
g_string_free (tmp, FALSE);
|
||||
|
||||
if (search_string_dup)
|
||||
g_free (search_string_dup);
|
||||
if (tmp != NULL)
|
||||
{
|
||||
if (tmp->len == 0)
|
||||
g_string_free (tmp, TRUE);
|
||||
else
|
||||
{
|
||||
g_free (search_string);
|
||||
search_string = g_string_free (tmp, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
edit_push_action (edit, KEY_PRESS + edit->start_display);
|
||||
|
||||
if (!search_string)
|
||||
if (search_string == NULL)
|
||||
{
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
edit_scroll_screen_over_cursor (edit);
|
||||
@ -1959,8 +1967,10 @@ edit_search_cmd (WEdit * edit, int again)
|
||||
if (edit->search == NULL)
|
||||
{
|
||||
edit->search_start = edit->curs1;
|
||||
g_free (search_string);
|
||||
return;
|
||||
}
|
||||
|
||||
edit->search->search_type = edit_search_options.type;
|
||||
edit->search->is_all_charsets = edit_search_options.all_codepages;
|
||||
edit->search->is_case_sentitive = edit_search_options.case_sens;
|
||||
@ -1968,6 +1978,8 @@ edit_search_cmd (WEdit * edit, int again)
|
||||
edit->search->search_fn = edit_search_cmd_callback;
|
||||
}
|
||||
|
||||
g_free (search_string);
|
||||
|
||||
if (search_create_bookmark)
|
||||
{
|
||||
edit_search_cmd_search_create_bookmark (edit);
|
||||
|
@ -93,7 +93,7 @@ void
|
||||
editcmd_dialog_replace_show (WEdit * edit, const char *search_default, const char *replace_default,
|
||||
/*@out@ */ char **search_text, /*@out@ */ char **replace_text)
|
||||
{
|
||||
if (*search_default == '\0')
|
||||
if ((search_default == NULL) || (*search_default == '\0'))
|
||||
search_default = INPUT_LAST_TEXT;
|
||||
|
||||
{
|
||||
@ -162,7 +162,7 @@ editcmd_dialog_search_show (WEdit * edit, char **search_text)
|
||||
{
|
||||
(void) edit;
|
||||
|
||||
if (*search_text == '\0')
|
||||
if (*search_text == NULL)
|
||||
*search_text = INPUT_LAST_TEXT;
|
||||
|
||||
{
|
||||
|
@ -1054,6 +1054,7 @@ move_file_file (FileOpTotalContext *tctx, FileOpContext *ctx, const char *s, con
|
||||
struct stat src_stats, dst_stats;
|
||||
FileProgressStatus return_status = FILE_CONT;
|
||||
gboolean copy_done = FALSE;
|
||||
gboolean old_ask_overwrite;
|
||||
|
||||
file_progress_show_source (ctx, s);
|
||||
file_progress_show_target (ctx, d);
|
||||
@ -1121,7 +1122,10 @@ move_file_file (FileOpTotalContext *tctx, FileOpContext *ctx, const char *s, con
|
||||
#endif
|
||||
|
||||
/* Failed because filesystem boundary -> copy the file instead */
|
||||
old_ask_overwrite = tctx->ask_overwrite;
|
||||
tctx->ask_overwrite = FALSE;
|
||||
return_status = copy_file_file (tctx, ctx, s, d);
|
||||
tctx->ask_overwrite = old_ask_overwrite;
|
||||
if (return_status != FILE_CONT)
|
||||
return return_status;
|
||||
|
||||
|
@ -960,7 +960,7 @@ file_mask_dialog (FileOpContext * ctx, FileOperation operation,
|
||||
/* 9 - OFFSET */
|
||||
QUICK_CHECKBOX (37, FMDX, 4, FMDY, N_("&Using shell patterns"), &source_easy_patterns),
|
||||
/* 10 - OFFSET */
|
||||
QUICK_INPUT (3, FMDX, 3, FMDY, easy_patterns ? "*" : "^\\(.*\\)$", 58, 0, "input-def",
|
||||
QUICK_INPUT (3, FMDX, 3, FMDY, easy_patterns ? "*" : "^(.*)$", 58, 0, "input-def",
|
||||
&source_mask),
|
||||
/* 11 - OFFSET */
|
||||
QUICK_LABEL (3, FMDX, 2, FMDY, fmd_buf),
|
||||
|
413
src/help.c
413
src/help.c
@ -15,7 +15,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
/** \file help.c
|
||||
@ -71,7 +71,7 @@ const global_keymap_t *help_map;
|
||||
|
||||
#define MAXLINKNAME 80
|
||||
#define HISTORY_SIZE 20
|
||||
#define HELP_WINDOW_WIDTH (HELP_TEXT_WIDTH + 4)
|
||||
#define HELP_WINDOW_WIDTH (COLS - 16)
|
||||
|
||||
#define STRING_LINK_START "\01"
|
||||
#define STRING_LINK_POINTER "\02"
|
||||
@ -91,23 +91,23 @@ static const char *selected_item;
|
||||
/* The widget variables */
|
||||
static Dlg_head *whelp;
|
||||
|
||||
static struct {
|
||||
static struct
|
||||
{
|
||||
const char *page; /* Pointer to the selected page */
|
||||
const char *link; /* Pointer to the selected link */
|
||||
} history [HISTORY_SIZE];
|
||||
} history[HISTORY_SIZE];
|
||||
|
||||
/* Link areas for the mouse */
|
||||
typedef struct Link_Area {
|
||||
typedef struct Link_Area
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
const char *link_name;
|
||||
struct Link_Area *next;
|
||||
} Link_Area;
|
||||
|
||||
static Link_Area *link_area = NULL;
|
||||
static GSList *link_area = NULL;
|
||||
static gboolean inside_link_area = FALSE;
|
||||
|
||||
static cb_ret_t help_callback (Dlg_head *h, Widget *sender,
|
||||
dlg_msg_t msg, int parm, void *data);
|
||||
static cb_ret_t help_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data);
|
||||
|
||||
/* returns the position where text was found in the start buffer */
|
||||
/* or 0 if not found */
|
||||
@ -121,19 +121,22 @@ search_string (const char *start, const char *text)
|
||||
|
||||
/* fmt sometimes replaces a space with a newline in the help file */
|
||||
/* Replace the newlines in the link name with spaces to correct the situation */
|
||||
while (*d != '\0') {
|
||||
while (*d != '\0')
|
||||
{
|
||||
if (*d == '\n')
|
||||
*d = ' ';
|
||||
str_next_char (&d);
|
||||
}
|
||||
|
||||
/* Do search */
|
||||
for (d = local_text; *e; e++){
|
||||
for (d = local_text; *e; e++)
|
||||
{
|
||||
if (*d == *e)
|
||||
d++;
|
||||
else
|
||||
d = local_text;
|
||||
if (*d == '\0') {
|
||||
if (*d == '\0')
|
||||
{
|
||||
result = e + 1;
|
||||
break;
|
||||
}
|
||||
@ -152,7 +155,8 @@ search_string_node (const char *start, const char *text)
|
||||
const char *e = start;
|
||||
|
||||
if (start != NULL)
|
||||
for (; *e && *e != CHAR_NODE_END; e++) {
|
||||
for (; *e && *e != CHAR_NODE_END; e++)
|
||||
{
|
||||
if (*d == *e)
|
||||
d++;
|
||||
else
|
||||
@ -186,8 +190,8 @@ move_forward2 (const char *c, int lines)
|
||||
int line;
|
||||
|
||||
currentpoint = c;
|
||||
for (line = 0, p = currentpoint; (*p != '\0') && (*p != CHAR_NODE_END);
|
||||
str_cnext_char (&p)) {
|
||||
for (line = 0, p = currentpoint; (*p != '\0') && (*p != CHAR_NODE_END); str_cnext_char (&p))
|
||||
{
|
||||
if (line == lines)
|
||||
return currentpoint = p;
|
||||
|
||||
@ -204,9 +208,10 @@ move_backward2 (const char *c, int lines)
|
||||
int line;
|
||||
|
||||
currentpoint = c;
|
||||
for (line = 0, p = currentpoint; (*p != '\0') && ((int) (p - fdata) >= 0);
|
||||
str_cprev_char (&p)) {
|
||||
if (*p == CHAR_NODE_END) {
|
||||
for (line = 0, p = currentpoint; (*p != '\0') && ((int) (p - fdata) >= 0); str_cprev_char (&p))
|
||||
{
|
||||
if (*p == CHAR_NODE_END)
|
||||
{
|
||||
/* We reached the beginning of the node */
|
||||
/* Skip the node headers */
|
||||
while (*p != ']')
|
||||
@ -253,13 +258,13 @@ move_to_bottom (void)
|
||||
while ((*currentpoint != '\0') && (*currentpoint != CHAR_NODE_END))
|
||||
currentpoint++;
|
||||
currentpoint--;
|
||||
move_backward (help_lines - 1);
|
||||
move_backward (1);
|
||||
}
|
||||
|
||||
static const char *
|
||||
help_follow_link (const char *start, const char *lc_selected_item)
|
||||
{
|
||||
char link_name [MAXLINKNAME];
|
||||
char link_name[MAXLINKNAME];
|
||||
const char *p;
|
||||
int i = 0;
|
||||
|
||||
@ -268,14 +273,16 @@ help_follow_link (const char *start, const char *lc_selected_item)
|
||||
|
||||
for (p = lc_selected_item; *p && *p != CHAR_NODE_END && *p != CHAR_LINK_POINTER; p++)
|
||||
;
|
||||
if (*p == CHAR_LINK_POINTER){
|
||||
link_name [0] = '[';
|
||||
for (i = 1; *p != CHAR_LINK_END && *p && *p != CHAR_NODE_END && i < MAXLINKNAME-3; )
|
||||
link_name [i++] = *++p;
|
||||
link_name [i - 1] = ']';
|
||||
link_name [i] = '\0';
|
||||
if (*p == CHAR_LINK_POINTER)
|
||||
{
|
||||
link_name[0] = '[';
|
||||
for (i = 1; *p != CHAR_LINK_END && *p && *p != CHAR_NODE_END && i < MAXLINKNAME - 3;)
|
||||
link_name[i++] = *++p;
|
||||
link_name[i - 1] = ']';
|
||||
link_name[i] = '\0';
|
||||
p = search_string (fdata, link_name);
|
||||
if (p != NULL) {
|
||||
if (p != NULL)
|
||||
{
|
||||
p += 1; /* Skip the newline following the start of the node */
|
||||
return p;
|
||||
}
|
||||
@ -305,30 +312,25 @@ select_next_link (const char *current_link)
|
||||
static const char *
|
||||
select_prev_link (const char *current_link)
|
||||
{
|
||||
return current_link == NULL
|
||||
? NULL
|
||||
: search_char_node (current_link - 1, CHAR_LINK_START, -1);
|
||||
return current_link == NULL ? NULL : search_char_node (current_link - 1, CHAR_LINK_START, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
start_link_area (int x, int y, const char *link_name)
|
||||
{
|
||||
Link_Area *new;
|
||||
Link_Area *la;
|
||||
|
||||
if (inside_link_area)
|
||||
message (D_NORMAL, _("Warning"), _(" Internal bug: Double start of link area "));
|
||||
|
||||
/* Allocate memory for a new link area */
|
||||
new = g_new (Link_Area, 1);
|
||||
new->next = link_area;
|
||||
link_area = new;
|
||||
|
||||
la = g_new (Link_Area, 1);
|
||||
/* Save the beginning coordinates of the link area */
|
||||
link_area->x1 = x;
|
||||
link_area->y1 = y;
|
||||
|
||||
la->x1 = x;
|
||||
la->y1 = y;
|
||||
/* Save the name of the destination anchor */
|
||||
link_area->link_name = link_name;
|
||||
la->link_name = link_name;
|
||||
link_area = g_slist_prepend (link_area, la);
|
||||
|
||||
inside_link_area = TRUE;
|
||||
}
|
||||
@ -336,10 +338,12 @@ start_link_area (int x, int y, const char *link_name)
|
||||
static void
|
||||
end_link_area (int x, int y)
|
||||
{
|
||||
if (inside_link_area) {
|
||||
if (inside_link_area)
|
||||
{
|
||||
Link_Area *la = (Link_Area *) link_area->data;
|
||||
/* Save the end coordinates of the link area */
|
||||
link_area->x2 = x;
|
||||
link_area->y2 = y;
|
||||
la->x2 = x;
|
||||
la->y2 = y;
|
||||
inside_link_area = FALSE;
|
||||
}
|
||||
}
|
||||
@ -347,30 +351,71 @@ end_link_area (int x, int y)
|
||||
static void
|
||||
clear_link_areas (void)
|
||||
{
|
||||
Link_Area *current;
|
||||
|
||||
while (link_area != NULL) {
|
||||
current = link_area;
|
||||
link_area = current->next;
|
||||
g_free (current);
|
||||
}
|
||||
|
||||
g_slist_foreach (link_area, (GFunc) g_free, NULL);
|
||||
g_slist_free (link_area);
|
||||
link_area = NULL;
|
||||
inside_link_area = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
help_show (Dlg_head *h, const char *paint_start)
|
||||
help_print_word (Dlg_head * h, GString * word, int *col, int *line, gboolean add_space)
|
||||
{
|
||||
if (*line >= help_lines)
|
||||
g_string_set_size (word, 0);
|
||||
else
|
||||
{
|
||||
int w;
|
||||
|
||||
w = str_term_width1 (word->str);
|
||||
if (*col + w >= HELP_WINDOW_WIDTH)
|
||||
{
|
||||
*col = 0;
|
||||
(*line)++;
|
||||
}
|
||||
|
||||
if (*line >= help_lines)
|
||||
g_string_set_size (word, 0);
|
||||
else
|
||||
{
|
||||
dlg_move (h, *line + 2, *col + 2);
|
||||
tty_print_string (word->str);
|
||||
g_string_set_size (word, 0);
|
||||
*col += w;
|
||||
}
|
||||
}
|
||||
|
||||
if (add_space)
|
||||
{
|
||||
if (*col < HELP_WINDOW_WIDTH - 1)
|
||||
{
|
||||
tty_print_char (' ');
|
||||
(*col)++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*col = 0;
|
||||
(*line)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
help_show (Dlg_head * h, const char *paint_start)
|
||||
{
|
||||
const char *p, *n;
|
||||
int col, line, c, w;
|
||||
int col, line, c;
|
||||
gboolean painting = TRUE;
|
||||
gboolean acs; /* Flag: Alternate character set active? */
|
||||
gboolean repeat_paint;
|
||||
int active_col, active_line; /* Active link position */
|
||||
static char buff[MB_LEN_MAX + 1];
|
||||
char buff[MB_LEN_MAX + 1];
|
||||
GString *word;
|
||||
|
||||
word = g_string_sized_new (32);
|
||||
|
||||
tty_setcolor (HELP_NORMAL_COLOR);
|
||||
do {
|
||||
do
|
||||
{
|
||||
line = col = active_col = active_line = 0;
|
||||
repeat_paint = FALSE;
|
||||
acs = FALSE;
|
||||
@ -381,26 +426,29 @@ help_show (Dlg_head *h, const char *paint_start)
|
||||
|
||||
p = paint_start;
|
||||
n = paint_start;
|
||||
while (n[0] != '\0' && n[0] != CHAR_NODE_END && line < help_lines) {
|
||||
while ((n[0] != '\0') && (n[0] != CHAR_NODE_END) && (line < help_lines))
|
||||
{
|
||||
p = n;
|
||||
n = str_cget_next_char (p);
|
||||
memcpy (buff, p, n - p);
|
||||
buff[n - p] = '\0';
|
||||
|
||||
c = (unsigned char) buff[0];
|
||||
switch (c){
|
||||
switch (c)
|
||||
{
|
||||
case CHAR_LINK_START:
|
||||
if (selected_item == NULL)
|
||||
selected_item = p;
|
||||
if (p == selected_item){
|
||||
if (p != selected_item)
|
||||
tty_setcolor (HELP_LINK_COLOR);
|
||||
else
|
||||
{
|
||||
tty_setcolor (HELP_SLINK_COLOR);
|
||||
|
||||
/* Store the coordinates of the link */
|
||||
active_col = col + 2;
|
||||
active_line = line + 2;
|
||||
}
|
||||
else
|
||||
tty_setcolor (HELP_LINK_COLOR);
|
||||
start_link_area (col, line, p);
|
||||
break;
|
||||
case CHAR_LINK_POINTER:
|
||||
@ -409,6 +457,7 @@ help_show (Dlg_head *h, const char *paint_start)
|
||||
break;
|
||||
case CHAR_LINK_END:
|
||||
painting = TRUE;
|
||||
help_print_word (h, word, &col, &line, FALSE);
|
||||
tty_setcolor (HELP_NORMAL_COLOR);
|
||||
break;
|
||||
case CHAR_ALTERNATE:
|
||||
@ -418,7 +467,7 @@ help_show (Dlg_head *h, const char *paint_start)
|
||||
acs = FALSE;
|
||||
break;
|
||||
case CHAR_VERSION:
|
||||
dlg_move (h, line+2, col+2);
|
||||
dlg_move (h, line + 2, col + 2);
|
||||
tty_print_string (VERSION);
|
||||
col += str_term_width1 (VERSION);
|
||||
break;
|
||||
@ -429,50 +478,73 @@ help_show (Dlg_head *h, const char *paint_start)
|
||||
tty_setcolor (HELP_ITALIC_COLOR);
|
||||
break;
|
||||
case CHAR_FONT_NORMAL:
|
||||
help_print_word (h, word, &col, &line, FALSE);
|
||||
tty_setcolor (HELP_NORMAL_COLOR);
|
||||
break;
|
||||
case '\n':
|
||||
if (painting)
|
||||
help_print_word (h, word, &col, &line, FALSE);
|
||||
line++;
|
||||
col = 0;
|
||||
break;
|
||||
case '\t':
|
||||
col = (col / 8 + 1) * 8;
|
||||
if (col >= HELP_WINDOW_WIDTH)
|
||||
{
|
||||
line++;
|
||||
col = 8;
|
||||
}
|
||||
break;
|
||||
case ' ':
|
||||
/* word delimeter */
|
||||
if (painting)
|
||||
help_print_word (h, word, &col, &line, TRUE);
|
||||
break;
|
||||
default:
|
||||
if (!painting)
|
||||
continue;
|
||||
w = str_term_width1 (buff);
|
||||
if (col + w > HELP_WINDOW_WIDTH)
|
||||
continue;
|
||||
|
||||
dlg_move (h, line + 2, col + 2);
|
||||
if (painting && (line < help_lines))
|
||||
{
|
||||
if (!acs)
|
||||
tty_print_string (buff);
|
||||
else if (c == ' ' || c == '.')
|
||||
/* accumulate symbols in a word */
|
||||
g_string_append (word, buff);
|
||||
else if (col < HELP_WINDOW_WIDTH)
|
||||
{
|
||||
dlg_move (h, line + 2, col + 2);
|
||||
|
||||
if ((c == ' ') || (c == '.'))
|
||||
tty_print_char (c);
|
||||
else
|
||||
#ifndef HAVE_SLANG
|
||||
tty_print_char (acs_map [c]);
|
||||
tty_print_char (acs_map[c]);
|
||||
#else
|
||||
SLsmg_draw_object (h->y + line + 2, h->x + col + 2, c);
|
||||
#endif
|
||||
col += w;
|
||||
break;
|
||||
col++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* print last word */
|
||||
if (n[0] == CHAR_NODE_END)
|
||||
help_print_word (h, word, &col, &line, FALSE);
|
||||
|
||||
last_shown = p;
|
||||
end_of_node = line < help_lines;
|
||||
tty_setcolor (HELP_NORMAL_COLOR);
|
||||
if ((int) (selected_item - last_shown) >= 0) {
|
||||
if (link_area == NULL)
|
||||
if ((int) (selected_item - last_shown) >= 0)
|
||||
{
|
||||
if ((link_area == NULL) || (link_area->data == NULL))
|
||||
selected_item = NULL;
|
||||
else {
|
||||
selected_item = link_area->link_name;
|
||||
else
|
||||
{
|
||||
selected_item = ((Link_Area *) link_area->data)->link_name;
|
||||
repeat_paint = TRUE;
|
||||
}
|
||||
}
|
||||
} while (repeat_paint);
|
||||
}
|
||||
while (repeat_paint);
|
||||
|
||||
g_string_free (word, TRUE);
|
||||
|
||||
/* Position the cursor over a nice link */
|
||||
if (active_col)
|
||||
@ -480,10 +552,10 @@ help_show (Dlg_head *h, const char *paint_start)
|
||||
}
|
||||
|
||||
static int
|
||||
help_event (Gpm_Event *event, void *vp)
|
||||
help_event (Gpm_Event * event, void *vp)
|
||||
{
|
||||
Widget *w = vp;
|
||||
Link_Area *current_area;
|
||||
GSList *current_area;
|
||||
|
||||
if ((event->type & GPM_UP) == 0)
|
||||
return 0;
|
||||
@ -492,52 +564,55 @@ help_event (Gpm_Event *event, void *vp)
|
||||
event->x -= 2;
|
||||
event->y -= 2;
|
||||
|
||||
if (event->buttons & GPM_B_RIGHT){
|
||||
currentpoint = history [history_ptr].page;
|
||||
selected_item = history [history_ptr].link;
|
||||
if (event->buttons & GPM_B_RIGHT)
|
||||
{
|
||||
currentpoint = history[history_ptr].page;
|
||||
selected_item = history[history_ptr].link;
|
||||
history_ptr--;
|
||||
if (history_ptr < 0)
|
||||
history_ptr = HISTORY_SIZE-1;
|
||||
history_ptr = HISTORY_SIZE - 1;
|
||||
|
||||
help_callback (w->parent, NULL, DLG_DRAW, 0, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Test whether the mouse click is inside one of the link areas */
|
||||
current_area = link_area;
|
||||
while (current_area != NULL)
|
||||
for (current_area = link_area; current_area != NULL; current_area = g_slist_next (current_area))
|
||||
{
|
||||
Link_Area *la = (Link_Area *) current_area->data;
|
||||
/* Test one line link area */
|
||||
if (event->y == current_area->y1 && event->x >= current_area->x1 &&
|
||||
event->y == current_area->y2 && event->x <= current_area->x2)
|
||||
if (event->y == la->y1 && event->x >= la->x1 && event->y == la->y2 && event->x <= la->x2)
|
||||
break;
|
||||
/* Test two line link area */
|
||||
if (current_area->y1 + 1 == current_area->y2){
|
||||
if (la->y1 + 1 == la->y2)
|
||||
{
|
||||
/* The first line */
|
||||
if (event->y == current_area->y1 && event->x >= current_area->x1)
|
||||
if (event->y == la->y1 && event->x >= la->x1)
|
||||
break;
|
||||
/* The second line */
|
||||
if (event->y == current_area->y2 && event->x <= current_area->x2)
|
||||
if (event->y == la->y2 && event->x <= la->x2)
|
||||
break;
|
||||
}
|
||||
/* Mouse will not work with link areas of more than two lines */
|
||||
|
||||
current_area = current_area->next;
|
||||
}
|
||||
|
||||
/* Test whether a link area was found */
|
||||
if (current_area != NULL) {
|
||||
if (current_area != NULL)
|
||||
{
|
||||
Link_Area *la = (Link_Area *) current_area->data;
|
||||
|
||||
/* The click was inside a link area -> follow the link */
|
||||
history_ptr = (history_ptr+1) % HISTORY_SIZE;
|
||||
history [history_ptr].page = currentpoint;
|
||||
history [history_ptr].link = current_area->link_name;
|
||||
currentpoint = help_follow_link (currentpoint, current_area->link_name);
|
||||
history_ptr = (history_ptr + 1) % HISTORY_SIZE;
|
||||
history[history_ptr].page = currentpoint;
|
||||
history[history_ptr].link = la->link_name;
|
||||
currentpoint = help_follow_link (currentpoint, la->link_name);
|
||||
selected_item = NULL;
|
||||
} else if (event->y < 0)
|
||||
}
|
||||
else if (event->y < 0)
|
||||
move_backward (help_lines - 1);
|
||||
else if (event->y >= help_lines)
|
||||
move_forward (help_lines - 1);
|
||||
else if (event->y < help_lines/2)
|
||||
else if (event->y < help_lines / 2)
|
||||
move_backward (1);
|
||||
else
|
||||
move_forward (1);
|
||||
@ -550,16 +625,17 @@ help_event (Gpm_Event *event, void *vp)
|
||||
|
||||
/* show help */
|
||||
static void
|
||||
help_help (Dlg_head *h)
|
||||
help_help (Dlg_head * h)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
history_ptr = (history_ptr + 1) % HISTORY_SIZE;
|
||||
history [history_ptr].page = currentpoint;
|
||||
history [history_ptr].link = selected_item;
|
||||
history[history_ptr].page = currentpoint;
|
||||
history[history_ptr].link = selected_item;
|
||||
|
||||
p = search_string (fdata, "[How to use help]");
|
||||
if (p != NULL) {
|
||||
if (p != NULL)
|
||||
{
|
||||
currentpoint = p + 1; /* Skip the newline following the start of the node */
|
||||
selected_item = NULL;
|
||||
help_callback (h, NULL, DLG_DRAW, 0, NULL);
|
||||
@ -567,16 +643,16 @@ help_help (Dlg_head *h)
|
||||
}
|
||||
|
||||
static void
|
||||
help_index (Dlg_head *h)
|
||||
help_index (Dlg_head * h)
|
||||
{
|
||||
const char *new_item;
|
||||
|
||||
new_item = search_string (fdata, "[Contents]");
|
||||
|
||||
if (new_item == NULL)
|
||||
message (D_ERROR, MSG_ERROR, _(" Cannot find node %s in help file "),
|
||||
"[Contents]");
|
||||
else {
|
||||
message (D_ERROR, MSG_ERROR, _(" Cannot find node %s in help file "), "[Contents]");
|
||||
else
|
||||
{
|
||||
history_ptr = (history_ptr + 1) % HISTORY_SIZE;
|
||||
history[history_ptr].page = currentpoint;
|
||||
history[history_ptr].link = selected_item;
|
||||
@ -588,10 +664,10 @@ help_index (Dlg_head *h)
|
||||
}
|
||||
|
||||
static void
|
||||
help_back (Dlg_head *h)
|
||||
help_back (Dlg_head * h)
|
||||
{
|
||||
currentpoint = history [history_ptr].page;
|
||||
selected_item = history [history_ptr].link;
|
||||
currentpoint = history[history_ptr].page;
|
||||
selected_item = history[history_ptr].link;
|
||||
history_ptr--;
|
||||
if (history_ptr < 0)
|
||||
history_ptr = HISTORY_SIZE - 1;
|
||||
@ -600,21 +676,21 @@ help_back (Dlg_head *h)
|
||||
}
|
||||
|
||||
static void
|
||||
help_cmk_move_backward(void *vp, int lines)
|
||||
help_cmk_move_backward (void *vp, int lines)
|
||||
{
|
||||
(void) &vp;
|
||||
move_backward (lines);
|
||||
}
|
||||
|
||||
static void
|
||||
help_cmk_move_forward(void *vp, int lines)
|
||||
help_cmk_move_forward (void *vp, int lines)
|
||||
{
|
||||
(void) &vp;
|
||||
move_forward (lines);
|
||||
}
|
||||
|
||||
static void
|
||||
help_cmk_moveto_top(void *vp, int lines)
|
||||
help_cmk_moveto_top (void *vp, int lines)
|
||||
{
|
||||
(void) &vp;
|
||||
(void) &lines;
|
||||
@ -622,7 +698,7 @@ help_cmk_moveto_top(void *vp, int lines)
|
||||
}
|
||||
|
||||
static void
|
||||
help_cmk_moveto_bottom(void *vp, int lines)
|
||||
help_cmk_moveto_bottom (void *vp, int lines)
|
||||
{
|
||||
(void) &vp;
|
||||
(void) &lines;
|
||||
@ -631,19 +707,22 @@ help_cmk_moveto_bottom(void *vp, int lines)
|
||||
|
||||
static void
|
||||
help_next_link (gboolean move_down)
|
||||
{
|
||||
{
|
||||
const char *new_item;
|
||||
|
||||
new_item = select_next_link (selected_item);
|
||||
if (new_item != NULL) {
|
||||
if (new_item != NULL)
|
||||
{
|
||||
selected_item = new_item;
|
||||
if ((int) (selected_item - last_shown) >= 0) {
|
||||
if ((int) (selected_item - last_shown) >= 0)
|
||||
{
|
||||
if (move_down)
|
||||
move_forward (1);
|
||||
else
|
||||
selected_item = NULL;
|
||||
}
|
||||
} else if (move_down)
|
||||
}
|
||||
else if (move_down)
|
||||
move_forward (1);
|
||||
else
|
||||
selected_item = NULL;
|
||||
@ -656,11 +735,12 @@ help_prev_link (gboolean move_up)
|
||||
|
||||
new_item = select_prev_link (selected_item);
|
||||
selected_item = new_item;
|
||||
if ((selected_item == NULL) || (selected_item < currentpoint)) {
|
||||
if ((selected_item == NULL) || (selected_item < currentpoint))
|
||||
{
|
||||
if (move_up)
|
||||
move_backward (1);
|
||||
else if (link_area != NULL)
|
||||
selected_item = link_area->link_name;
|
||||
else if ((link_area != NULL) && (link_area->data != NULL))
|
||||
selected_item = ((Link_Area *) link_area->data)->link_name;
|
||||
else
|
||||
selected_item = NULL;
|
||||
}
|
||||
@ -677,8 +757,8 @@ help_next_node (void)
|
||||
|
||||
if (*++new_item == '[')
|
||||
while (*++new_item != '\0')
|
||||
if ((*new_item == ']') && (*++new_item != '\0')
|
||||
&& (*++new_item != '\0')) {
|
||||
if ((*new_item == ']') && (*++new_item != '\0') && (*++new_item != '\0'))
|
||||
{
|
||||
currentpoint = new_item;
|
||||
selected_item = NULL;
|
||||
break;
|
||||
@ -706,7 +786,8 @@ static void
|
||||
help_select_link (void)
|
||||
{
|
||||
/* follow link */
|
||||
if (selected_item == NULL) {
|
||||
if (selected_item == NULL)
|
||||
{
|
||||
#ifdef WE_WANT_TO_GO_BACKWARD_ON_KEY_RIGHT
|
||||
/* Is there any reason why the right key would take us
|
||||
* backward if there are no links selected?, I agree
|
||||
@ -715,15 +796,17 @@ help_select_link (void)
|
||||
/* If there are no links, go backward in history */
|
||||
history_ptr--;
|
||||
if (history_ptr < 0)
|
||||
history_ptr = HISTORY_SIZE-1;
|
||||
history_ptr = HISTORY_SIZE - 1;
|
||||
|
||||
currentpoint = history [history_ptr].page;
|
||||
selected_item = history [history_ptr].link;
|
||||
currentpoint = history[history_ptr].page;
|
||||
selected_item = history[history_ptr].link;
|
||||
#endif
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
history_ptr = (history_ptr + 1) % HISTORY_SIZE;
|
||||
history [history_ptr].page = currentpoint;
|
||||
history [history_ptr].link = selected_item;
|
||||
history[history_ptr].page = currentpoint;
|
||||
history[history_ptr].link = selected_item;
|
||||
currentpoint = help_follow_link (currentpoint, selected_item);
|
||||
}
|
||||
|
||||
@ -735,7 +818,8 @@ help_execute_cmd (unsigned long command)
|
||||
{
|
||||
cb_ret_t ret = MSG_HANDLED;
|
||||
|
||||
switch (command) {
|
||||
switch (command)
|
||||
{
|
||||
case CK_HelpHelp:
|
||||
help_help (whelp);
|
||||
break;
|
||||
@ -777,21 +861,22 @@ help_execute_cmd (unsigned long command)
|
||||
}
|
||||
|
||||
static cb_ret_t
|
||||
help_handle_key (Dlg_head *h, int c)
|
||||
help_handle_key (Dlg_head * h, int c)
|
||||
{
|
||||
if (c != KEY_UP && c != KEY_DOWN &&
|
||||
check_movement_keys (c, help_lines, NULL,
|
||||
help_cmk_move_backward,
|
||||
help_cmk_move_forward,
|
||||
help_cmk_moveto_top,
|
||||
help_cmk_moveto_bottom) == MSG_HANDLED) {
|
||||
/* Nothing */;
|
||||
} else {
|
||||
help_cmk_moveto_top, help_cmk_moveto_bottom) == MSG_HANDLED)
|
||||
{
|
||||
/* Nothing */ ;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long command;
|
||||
|
||||
command = lookup_keymap_command (help_map, c);
|
||||
if ((command == CK_Ignore_Key)
|
||||
|| (help_execute_cmd (command) == MSG_NOT_HANDLED))
|
||||
if ((command == CK_Ignore_Key) || (help_execute_cmd (command) == MSG_NOT_HANDLED))
|
||||
return MSG_NOT_HANDLED;
|
||||
}
|
||||
|
||||
@ -800,12 +885,12 @@ help_handle_key (Dlg_head *h, int c)
|
||||
}
|
||||
|
||||
static cb_ret_t
|
||||
help_callback (Dlg_head *h, Widget *sender,
|
||||
dlg_msg_t msg, int parm, void *data)
|
||||
help_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
|
||||
{
|
||||
WButtonBar *bb;
|
||||
|
||||
switch (msg) {
|
||||
switch (msg)
|
||||
{
|
||||
case DLG_RESIZE:
|
||||
help_lines = min (LINES - 4, max (2 * LINES / 3, 18));
|
||||
dlg_set_size (h, help_lines + 4, HELP_WINDOW_WIDTH + 4);
|
||||
@ -843,19 +928,21 @@ translate_file (char *filedata)
|
||||
GIConv conv;
|
||||
GString *translated_data;
|
||||
|
||||
translated_data = g_string_new ("");
|
||||
/* initial allocation for largest whole help file */
|
||||
translated_data = g_string_sized_new (32 * 1024);
|
||||
|
||||
conv = str_crt_conv_from ("UTF-8");
|
||||
|
||||
if (conv == INVALID_CONV)
|
||||
g_string_free (translated_data, TRUE);
|
||||
else {
|
||||
else
|
||||
{
|
||||
g_free (fdata);
|
||||
|
||||
if (str_convert (conv, filedata, translated_data) != ESTR_FAILURE) {
|
||||
fdata = translated_data->str;
|
||||
g_string_free (translated_data, FALSE);
|
||||
} else {
|
||||
if (str_convert (conv, filedata, translated_data) != ESTR_FAILURE)
|
||||
fdata = g_string_free (translated_data, FALSE);
|
||||
else
|
||||
{
|
||||
fdata = NULL;
|
||||
g_string_free (translated_data, TRUE);
|
||||
}
|
||||
@ -864,9 +951,10 @@ translate_file (char *filedata)
|
||||
}
|
||||
|
||||
static cb_ret_t
|
||||
md_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
md_callback (Widget * w, widget_msg_t msg, int parm)
|
||||
{
|
||||
switch (msg) {
|
||||
switch (msg)
|
||||
{
|
||||
case WIDGET_RESIZED:
|
||||
w->lines = help_lines;
|
||||
return MSG_HANDLED;
|
||||
@ -887,8 +975,7 @@ mousedispatch_new (int y, int x, int yl, int xl)
|
||||
void
|
||||
interactive_display (const char *filename, const char *node)
|
||||
{
|
||||
const int help_colors[DLG_COLOR_NUM] =
|
||||
{
|
||||
const int help_colors[DLG_COLOR_NUM] = {
|
||||
HELP_NORMAL_COLOR, /* common text color */
|
||||
0, /* unused in help */
|
||||
HELP_BOLD_COLOR, /* title color */
|
||||
@ -906,8 +993,8 @@ interactive_display (const char *filename, const char *node)
|
||||
filedata = load_mc_home_file (mc_home, mc_home_alt, "mc.hlp", &hlpfile);
|
||||
|
||||
if (filedata == NULL)
|
||||
message (D_ERROR, MSG_ERROR, _(" Cannot open file %s \n %s "), filename ? filename : hlpfile,
|
||||
unix_error_string (errno));
|
||||
message (D_ERROR, MSG_ERROR, _(" Cannot open file %s \n %s "),
|
||||
filename ? filename : hlpfile, unix_error_string (errno));
|
||||
|
||||
g_free (hlpfile);
|
||||
|
||||
@ -926,13 +1013,14 @@ interactive_display (const char *filename, const char *node)
|
||||
|
||||
main_node = search_string (fdata, node);
|
||||
|
||||
if (main_node == NULL) {
|
||||
message (D_ERROR, MSG_ERROR, _(" Cannot find node %s in help file "),
|
||||
node);
|
||||
if (main_node == NULL)
|
||||
{
|
||||
message (D_ERROR, MSG_ERROR, _(" Cannot find node %s in help file "), node);
|
||||
|
||||
/* Fallback to [main], return if it also cannot be found */
|
||||
main_node = search_string (fdata, "[main]");
|
||||
if (main_node == NULL) {
|
||||
if (main_node == NULL)
|
||||
{
|
||||
interactive_display_finish ();
|
||||
return;
|
||||
}
|
||||
@ -948,7 +1036,8 @@ interactive_display (const char *filename, const char *node)
|
||||
selected_item = search_string_node (main_node, STRING_LINK_START) - 1;
|
||||
currentpoint = main_node + 1; /* Skip the newline following the start of the node */
|
||||
|
||||
for (history_ptr = HISTORY_SIZE; history_ptr;) {
|
||||
for (history_ptr = HISTORY_SIZE; history_ptr;)
|
||||
{
|
||||
history_ptr--;
|
||||
history[history_ptr].page = currentpoint;
|
||||
history[history_ptr].link = selected_item;
|
||||
@ -963,16 +1052,16 @@ interactive_display (const char *filename, const char *node)
|
||||
add_widget (whelp, md);
|
||||
add_widget (whelp, help_bar);
|
||||
|
||||
buttonbar_set_label (help_bar, 1, Q_("ButtonBar|Help"), help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 2, Q_("ButtonBar|Index"), help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 3, Q_("ButtonBar|Prev"), help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 1, Q_ ("ButtonBar|Help"), help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 2, Q_ ("ButtonBar|Index"), help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 3, Q_ ("ButtonBar|Prev"), help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 4, "", help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 5, "", help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 6, "", help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 7, "", help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 8, "", help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 9, "", help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 10, Q_("ButtonBar|Quit"), help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 10, Q_ ("ButtonBar|Quit"), help_map, NULL);
|
||||
|
||||
run_dlg (whelp);
|
||||
interactive_display_finish ();
|
||||
|
@ -29,8 +29,6 @@
|
||||
#ifndef MC_HELP_H
|
||||
#define MC_HELP_H
|
||||
|
||||
#define HELP_TEXT_WIDTH 58
|
||||
|
||||
/* Markers used in the help files */
|
||||
#define CHAR_LINK_START '\01' /* Ctrl-A */
|
||||
#define CHAR_LINK_POINTER '\02' /* Ctrl-B */
|
||||
@ -45,4 +43,4 @@
|
||||
|
||||
void interactive_display (const char *filename, const char *node);
|
||||
|
||||
#endif
|
||||
#endif /* MC_HELP_H */
|
||||
|
392
src/man2hlp.c
392
src/man2hlp.c
@ -3,6 +3,7 @@
|
||||
2007 Free Software Foundation, Inc.
|
||||
2002 Andrew V. Samoilov
|
||||
2002 Pavel Roskin
|
||||
2010 Andrew Borodin
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -58,7 +59,8 @@ static int tp_flag; /* Flag: .TP paragraph
|
||||
2 = first line of label description. */
|
||||
static char *topics = NULL;
|
||||
|
||||
struct node {
|
||||
struct node
|
||||
{
|
||||
char *node; /* Section name */
|
||||
char *lname; /* Translated .SH, NULL if not translated */
|
||||
struct node *next;
|
||||
@ -75,7 +77,7 @@ static struct node *cnode; /* Current node */
|
||||
* Failure to read everything is an error, indicated by returning 0.
|
||||
*/
|
||||
static size_t
|
||||
persistent_fread (void *data, size_t len, FILE *stream)
|
||||
persistent_fread (void *data, size_t len, FILE * stream)
|
||||
{
|
||||
size_t count;
|
||||
size_t bytes_done = 0;
|
||||
@ -84,7 +86,8 @@ persistent_fread (void *data, size_t len, FILE *stream)
|
||||
if (len <= 0)
|
||||
return 0;
|
||||
|
||||
while (bytes_done < len) {
|
||||
while (bytes_done < len)
|
||||
{
|
||||
count = len - bytes_done;
|
||||
if (count > MAX_STREAM_BLOCK)
|
||||
count = MAX_STREAM_BLOCK;
|
||||
@ -106,7 +109,7 @@ persistent_fread (void *data, size_t len, FILE *stream)
|
||||
* Failure to write everything is an error, indicated by returning 0.
|
||||
*/
|
||||
static size_t
|
||||
persistent_fwrite (const void *data, size_t len, FILE *stream)
|
||||
persistent_fwrite (const void *data, size_t len, FILE * stream)
|
||||
{
|
||||
size_t count;
|
||||
size_t bytes_done = 0;
|
||||
@ -115,7 +118,8 @@ persistent_fwrite (const void *data, size_t len, FILE *stream)
|
||||
if (len <= 0)
|
||||
return 0;
|
||||
|
||||
while (bytes_done < len) {
|
||||
while (bytes_done < len)
|
||||
{
|
||||
count = len - bytes_done;
|
||||
if (count > MAX_STREAM_BLOCK)
|
||||
count = MAX_STREAM_BLOCK;
|
||||
@ -136,8 +140,7 @@ persistent_fwrite (const void *data, size_t len, FILE *stream)
|
||||
static void
|
||||
print_error (const char *message)
|
||||
{
|
||||
fprintf (stderr, "man2hlp: %s in file \"%s\" on line %d\n", message,
|
||||
c_in, in_row);
|
||||
fprintf (stderr, "man2hlp: %s in file \"%s\" on line %d\n", message, c_in, in_row);
|
||||
}
|
||||
|
||||
/* Do fopen(), exit if it fails */
|
||||
@ -148,9 +151,9 @@ fopen_check (const char *filename, const char *flags)
|
||||
FILE *f;
|
||||
|
||||
f = fopen (filename, flags);
|
||||
if (f == NULL) {
|
||||
g_snprintf (tmp, sizeof (tmp), "man2hlp: Cannot open file \"%s\"",
|
||||
filename);
|
||||
if (f == NULL)
|
||||
{
|
||||
g_snprintf (tmp, sizeof (tmp), "man2hlp: Cannot open file \"%s\"", filename);
|
||||
perror (tmp);
|
||||
exit (3);
|
||||
}
|
||||
@ -160,14 +163,16 @@ fopen_check (const char *filename, const char *flags)
|
||||
|
||||
/* Do fclose(), exit if it fails */
|
||||
static void
|
||||
fclose_check (FILE *f)
|
||||
fclose_check (FILE * f)
|
||||
{
|
||||
if (ferror (f)) {
|
||||
if (ferror (f))
|
||||
{
|
||||
perror ("man2hlp: File error");
|
||||
exit (3);
|
||||
}
|
||||
|
||||
if (fclose (f)) {
|
||||
if (fclose (f))
|
||||
{
|
||||
perror ("man2hlp: Cannot close file");
|
||||
exit (3);
|
||||
}
|
||||
@ -192,13 +197,15 @@ string_len (const char *buffer)
|
||||
int c; /* Current character */
|
||||
int len = 0; /* Result: the length of the string */
|
||||
|
||||
while (*(buffer)) {
|
||||
while (*(buffer))
|
||||
{
|
||||
c = *buffer++;
|
||||
if (c == CHAR_LINK_POINTER)
|
||||
lc_link_flag = 1; /* Link target name starts */
|
||||
else if (c == CHAR_LINK_END)
|
||||
lc_link_flag = 0; /* Link target name ends */
|
||||
else if (c == CHAR_NODE_END) {
|
||||
else if (c == CHAR_NODE_END)
|
||||
{
|
||||
/* Node anchor name starts */
|
||||
anchor_flag = 1;
|
||||
/* Ugly hack to prevent loss of one space */
|
||||
@ -208,7 +215,8 @@ string_len (const char *buffer)
|
||||
if (c >= 0 && c < 32)
|
||||
continue;
|
||||
/* Attempt to handle backslash quoting */
|
||||
if (c == '\\' && !backslash_flag) {
|
||||
if (c == '\\' && !backslash_flag)
|
||||
{
|
||||
backslash_flag = 1;
|
||||
continue;
|
||||
}
|
||||
@ -216,7 +224,8 @@ string_len (const char *buffer)
|
||||
/* Increase length if not inside anchor name or link target name */
|
||||
if (!anchor_flag && !lc_link_flag)
|
||||
len++;
|
||||
if (anchor_flag && c == ']') {
|
||||
if (anchor_flag && c == ']')
|
||||
{
|
||||
/* Node anchor name ends */
|
||||
anchor_flag = 0;
|
||||
}
|
||||
@ -236,40 +245,49 @@ print_string (char *buffer)
|
||||
if (skip_flag)
|
||||
return;
|
||||
/* Copying verbatim? */
|
||||
if (verbatim_flag) {
|
||||
if (verbatim_flag)
|
||||
{
|
||||
/* Attempt to handle backslash quoting */
|
||||
while (*(buffer)) {
|
||||
while (*(buffer))
|
||||
{
|
||||
c = *buffer++;
|
||||
if (c == '\\' && !backslash_flag) {
|
||||
if (c == '\\' && !backslash_flag)
|
||||
{
|
||||
backslash_flag = 1;
|
||||
continue;
|
||||
}
|
||||
backslash_flag = 0;
|
||||
fputc (c, f_out);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Split into words */
|
||||
buffer = strtok (buffer, " \t\n");
|
||||
/* Repeat for each word */
|
||||
while (buffer) {
|
||||
while (buffer)
|
||||
{
|
||||
/* Skip empty strings */
|
||||
if (*(buffer)) {
|
||||
if (*(buffer))
|
||||
{
|
||||
len = string_len (buffer);
|
||||
/* Change the line if about to break the right margin */
|
||||
if (col + len >= HELP_TEXT_WIDTH)
|
||||
newline ();
|
||||
/* Words are separated by spaces */
|
||||
if (col > 0) {
|
||||
if (col > 0)
|
||||
{
|
||||
fputc (' ', f_out);
|
||||
col++;
|
||||
} else if (indentation) {
|
||||
}
|
||||
else if (indentation)
|
||||
{
|
||||
while (col++ < indentation)
|
||||
fputc (' ', f_out);
|
||||
}
|
||||
/* Attempt to handle backslash quoting */
|
||||
while (*(buffer)) {
|
||||
while (*(buffer))
|
||||
{
|
||||
c = *buffer++;
|
||||
if (c == '\\' && !backslash_flag) {
|
||||
if (c == '\\' && !backslash_flag)
|
||||
{
|
||||
backslash_flag = 1;
|
||||
continue;
|
||||
}
|
||||
@ -305,20 +323,26 @@ handle_node (char *buffer, int is_sh)
|
||||
int len, heading_level;
|
||||
|
||||
/* If we already skipped a section, don't skip another */
|
||||
if (skip_flag == 2) {
|
||||
if (skip_flag == 2)
|
||||
{
|
||||
skip_flag = 0;
|
||||
}
|
||||
/* Get the command parameters */
|
||||
buffer = strtok (NULL, "");
|
||||
if (buffer == NULL) {
|
||||
if (buffer == NULL)
|
||||
{
|
||||
print_error ("Syntax error: .SH: no title");
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remove quotes */
|
||||
if (buffer[0] == '"') {
|
||||
if (buffer[0] == '"')
|
||||
{
|
||||
buffer++;
|
||||
len = strlen (buffer);
|
||||
if (buffer[len - 1] == '"') {
|
||||
if (buffer[len - 1] == '"')
|
||||
{
|
||||
len--;
|
||||
buffer[len] = 0;
|
||||
}
|
||||
@ -330,30 +354,39 @@ handle_node (char *buffer, int is_sh)
|
||||
/* Heading level must be even */
|
||||
if (heading_level & 1)
|
||||
print_error ("Syntax error: .SH: odd heading level");
|
||||
if (no_split_flag) {
|
||||
if (no_split_flag)
|
||||
{
|
||||
/* Don't start a new section */
|
||||
newline ();
|
||||
print_string (buffer);
|
||||
newline ();
|
||||
newline ();
|
||||
no_split_flag = 0;
|
||||
} else if (skip_flag) {
|
||||
}
|
||||
else if (skip_flag)
|
||||
{
|
||||
/* Skipping title and marking text for skipping */
|
||||
skip_flag = 2;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer += heading_level;
|
||||
if (!is_sh || !node) {
|
||||
if (!is_sh || !node)
|
||||
{
|
||||
/* Start a new section, but omit empty section names */
|
||||
if (*buffer) {
|
||||
if (*buffer)
|
||||
{
|
||||
fprintf (f_out, "%c[%s]", CHAR_NODE_END, buffer);
|
||||
col++;
|
||||
newline ();
|
||||
}
|
||||
|
||||
/* Add section to the linked list */
|
||||
if (!cnode) {
|
||||
if (!cnode)
|
||||
{
|
||||
cnode = &nodes;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
cnode->next = malloc (sizeof (nodes));
|
||||
cnode = cnode->next;
|
||||
}
|
||||
@ -362,7 +395,8 @@ handle_node (char *buffer, int is_sh)
|
||||
cnode->next = NULL;
|
||||
cnode->heading_level = heading_level;
|
||||
}
|
||||
if (is_sh) {
|
||||
if (is_sh)
|
||||
{
|
||||
/* print_string() strtok()es buffer, so */
|
||||
cnode->lname = strdup (buffer);
|
||||
print_string (buffer);
|
||||
@ -378,7 +412,8 @@ handle_node (char *buffer, int is_sh)
|
||||
static inline char
|
||||
char_to_font (char c)
|
||||
{
|
||||
switch (c) {
|
||||
switch (c)
|
||||
{
|
||||
case 'R':
|
||||
return CHAR_FONT_NORMAL;
|
||||
case 'B':
|
||||
@ -417,25 +452,30 @@ handle_alt_font (char *buffer)
|
||||
return 0;
|
||||
|
||||
p = strtok (NULL, "");
|
||||
if (p == NULL) {
|
||||
if (p == NULL)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
w = buffer;
|
||||
*w++ = font[0];
|
||||
|
||||
while (*p) {
|
||||
while (*p)
|
||||
{
|
||||
|
||||
if (*p == '"') {
|
||||
if (*p == '"')
|
||||
{
|
||||
in_quotes = !in_quotes;
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (*p == ' ' && !in_quotes) {
|
||||
if (*p == ' ' && !in_quotes)
|
||||
{
|
||||
p++;
|
||||
/* Don't change font if we are at the end */
|
||||
if (*p != 0) {
|
||||
if (*p != 0)
|
||||
{
|
||||
alt_state = !alt_state;
|
||||
*w++ = font[alt_state];
|
||||
}
|
||||
@ -467,10 +507,12 @@ handle_tp_ip (int is_tp)
|
||||
if (col > 0)
|
||||
newline ();
|
||||
newline ();
|
||||
if (is_tp) {
|
||||
if (is_tp)
|
||||
{
|
||||
tp_flag = 1;
|
||||
indentation = 0;
|
||||
} else
|
||||
}
|
||||
else
|
||||
indentation = 8;
|
||||
}
|
||||
|
||||
@ -483,33 +525,47 @@ handle_command (char *buffer)
|
||||
/* Get the command name */
|
||||
strtok (buffer, " \t");
|
||||
|
||||
if (strcmp (buffer, ".SH") == 0) {
|
||||
if (strcmp (buffer, ".SH") == 0)
|
||||
{
|
||||
indentation = 0;
|
||||
handle_node (buffer, 1);
|
||||
} else if (strcmp (buffer, ".\\\"NODE") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".\\\"NODE") == 0)
|
||||
{
|
||||
handle_node (buffer, 0);
|
||||
} else if (strcmp (buffer, ".\\\"DONT_SPLIT\"") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".\\\"DONT_SPLIT\"") == 0)
|
||||
{
|
||||
no_split_flag = 1;
|
||||
} else if (strcmp (buffer, ".\\\"SKIP_SECTION\"") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".\\\"SKIP_SECTION\"") == 0)
|
||||
{
|
||||
skip_flag = 1;
|
||||
} else if (strcmp (buffer, ".\\\"LINK2\"") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".\\\"LINK2\"") == 0)
|
||||
{
|
||||
/* Next two input lines form a link */
|
||||
link_flag = 2;
|
||||
} else if ((strcmp (buffer, ".PP") == 0)
|
||||
|| (strcmp (buffer, ".P") == 0)
|
||||
|| (strcmp (buffer, ".LP") == 0)) {
|
||||
}
|
||||
else if ((strcmp (buffer, ".PP") == 0)
|
||||
|| (strcmp (buffer, ".P") == 0) || (strcmp (buffer, ".LP") == 0))
|
||||
{
|
||||
indentation = 0;
|
||||
/* End of paragraph */
|
||||
if (col > 0)
|
||||
newline ();
|
||||
newline ();
|
||||
} else if (strcmp (buffer, ".nf") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".nf") == 0)
|
||||
{
|
||||
/* Following input lines are to be handled verbatim */
|
||||
verbatim_flag = 1;
|
||||
if (col > 0)
|
||||
newline ();
|
||||
} else if (strcmp (buffer, ".I") == 0 || strcmp (buffer, ".B") == 0
|
||||
|| strcmp (buffer, ".SB") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".I") == 0 || strcmp (buffer, ".B") == 0
|
||||
|| strcmp (buffer, ".SB") == 0)
|
||||
{
|
||||
/* Bold text or italics text */
|
||||
char *p;
|
||||
char *w;
|
||||
@ -523,7 +579,8 @@ handle_command (char *buffer)
|
||||
|
||||
/* FIXME: text is optional, so there is no error */
|
||||
p = strtok (NULL, "");
|
||||
if (p == NULL) {
|
||||
if (p == NULL)
|
||||
{
|
||||
print_error ("Syntax error: .I | .B | .SB : no text");
|
||||
return;
|
||||
}
|
||||
@ -531,8 +588,10 @@ handle_command (char *buffer)
|
||||
*buffer = (buffer[1] == 'I') ? CHAR_FONT_ITALIC : CHAR_FONT_BOLD;
|
||||
|
||||
/* Attempt to handle backslash quoting */
|
||||
for (w = &buffer[1]; *p; p++) {
|
||||
if (*p == '\\' && !backslash_flag) {
|
||||
for (w = &buffer[1]; *p; p++)
|
||||
{
|
||||
if (*p == '\\' && !backslash_flag)
|
||||
{
|
||||
backslash_flag = 1;
|
||||
continue;
|
||||
}
|
||||
@ -543,58 +602,79 @@ handle_command (char *buffer)
|
||||
*w++ = CHAR_FONT_NORMAL;
|
||||
*w = 0;
|
||||
print_string (buffer);
|
||||
} else if (strcmp (buffer, ".TP") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".TP") == 0)
|
||||
{
|
||||
handle_tp_ip (1);
|
||||
} else if (strcmp (buffer, ".IP") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".IP") == 0)
|
||||
{
|
||||
handle_tp_ip (0);
|
||||
} else if (strcmp (buffer, ".\\\"TOPICS") == 0) {
|
||||
if (out_row > 1) {
|
||||
print_error
|
||||
("Syntax error: .\\\"TOPICS must be first command");
|
||||
}
|
||||
else if (strcmp (buffer, ".\\\"TOPICS") == 0)
|
||||
{
|
||||
if (out_row > 1)
|
||||
{
|
||||
print_error ("Syntax error: .\\\"TOPICS must be first command");
|
||||
return;
|
||||
}
|
||||
buffer = strtok (NULL, "");
|
||||
if (buffer == NULL) {
|
||||
if (buffer == NULL)
|
||||
{
|
||||
print_error ("Syntax error: .\\\"TOPICS: no text");
|
||||
return;
|
||||
}
|
||||
/* Remove quotes */
|
||||
if (buffer[0] == '"') {
|
||||
if (buffer[0] == '"')
|
||||
{
|
||||
buffer++;
|
||||
len = strlen (buffer);
|
||||
if (buffer[len - 1] == '"') {
|
||||
if (buffer[len - 1] == '"')
|
||||
{
|
||||
len--;
|
||||
buffer[len] = 0;
|
||||
}
|
||||
}
|
||||
topics = strdup (buffer);
|
||||
} else if (strcmp (buffer, ".br") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".br") == 0)
|
||||
{
|
||||
if (col)
|
||||
newline ();
|
||||
} else if (strncmp (buffer, ".\\\"", 3) == 0) {
|
||||
}
|
||||
else if (strncmp (buffer, ".\\\"", 3) == 0)
|
||||
{
|
||||
/* Comment */
|
||||
} else if (strcmp (buffer, ".TH") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".TH") == 0)
|
||||
{
|
||||
/* Title header */
|
||||
} else if (strcmp (buffer, ".SM") == 0) {
|
||||
}
|
||||
else if (strcmp (buffer, ".SM") == 0)
|
||||
{
|
||||
/* Causes the text on the same line or the text on the
|
||||
* next line to appear in a font that is one point
|
||||
* size smaller than the default font. */
|
||||
buffer = strtok (NULL, "");
|
||||
if (buffer)
|
||||
print_string (buffer);
|
||||
} else if (handle_alt_font (buffer) == 1) {
|
||||
}
|
||||
else if (handle_alt_font (buffer) == 1)
|
||||
{
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Other commands are ignored */
|
||||
char warn_str[BUFFER_SIZE];
|
||||
g_snprintf (warn_str, sizeof (warn_str),
|
||||
"Warning: unsupported command %s", buffer);
|
||||
g_snprintf (warn_str, sizeof (warn_str), "Warning: unsupported command %s", buffer);
|
||||
print_error (warn_str);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static struct links {
|
||||
static struct links
|
||||
{
|
||||
char *linkname; /* Section name */
|
||||
int line; /* Input line in ... */
|
||||
const char *filename;
|
||||
@ -609,7 +689,8 @@ handle_link (char *buffer)
|
||||
char *amp;
|
||||
const char *amp_arg;
|
||||
|
||||
switch (link_flag) {
|
||||
switch (link_flag)
|
||||
{
|
||||
case 1:
|
||||
/* Old format link, not supported */
|
||||
break;
|
||||
@ -630,17 +711,21 @@ handle_link (char *buffer)
|
||||
if (buffer[0] == '"')
|
||||
buffer++;
|
||||
len = strlen (buffer);
|
||||
if (len && buffer[len - 1] == '"') {
|
||||
if (len && buffer[len - 1] == '"')
|
||||
{
|
||||
buffer[--len] = 0;
|
||||
}
|
||||
|
||||
/* "Layout\&)," -- "Layout" should be highlighted, but not ")," */
|
||||
amp = strstr (old, "\\&");
|
||||
if (amp) {
|
||||
if (amp)
|
||||
{
|
||||
*amp = 0;
|
||||
amp += 2;
|
||||
amp_arg = amp;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
amp_arg = "";
|
||||
}
|
||||
|
||||
@ -648,11 +733,14 @@ handle_link (char *buffer)
|
||||
CHAR_LINK_POINTER, buffer, CHAR_LINK_END, amp_arg);
|
||||
link_flag = 0;
|
||||
/* Add to the linked list */
|
||||
if (current_link) {
|
||||
if (current_link)
|
||||
{
|
||||
current_link->next = malloc (sizeof (links));
|
||||
current_link = current_link->next;
|
||||
current_link->next = NULL;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
current_link = &links;
|
||||
}
|
||||
current_link->linkname = strdup (buffer);
|
||||
@ -677,9 +765,9 @@ main (int argc, char **argv)
|
||||
long file_end; /* Length of the output file */
|
||||
|
||||
/* Validity check for arguments */
|
||||
if (argc != 4) {
|
||||
fprintf (stderr,
|
||||
"Usage: man2hlp file.man template_file helpfile\n");
|
||||
if (argc != 4)
|
||||
{
|
||||
fprintf (stderr, "Usage: man2hlp file.man template_file helpfile\n");
|
||||
return 3;
|
||||
}
|
||||
|
||||
@ -693,7 +781,8 @@ main (int argc, char **argv)
|
||||
c_in = c_man;
|
||||
|
||||
/* Repeat for each input line */
|
||||
while (fgets (buffer, BUFFER_SIZE, f_man)) {
|
||||
while (fgets (buffer, BUFFER_SIZE, f_man))
|
||||
{
|
||||
char *input_line; /* Input line without initial "\&" */
|
||||
|
||||
if (buffer[0] == '\\' && buffer[1] == '&')
|
||||
@ -704,34 +793,49 @@ main (int argc, char **argv)
|
||||
in_row++;
|
||||
len = strlen (input_line);
|
||||
/* Remove terminating newline */
|
||||
if (input_line[len - 1] == '\n') {
|
||||
if (input_line[len - 1] == '\n')
|
||||
{
|
||||
len--;
|
||||
input_line[len] = 0;
|
||||
}
|
||||
|
||||
if (verbatim_flag) {
|
||||
if (verbatim_flag)
|
||||
{
|
||||
/* Copy the line verbatim */
|
||||
if (strcmp (input_line, ".fi") == 0) {
|
||||
if (strcmp (input_line, ".fi") == 0)
|
||||
{
|
||||
verbatim_flag = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
print_string (input_line);
|
||||
newline ();
|
||||
}
|
||||
} else if (link_flag) {
|
||||
}
|
||||
else if (link_flag)
|
||||
{
|
||||
/* The line is a link */
|
||||
handle_link (input_line);
|
||||
} else if (buffer[0] == '.') {
|
||||
}
|
||||
else if (buffer[0] == '.')
|
||||
{
|
||||
/* The line is a roff command */
|
||||
handle_command (input_line);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* A normal line, just output it */
|
||||
print_string (input_line);
|
||||
}
|
||||
/* .TP label processed as usual line */
|
||||
if (tp_flag) {
|
||||
if (tp_flag == 1) {
|
||||
if (tp_flag)
|
||||
{
|
||||
if (tp_flag == 1)
|
||||
{
|
||||
tp_flag = 2;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
tp_flag = 0;
|
||||
indentation = 8;
|
||||
if (col >= indentation)
|
||||
@ -753,26 +857,39 @@ main (int argc, char **argv)
|
||||
|
||||
/* Repeat for each input line */
|
||||
/* Read a line */
|
||||
while (fgets (buffer, BUFFER_SIZE, f_tmpl)) {
|
||||
if (lc_node) {
|
||||
if (*buffer && *buffer != '\n') {
|
||||
while (fgets (buffer, BUFFER_SIZE, f_tmpl))
|
||||
{
|
||||
if (lc_node)
|
||||
{
|
||||
if (*buffer && *buffer != '\n')
|
||||
{
|
||||
cnode->lname = strdup (buffer);
|
||||
lc_node = strchr (cnode->lname, '\n');
|
||||
if (lc_node)
|
||||
*lc_node = 0;
|
||||
}
|
||||
lc_node = NULL;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
lc_node = strchr (buffer, CHAR_NODE_END);
|
||||
if (lc_node && (lc_node[1] == '[')) {
|
||||
if (lc_node && (lc_node[1] == '['))
|
||||
{
|
||||
char *p = strchr (lc_node, ']');
|
||||
if (p) {
|
||||
if (strncmp (lc_node + 1, "[main]", 6) == 0) {
|
||||
if (p)
|
||||
{
|
||||
if (strncmp (lc_node + 1, "[main]", 6) == 0)
|
||||
{
|
||||
lc_node = NULL;
|
||||
} else {
|
||||
if (!cnode) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cnode)
|
||||
{
|
||||
cnode = &nodes;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
cnode->next = malloc (sizeof (nodes));
|
||||
cnode = cnode->next;
|
||||
}
|
||||
@ -782,16 +899,19 @@ main (int argc, char **argv)
|
||||
cnode->next = NULL;
|
||||
cnode->heading_level = 0;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
lc_node = NULL;
|
||||
} else
|
||||
}
|
||||
else
|
||||
lc_node = NULL;
|
||||
}
|
||||
fputs (buffer, f_out);
|
||||
}
|
||||
|
||||
cont_start = ftell (f_out);
|
||||
if (cont_start <= 0) {
|
||||
if (cont_start <= 0)
|
||||
{
|
||||
perror (c_out);
|
||||
return 1;
|
||||
}
|
||||
@ -801,23 +921,29 @@ main (int argc, char **argv)
|
||||
else
|
||||
fprintf (f_out, "\004[Contents]\n");
|
||||
|
||||
for (current_link = &links; current_link && current_link->linkname;) {
|
||||
for (current_link = &links; current_link && current_link->linkname;)
|
||||
{
|
||||
int found = 0;
|
||||
struct links *next = current_link->next;
|
||||
|
||||
if (strcmp (current_link->linkname, "Contents") == 0) {
|
||||
if (strcmp (current_link->linkname, "Contents") == 0)
|
||||
{
|
||||
found = 1;
|
||||
} else {
|
||||
for (cnode = &nodes; cnode && cnode->node; cnode = cnode->next) {
|
||||
if (strcmp (cnode->node, current_link->linkname) == 0) {
|
||||
}
|
||||
else
|
||||
{
|
||||
for (cnode = &nodes; cnode && cnode->node; cnode = cnode->next)
|
||||
{
|
||||
if (strcmp (cnode->node, current_link->linkname) == 0)
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
g_snprintf (buffer, sizeof (buffer), "Stale link \"%s\"",
|
||||
current_link->linkname);
|
||||
if (!found)
|
||||
{
|
||||
g_snprintf (buffer, sizeof (buffer), "Stale link \"%s\"", current_link->linkname);
|
||||
c_in = current_link->filename;
|
||||
in_row = current_link->line;
|
||||
print_error (buffer);
|
||||
@ -828,7 +954,8 @@ main (int argc, char **argv)
|
||||
current_link = next;
|
||||
}
|
||||
|
||||
for (cnode = &nodes; cnode && cnode->node;) {
|
||||
for (cnode = &nodes; cnode && cnode->node;)
|
||||
{
|
||||
struct node *next = cnode->next;
|
||||
lc_node = cnode->node;
|
||||
|
||||
@ -848,7 +975,8 @@ main (int argc, char **argv)
|
||||
file_end = ftell (f_out);
|
||||
|
||||
/* Sanity check */
|
||||
if ((file_end <= 0) || (file_end - cont_start <= 0)) {
|
||||
if ((file_end <= 0) || (file_end - cont_start <= 0))
|
||||
{
|
||||
perror (c_out);
|
||||
return 1;
|
||||
}
|
||||
@ -867,7 +995,8 @@ main (int argc, char **argv)
|
||||
if (!outfile_buffer)
|
||||
return 1;
|
||||
|
||||
if (!persistent_fread (outfile_buffer, file_end, f_out)) {
|
||||
if (!persistent_fread (outfile_buffer, file_end, f_out))
|
||||
{
|
||||
perror (c_out);
|
||||
return 1;
|
||||
}
|
||||
@ -879,14 +1008,15 @@ main (int argc, char **argv)
|
||||
f_out = fopen_check (c_out, "w");
|
||||
|
||||
/* Write part after the "Contents" node */
|
||||
if (!persistent_fwrite
|
||||
(outfile_buffer + cont_start, file_end - cont_start, f_out)) {
|
||||
if (!persistent_fwrite (outfile_buffer + cont_start, file_end - cont_start, f_out))
|
||||
{
|
||||
perror (c_out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Write part before the "Contents" node */
|
||||
if (!persistent_fwrite (outfile_buffer, cont_start, f_out)) {
|
||||
if (!persistent_fwrite (outfile_buffer, cont_start, f_out))
|
||||
{
|
||||
perror (c_out);
|
||||
return 1;
|
||||
}
|
||||
|
241
src/mountlist.c
241
src/mountlist.c
@ -151,7 +151,8 @@ static int get_fs_usage (char *path, struct fs_usage *fsp);
|
||||
|
||||
static struct mount_entry *mount_list = NULL;
|
||||
|
||||
static void free_mount_entry (struct mount_entry *me)
|
||||
static void
|
||||
free_mount_entry (struct mount_entry *me)
|
||||
{
|
||||
if (!me)
|
||||
return;
|
||||
@ -169,12 +170,14 @@ static void free_mount_entry (struct mount_entry *me)
|
||||
No prefix (like '0x') or suffix (like 'h') is expected to be
|
||||
part of CP. */
|
||||
|
||||
static int xatoi (const char *cp)
|
||||
static int
|
||||
xatoi (const char *cp)
|
||||
{
|
||||
int val;
|
||||
|
||||
val = 0;
|
||||
while (*cp) {
|
||||
while (*cp)
|
||||
{
|
||||
if (*cp >= 'a' && *cp <= 'f')
|
||||
val = val * 16 + *cp - 'a' + 10;
|
||||
else if (*cp >= 'A' && *cp <= 'F')
|
||||
@ -192,9 +195,11 @@ static int xatoi (const char *cp)
|
||||
#ifdef MOUNTED_GETMNTINFO
|
||||
|
||||
#ifndef HAVE_STRUCT_STATFS_F_FSTYPENAME
|
||||
static char *fstype_to_string (short t)
|
||||
static char *
|
||||
fstype_to_string (short t)
|
||||
{
|
||||
switch (t) {
|
||||
switch (t)
|
||||
{
|
||||
#ifdef MOUNT_PC
|
||||
case MOUNT_PC:
|
||||
return "pc";
|
||||
@ -217,67 +222,67 @@ static char *fstype_to_string (short t)
|
||||
#endif
|
||||
#ifdef MOUNT_UFS
|
||||
case MOUNT_UFS:
|
||||
return "ufs" ;
|
||||
return "ufs";
|
||||
#endif
|
||||
#ifdef MOUNT_NFS
|
||||
case MOUNT_NFS:
|
||||
return "nfs" ;
|
||||
return "nfs";
|
||||
#endif
|
||||
#ifdef MOUNT_MSDOS
|
||||
case MOUNT_MSDOS:
|
||||
return "msdos" ;
|
||||
return "msdos";
|
||||
#endif
|
||||
#ifdef MOUNT_LFS
|
||||
case MOUNT_LFS:
|
||||
return "lfs" ;
|
||||
return "lfs";
|
||||
#endif
|
||||
#ifdef MOUNT_LOFS
|
||||
case MOUNT_LOFS:
|
||||
return "lofs" ;
|
||||
return "lofs";
|
||||
#endif
|
||||
#ifdef MOUNT_FDESC
|
||||
case MOUNT_FDESC:
|
||||
return "fdesc" ;
|
||||
return "fdesc";
|
||||
#endif
|
||||
#ifdef MOUNT_PORTAL
|
||||
case MOUNT_PORTAL:
|
||||
return "portal" ;
|
||||
return "portal";
|
||||
#endif
|
||||
#ifdef MOUNT_NULL
|
||||
case MOUNT_NULL:
|
||||
return "null" ;
|
||||
return "null";
|
||||
#endif
|
||||
#ifdef MOUNT_UMAP
|
||||
case MOUNT_UMAP:
|
||||
return "umap" ;
|
||||
return "umap";
|
||||
#endif
|
||||
#ifdef MOUNT_KERNFS
|
||||
case MOUNT_KERNFS:
|
||||
return "kernfs" ;
|
||||
return "kernfs";
|
||||
#endif
|
||||
#ifdef MOUNT_PROCFS
|
||||
case MOUNT_PROCFS:
|
||||
return "procfs" ;
|
||||
return "procfs";
|
||||
#endif
|
||||
#ifdef MOUNT_AFS
|
||||
case MOUNT_AFS:
|
||||
return "afs" ;
|
||||
return "afs";
|
||||
#endif
|
||||
#ifdef MOUNT_CD9660
|
||||
case MOUNT_CD9660:
|
||||
return "cd9660" ;
|
||||
return "cd9660";
|
||||
#endif
|
||||
#ifdef MOUNT_UNION
|
||||
case MOUNT_UNION:
|
||||
return "union" ;
|
||||
return "union";
|
||||
#endif
|
||||
#ifdef MOUNT_DEVFS
|
||||
case MOUNT_DEVFS:
|
||||
return "devfs" ;
|
||||
return "devfs";
|
||||
#endif
|
||||
#ifdef MOUNT_EXT2FS
|
||||
case MOUNT_EXT2FS:
|
||||
return "ext2fs" ;
|
||||
return "ext2fs";
|
||||
#endif
|
||||
default:
|
||||
return "?";
|
||||
@ -334,9 +339,9 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
|
||||
while ((mnt = getmntent (fp))) {
|
||||
if (!all_fs && (!strcmp (mnt->mnt_type, "ignore")
|
||||
|| !strcmp (mnt->mnt_type, "auto")))
|
||||
while ((mnt = getmntent (fp)))
|
||||
{
|
||||
if (!all_fs && (!strcmp (mnt->mnt_type, "ignore") || !strcmp (mnt->mnt_type, "auto")))
|
||||
continue;
|
||||
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
@ -344,12 +349,14 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
me->me_mountdir = strdup (mnt->mnt_dir);
|
||||
me->me_type = strdup (mnt->mnt_type);
|
||||
devopt = strstr (mnt->mnt_opts, "dev=");
|
||||
if (devopt) {
|
||||
if (devopt)
|
||||
{
|
||||
if (devopt[4] == '0' && (devopt[5] == 'x' || devopt[5] == 'X'))
|
||||
me->me_dev = xatoi (devopt + 6);
|
||||
else
|
||||
me->me_dev = xatoi (devopt + 4);
|
||||
} else
|
||||
}
|
||||
else
|
||||
me->me_dev = -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
@ -372,7 +379,8 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
entries = getmntinfo (&fsp, MNT_NOWAIT);
|
||||
if (entries < 0)
|
||||
return NULL;
|
||||
while (entries-- > 0) {
|
||||
while (entries-- > 0)
|
||||
{
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = strdup (fsp->f_mntfromname);
|
||||
me->me_mountdir = strdup (fsp->f_mntonname);
|
||||
@ -400,12 +408,13 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
entries = getmntinfo (&fsp, MNT_NOWAIT);
|
||||
if (entries < 0)
|
||||
return NULL;
|
||||
for (; entries-- > 0; fsp++) {
|
||||
for (; entries-- > 0; fsp++)
|
||||
{
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = strdup (fsp->f_mntfromname);
|
||||
me->me_mountdir = strdup (fsp->f_mntonname);
|
||||
me->me_type = strdup (fsp->f_fstypename);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_dev = (dev_t) - 1; /* Magic; means not known yet. */
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
@ -420,8 +429,8 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
int val;
|
||||
struct fs_data fsd;
|
||||
|
||||
while ((val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
|
||||
NULL)) > 0) {
|
||||
while ((val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY, NULL)) > 0)
|
||||
{
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = strdup (fsd.fd_req.devname);
|
||||
me->me_mountdir = strdup (fsd.fd_req.path);
|
||||
@ -451,11 +460,13 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
stats = (struct statfs *) malloc (bufsize);
|
||||
numsys = getfsstat (stats, bufsize, MNT_WAIT);
|
||||
|
||||
if (numsys < 0) {
|
||||
if (numsys < 0)
|
||||
{
|
||||
free (stats);
|
||||
return (NULL);
|
||||
}
|
||||
for (counter = 0; counter < numsys; counter++) {
|
||||
for (counter = 0; counter < numsys; counter++)
|
||||
{
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = strdup (stats[counter].f_mntfromname);
|
||||
me->me_mountdir = strdup (stats[counter].f_mntonname);
|
||||
@ -482,7 +493,8 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
|
||||
while (fread (&mnt, sizeof mnt, 1, fp) > 0) {
|
||||
while (fread (&mnt, sizeof mnt, 1, fp) > 0)
|
||||
{
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
#ifdef GETFSTYP /* SVR3. */
|
||||
me->me_devname = strdup (mnt.mt_dev);
|
||||
@ -495,7 +507,8 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
me->me_dev = -1; /* Magic; means not known yet. */
|
||||
me->me_type = "";
|
||||
#ifdef GETFSTYP /* SVR3. */
|
||||
if (need_fs_type) {
|
||||
if (need_fs_type)
|
||||
{
|
||||
struct statfs fsd;
|
||||
char typebuf[FSTYPSZ];
|
||||
|
||||
@ -519,7 +532,8 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
#ifdef MOUNTED_GETMNTTBL /* DolphinOS goes it's own way */
|
||||
{
|
||||
struct mntent **mnttbl = getmnttbl (), **ent;
|
||||
for (ent = mnttbl; *ent; ent++) {
|
||||
for (ent = mnttbl; *ent; ent++)
|
||||
{
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = strdup ((*ent)->mt_resource);
|
||||
me->me_mountdir = strdup ((*ent)->mt_directory);
|
||||
@ -546,7 +560,8 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
|
||||
while ((ret = getmntent (fp, &mnt)) == 0) {
|
||||
while ((ret = getmntent (fp, &mnt)) == 0)
|
||||
{
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = strdup (mnt.mnt_special);
|
||||
me->me_mountdir = strdup (mnt.mnt_mountp);
|
||||
@ -578,11 +593,12 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
/* Get the list of mounted filesystems. */
|
||||
mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries);
|
||||
|
||||
for (thisent = entries; thisent < entries + bufsize;
|
||||
thisent += vmp->vmt_length) {
|
||||
for (thisent = entries; thisent < entries + bufsize; thisent += vmp->vmt_length)
|
||||
{
|
||||
vmp = (struct vmount *) thisent;
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
if (vmp->vmt_flags & MNT_REMOTE) {
|
||||
if (vmp->vmt_flags & MNT_REMOTE)
|
||||
{
|
||||
char *host, *path;
|
||||
|
||||
/* Prepend the remote pathname. */
|
||||
@ -592,9 +608,10 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
strcpy (me->me_devname, host);
|
||||
strcat (me->me_devname, ":");
|
||||
strcat (me->me_devname, path);
|
||||
} else {
|
||||
me->me_devname = strdup (thisent +
|
||||
vmp->vmt_data[VMT_OBJECT].vmt_off);
|
||||
}
|
||||
else
|
||||
{
|
||||
me->me_devname = strdup (thisent + vmp->vmt_data[VMT_OBJECT].vmt_off);
|
||||
}
|
||||
me->me_mountdir = strdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
|
||||
me->me_type = strdup (fstype_to_string (vmp->vmt_gfstype));
|
||||
@ -619,15 +636,15 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
|
||||
#ifdef HAVE_INFOMOUNT_QNX
|
||||
/*
|
||||
** QNX has no [gs]etmnt*(), [gs]etfs*(), or /etc/mnttab, but can do
|
||||
** this via the following code.
|
||||
** Note that, as this is based on CWD, it only fills one mount_entry
|
||||
** structure. See my_statfs() in utilunix.c for the "other side" of
|
||||
** this hack.
|
||||
*/
|
||||
** QNX has no [gs]etmnt*(), [gs]etfs*(), or /etc/mnttab, but can do
|
||||
** this via the following code.
|
||||
** Note that, as this is based on CWD, it only fills one mount_entry
|
||||
** structure. See my_statfs() in utilunix.c for the "other side" of
|
||||
** this hack.
|
||||
*/
|
||||
|
||||
static struct mount_entry *
|
||||
read_filesystem_list(int need_fs_type, int all_fs)
|
||||
read_filesystem_list (int need_fs_type, int all_fs)
|
||||
{
|
||||
struct _disk_entry de;
|
||||
struct statfs fs;
|
||||
@ -638,49 +655,73 @@ read_filesystem_list(int need_fs_type, int all_fs)
|
||||
|
||||
if (me)
|
||||
{
|
||||
if (me->me_devname) free(me->me_devname);
|
||||
if (me->me_mountdir) free(me->me_mountdir);
|
||||
if (me->me_type) free(me->me_type);
|
||||
if (me->me_devname)
|
||||
free (me->me_devname);
|
||||
if (me->me_mountdir)
|
||||
free (me->me_mountdir);
|
||||
if (me->me_type)
|
||||
free (me->me_type);
|
||||
}
|
||||
else
|
||||
me = (struct mount_entry *)malloc(sizeof(struct mount_entry));
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
|
||||
if (!getcwd(dir, _POSIX_PATH_MAX)) return (NULL);
|
||||
if (!getcwd (dir, _POSIX_PATH_MAX))
|
||||
return (NULL);
|
||||
|
||||
if ((fd = open(dir, O_RDONLY)) == -1) return (NULL);
|
||||
if ((fd = open (dir, O_RDONLY)) == -1)
|
||||
return (NULL);
|
||||
|
||||
i = disk_get_entry(fd, &de);
|
||||
i = disk_get_entry (fd, &de);
|
||||
|
||||
close(fd);
|
||||
close (fd);
|
||||
|
||||
if (i == -1) return (NULL);
|
||||
if (i == -1)
|
||||
return (NULL);
|
||||
|
||||
switch (de.disk_type)
|
||||
{
|
||||
case _UNMOUNTED: tp = "unmounted"; break;
|
||||
case _FLOPPY: tp = "Floppy"; break;
|
||||
case _HARD: tp = "Hard"; break;
|
||||
case _RAMDISK: tp = "Ram"; break;
|
||||
case _REMOVABLE: tp = "Removable"; break;
|
||||
case _TAPE: tp = "Tape"; break;
|
||||
case _CDROM: tp = "CDROM"; break;
|
||||
default: tp = "unknown";
|
||||
case _UNMOUNTED:
|
||||
tp = "unmounted";
|
||||
break;
|
||||
case _FLOPPY:
|
||||
tp = "Floppy";
|
||||
break;
|
||||
case _HARD:
|
||||
tp = "Hard";
|
||||
break;
|
||||
case _RAMDISK:
|
||||
tp = "Ram";
|
||||
break;
|
||||
case _REMOVABLE:
|
||||
tp = "Removable";
|
||||
break;
|
||||
case _TAPE:
|
||||
tp = "Tape";
|
||||
break;
|
||||
case _CDROM:
|
||||
tp = "CDROM";
|
||||
break;
|
||||
default:
|
||||
tp = "unknown";
|
||||
}
|
||||
|
||||
if (fsys_get_mount_dev(dir, &dev) == -1) return (NULL);
|
||||
if (fsys_get_mount_dev (dir, &dev) == -1)
|
||||
return (NULL);
|
||||
|
||||
if (fsys_get_mount_pt(dev, &dir) == -1) return (NULL);
|
||||
if (fsys_get_mount_pt (dev, &dir) == -1)
|
||||
return (NULL);
|
||||
|
||||
me->me_devname = strdup(dev);
|
||||
me->me_mountdir = strdup(dir);
|
||||
me->me_type = strdup(tp);
|
||||
me->me_devname = strdup (dev);
|
||||
me->me_mountdir = strdup (dir);
|
||||
me->me_type = strdup (tp);
|
||||
me->me_dev = de.disk_type;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "disk_get_entry():\n\tdisk_type=%d (%s)\n\tdriver_name='%-*.*s'\n\tdisk_drv=%d\n",
|
||||
fprintf (stderr,
|
||||
"disk_get_entry():\n\tdisk_type=%d (%s)\n\tdriver_name='%-*.*s'\n\tdisk_drv=%d\n",
|
||||
de.disk_type, tp, _DRIVER_NAME_LEN, _DRIVER_NAME_LEN, de.driver_name, de.disk_drv);
|
||||
fprintf(stderr, "fsys_get_mount_dev():\n\tdevice='%s'\n", dev);
|
||||
fprintf(stderr, "fsys_get_mount_pt():\n\tmount point='%s'\n", dir);
|
||||
fprintf (stderr, "fsys_get_mount_dev():\n\tdevice='%s'\n", dev);
|
||||
fprintf (stderr, "fsys_get_mount_pt():\n\tmount point='%s'\n", dir);
|
||||
#endif /* DEBUG */
|
||||
|
||||
return (me);
|
||||
@ -688,15 +729,25 @@ read_filesystem_list(int need_fs_type, int all_fs)
|
||||
#endif /* HAVE_INFOMOUNT_QNX */
|
||||
|
||||
void
|
||||
init_my_statfs (void)
|
||||
free_my_statfs (void)
|
||||
{
|
||||
#ifdef HAVE_INFOMOUNT_LIST
|
||||
while (mount_list) {
|
||||
while (mount_list)
|
||||
{
|
||||
struct mount_entry *next = mount_list->me_next;
|
||||
free_mount_entry (mount_list);
|
||||
mount_list = next;
|
||||
}
|
||||
mount_list = NULL;
|
||||
#endif /* HAVE_INFOMOUNT_LIST */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
init_my_statfs (void)
|
||||
{
|
||||
#ifdef HAVE_INFOMOUNT_LIST
|
||||
free_my_statfs ();
|
||||
mount_list = read_filesystem_list (1, 1);
|
||||
#endif /* HAVE_INFOMOUNT_LIST */
|
||||
}
|
||||
@ -710,17 +761,20 @@ my_statfs (struct my_statfs *myfs_stats, const char *path)
|
||||
struct mount_entry *temp = mount_list;
|
||||
struct fs_usage fs_use;
|
||||
|
||||
while (temp){
|
||||
while (temp)
|
||||
{
|
||||
i = strlen (temp->me_mountdir);
|
||||
if (i > len && (strncmp (path, temp->me_mountdir, i) == 0))
|
||||
if (!entry || (path [i] == PATH_SEP || path [i] == 0)){
|
||||
if (!entry || (path[i] == PATH_SEP || path[i] == 0))
|
||||
{
|
||||
len = i;
|
||||
entry = temp;
|
||||
}
|
||||
temp = temp->me_next;
|
||||
}
|
||||
|
||||
if (entry){
|
||||
if (entry)
|
||||
{
|
||||
memset (&fs_use, 0, sizeof (struct fs_usage));
|
||||
get_fs_usage (entry->me_mountdir, &fs_use);
|
||||
|
||||
@ -728,26 +782,27 @@ my_statfs (struct my_statfs *myfs_stats, const char *path)
|
||||
myfs_stats->typename = entry->me_type;
|
||||
myfs_stats->mpoint = entry->me_mountdir;
|
||||
myfs_stats->device = entry->me_devname;
|
||||
myfs_stats->avail = getuid () ? fs_use.fsu_bavail/2 : fs_use.fsu_bfree/2;
|
||||
myfs_stats->total = fs_use.fsu_blocks/2;
|
||||
myfs_stats->avail = getuid ()? fs_use.fsu_bavail / 2 : fs_use.fsu_bfree / 2;
|
||||
myfs_stats->total = fs_use.fsu_blocks / 2;
|
||||
myfs_stats->nfree = fs_use.fsu_ffree;
|
||||
myfs_stats->nodes = fs_use.fsu_files;
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_INFOMOUNT_LIST */
|
||||
|
||||
#ifdef HAVE_INFOMOUNT_QNX
|
||||
/*
|
||||
** This is the "other side" of the hack to read_filesystem_list() in
|
||||
** mountlist.c.
|
||||
** It's not the most efficient approach, but consumes less memory. It
|
||||
** also accomodates QNX's ability to mount filesystems on the fly.
|
||||
*/
|
||||
/*
|
||||
** This is the "other side" of the hack to read_filesystem_list() in
|
||||
** mountlist.c.
|
||||
** It's not the most efficient approach, but consumes less memory. It
|
||||
** also accomodates QNX's ability to mount filesystems on the fly.
|
||||
*/
|
||||
struct mount_entry *entry;
|
||||
struct fs_usage fs_use;
|
||||
|
||||
if ((entry = read_filesystem_list(0, 0)) != NULL)
|
||||
if ((entry = read_filesystem_list (0, 0)) != NULL)
|
||||
{
|
||||
get_fs_usage(entry->me_mountdir, &fs_use);
|
||||
get_fs_usage (entry->me_mountdir, &fs_use);
|
||||
|
||||
myfs_stats->type = entry->me_dev;
|
||||
myfs_stats->typename = entry->me_type;
|
||||
@ -796,7 +851,8 @@ fs_adjust_blocks (fsblkcnt_t blocks, int fromsize, int tosize)
|
||||
|
||||
#if defined(_AIX) && defined(_I386)
|
||||
/* AIX PS/2 does not supply statfs. */
|
||||
static int aix_statfs (char *path, struct statfs *fsb)
|
||||
static int
|
||||
aix_statfs (char *path, struct statfs *fsb)
|
||||
{
|
||||
struct stat stats;
|
||||
struct dustat fsd;
|
||||
@ -816,6 +872,7 @@ static int aix_statfs (char *path, struct statfs *fsb)
|
||||
fsb->f_fsid.val[1] = fsd.du_pckno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define statfs(path,fsb) aix_statfs(path,fsb)
|
||||
#endif /* _AIX && _I386 */
|
||||
|
||||
|
@ -23,7 +23,8 @@
|
||||
#define MC_MOUNTLIST_H
|
||||
|
||||
/* Filesystem status */
|
||||
struct my_statfs {
|
||||
struct my_statfs
|
||||
{
|
||||
int type;
|
||||
char *typename;
|
||||
const char *mpoint;
|
||||
@ -36,5 +37,6 @@ struct my_statfs {
|
||||
|
||||
void init_my_statfs (void);
|
||||
void my_statfs (struct my_statfs *myfs_stats, const char *path);
|
||||
void free_my_statfs (void);
|
||||
|
||||
#endif
|
||||
|
@ -3100,6 +3100,7 @@ panel_callback (Widget * w, widget_msg_t msg, int parm)
|
||||
|
||||
case WIDGET_DESTROY:
|
||||
panel_destroy (panel);
|
||||
free_my_statfs ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
default:
|
||||
|
@ -329,17 +329,14 @@ mcview_execute_cmd (mcview_t * view, unsigned long command)
|
||||
case CK_ViewToggleWrapMode:
|
||||
/* Toggle between wrapped and unwrapped view */
|
||||
mcview_toggle_wrap_mode (view);
|
||||
view->dirty++;
|
||||
break;
|
||||
case CK_ViewToggleHexEditMode:
|
||||
/* Toggle between hexview and hexedit mode */
|
||||
mcview_toggle_hexedit_mode (view);
|
||||
view->dirty++;
|
||||
break;
|
||||
case CK_ViewToggleHexMode:
|
||||
/* Toggle between hex view and text view */
|
||||
mcview_toggle_hex_mode (view);
|
||||
view->dirty++;
|
||||
break;
|
||||
case CK_ViewGoto:
|
||||
{
|
||||
@ -365,7 +362,6 @@ mcview_execute_cmd (mcview_t * view, unsigned long command)
|
||||
break;
|
||||
case CK_ViewToggleMagicMode:
|
||||
mcview_toggle_magic_mode (view);
|
||||
view->dirty++;
|
||||
break;
|
||||
case CK_ViewToggleNroffMode:
|
||||
mcview_toggle_nroff_mode (view);
|
||||
@ -471,12 +467,12 @@ mcview_handle_key (mcview_t * view, int key)
|
||||
if ((command != CK_Ignore_Key) && (mcview_execute_cmd (view, command) == MSG_HANDLED))
|
||||
return MSG_HANDLED;
|
||||
|
||||
if (mcview_check_left_right_keys (view, key))
|
||||
if (mcview_check_left_right_keys (view, key) == MSG_HANDLED)
|
||||
return MSG_HANDLED;
|
||||
|
||||
if (check_movement_keys (key, view->data_area.height + 1, view,
|
||||
mcview_cmk_move_up, mcview_cmk_move_down,
|
||||
mcview_cmk_moveto_top, mcview_cmk_moveto_bottom))
|
||||
mcview_cmk_moveto_top, mcview_cmk_moveto_bottom) == MSG_HANDLED)
|
||||
return MSG_HANDLED;
|
||||
|
||||
#ifdef MC_ENABLE_DEBUGGING_CODE
|
||||
|
@ -138,11 +138,7 @@ mcview_dialog_search (mcview_t * view)
|
||||
|
||||
g_free (view->last_search_string);
|
||||
view->last_search_string = exp;
|
||||
|
||||
if (view->search_nroff_seq != NULL)
|
||||
mcview_nroff_seq_free (&(view->search_nroff_seq));
|
||||
|
||||
if (view->search != NULL)
|
||||
mcview_nroff_seq_free (&view->search_nroff_seq);
|
||||
mc_search_free (view->search);
|
||||
|
||||
view->search = mc_search_new (view->last_search_string, -1);
|
||||
|
@ -281,24 +281,28 @@ mcview_display_hex (mcview_t * view)
|
||||
gboolean
|
||||
mcview_hexedit_save_changes (mcview_t * view)
|
||||
{
|
||||
struct hexedit_change_node *curr, *next;
|
||||
int fp, answer;
|
||||
char *text, *error;
|
||||
int answer = 0;
|
||||
|
||||
if (view->change_list == NULL)
|
||||
return TRUE;
|
||||
|
||||
retry_save:
|
||||
assert (view->filename != NULL);
|
||||
fp = mc_open (view->filename, O_WRONLY);
|
||||
if (fp == -1)
|
||||
goto save_error;
|
||||
while (answer == 0)
|
||||
{
|
||||
int fp;
|
||||
char *text;
|
||||
struct hexedit_change_node *curr, *next;
|
||||
|
||||
assert (view->filename != NULL);
|
||||
|
||||
fp = mc_open (view->filename, O_WRONLY);
|
||||
if (fp != -1)
|
||||
{
|
||||
for (curr = view->change_list; curr != NULL; curr = next)
|
||||
{
|
||||
next = curr->next;
|
||||
|
||||
if (mc_lseek (fp, curr->offset, SEEK_SET) == -1 || mc_write (fp, &(curr->value), 1) != 1)
|
||||
if (mc_lseek (fp, curr->offset, SEEK_SET) == -1
|
||||
|| mc_write (fp, &(curr->value), 1) != 1)
|
||||
goto save_error;
|
||||
|
||||
/* delete the saved item from the change list */
|
||||
@ -309,27 +313,22 @@ mcview_hexedit_save_changes (mcview_t * view)
|
||||
}
|
||||
|
||||
if (mc_close (fp) == -1)
|
||||
{
|
||||
error = g_strdup (unix_error_string (errno));
|
||||
message (D_ERROR, _(" Save file "),
|
||||
_(" Error while closing the file: \n %s \n"
|
||||
" Data may have been written or not. "), error);
|
||||
g_free (error);
|
||||
}
|
||||
mcview_update (view);
|
||||
" Data may have been written or not. "), unix_error_string (errno));
|
||||
|
||||
view->dirty++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
save_error:
|
||||
error = g_strdup (unix_error_string (errno));
|
||||
text = g_strdup_printf (_(" Cannot save file: \n %s "), error);
|
||||
g_free (error);
|
||||
text = g_strdup_printf (_(" Cannot save file: \n %s "), unix_error_string (errno));
|
||||
(void) mc_close (fp);
|
||||
|
||||
answer = query_dialog (_(" Save file "), text, D_ERROR, 2, _("&Retry"), _("&Cancel"));
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
if (answer == 0)
|
||||
goto retry_save;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,6 @@ mcview_toggle_magic_mode (mcview_t * view)
|
||||
filename = g_strdup (view->filename);
|
||||
command = g_strdup (view->command);
|
||||
|
||||
mcview_done (view);
|
||||
mcview_load (view, command, filename, 0);
|
||||
g_free (filename);
|
||||
g_free (command);
|
||||
@ -92,6 +91,8 @@ mcview_toggle_magic_mode (mcview_t * view)
|
||||
void
|
||||
mcview_toggle_wrap_mode (mcview_t * view)
|
||||
{
|
||||
if (view->text_wrap_mode)
|
||||
view->dpy_start = mcview_bol (view, view->dpy_start);
|
||||
view->text_wrap_mode = !view->text_wrap_mode;
|
||||
view->dpy_bbar_dirty = TRUE;
|
||||
view->dirty++;
|
||||
@ -190,12 +191,20 @@ mcview_done (mcview_t * view)
|
||||
|
||||
coord_cache_free (view->coord_cache), view->coord_cache = NULL;
|
||||
|
||||
if (!(view->converter == INVALID_CONV || view->converter != str_cnv_from_term))
|
||||
if (view->converter == INVALID_CONV)
|
||||
view->converter = str_cnv_from_term;
|
||||
|
||||
if (view->converter != str_cnv_from_term)
|
||||
{
|
||||
str_close_conv (view->converter);
|
||||
view->converter = str_cnv_from_term;
|
||||
}
|
||||
|
||||
mc_search_free (view->search);
|
||||
view->search = NULL;
|
||||
g_free (view->last_search_string);
|
||||
view->last_search_string = NULL;
|
||||
mcview_nroff_seq_free (&view->search_nroff_seq);
|
||||
mcview_hexedit_free_change_list (view);
|
||||
}
|
||||
|
||||
|
@ -108,12 +108,21 @@ mcview_move_up (mcview_t * view, off_t lines)
|
||||
off_t i;
|
||||
for (i = 0; i < lines; i++)
|
||||
{
|
||||
new_offset = mcview_bol (view, view->dpy_start);
|
||||
off_t cur_bol;
|
||||
cur_bol = new_offset = mcview_bol (view, view->dpy_start);
|
||||
if (new_offset > 0)
|
||||
new_offset--;
|
||||
new_offset = mcview_bol (view, new_offset);
|
||||
if (new_offset < 0)
|
||||
new_offset = 0;
|
||||
if (view->text_wrap_mode)
|
||||
{
|
||||
size_t last_row_length = (view->dpy_start - new_offset) % view->data_area.width;
|
||||
if (last_row_length != 0 && cur_bol == view->dpy_start)
|
||||
new_offset = max (new_offset, view->dpy_start - last_row_length);
|
||||
else
|
||||
new_offset = max (new_offset, view->dpy_start - view->data_area.width);
|
||||
}
|
||||
view->dpy_start = new_offset;
|
||||
}
|
||||
}
|
||||
@ -149,6 +158,8 @@ mcview_move_down (mcview_t * view, off_t lines)
|
||||
{
|
||||
off_t new_offset;
|
||||
new_offset = mcview_eol (view, view->dpy_start);
|
||||
if (view->text_wrap_mode)
|
||||
new_offset = min (new_offset, view->dpy_start + view->data_area.width);
|
||||
view->dpy_start = new_offset;
|
||||
}
|
||||
}
|
||||
@ -173,10 +184,6 @@ mcview_move_left (mcview_t * view, off_t columns)
|
||||
if (old_cursor > 0 || view->hexedit_lownibble)
|
||||
view->hexedit_lownibble = !view->hexedit_lownibble;
|
||||
}
|
||||
else if (view->text_wrap_mode)
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (view->dpy_text_column >= columns)
|
||||
@ -207,10 +214,6 @@ mcview_move_right (mcview_t * view, off_t columns)
|
||||
if (old_cursor < last_byte || !view->hexedit_lownibble)
|
||||
view->hexedit_lownibble = !view->hexedit_lownibble;
|
||||
}
|
||||
else if (view->text_wrap_mode)
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
else
|
||||
{
|
||||
view->dpy_text_column += columns;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user