ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] Q: fortune-mod and locale
@ 2003-05-27  9:18 Alexey I. Froloff
  2003-05-27  9:27 ` Alexander Bokovoy
  0 siblings, 1 reply; 12+ messages in thread
From: Alexey I. Froloff @ 2003-05-27  9:18 UTC (permalink / raw)
  To: ALTLinux devel

[-- Attachment #1: Type: text/plain, Size: 1417 bytes --]

Сказано - сделано, потом подумано...

Сделал я fortunes-ALT и подумал, что использовать одну кодировку
нехорошо. Соответсвенно захотелось научить fortune(6) выпирать
правильную, алгоритм предлагаю следующий:

Локаль выглядит как [language[_territory][.codeset][@modifier]]
(если верить SUSv3 ;-)
При добавлении файла "file" в список источников проверять на
доступность (если у нас full_locale не "POSIX", "C" или ""):

file-full_locale
file-language_territory
file-language
file

Другой вариант основан на том, что fortune принимает аргументом
полное имя файла, каталог, или имя файла из FORTDIR/OFFDIR.
Последовательность перебора следующая:

FORTDIR/full_locale/file
FORTDIR/language_territory/file
FORTDIR/language/file
FORTDIR/file

Преимущества второго варианта в том, что можно указать каталог
или полный путь до файла и fortune будет работать именно с этим
каталогом или файлом, и при этом не портится имя самого файла
(fortune отбрасывает файлы с недопустимыми расширениями и
определяет "оскорбительные" цитатники по "-o" в конце имени).

Вопрос - откуда брать full_locale? Кандидатов два, LC_MESSAGES и
LANG, я склоняюсь ко второму варианту.

Предложения, комментарии?

P.S. Стас, мне патч прислать или NMU сделать?

-- 
Regards, Alexey I. Froloff
AIF5-RIPN, AIF5-RIPE
------------------------------------------
Сделаю все, что будет в моих силах.
Последних, правда, совсем мало осталось.

	-- ldv in devel@

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-05-27 11:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-27  9:18 [devel] Q: fortune-mod and locale Alexey I. Froloff
2003-05-27  9:27 ` Alexander Bokovoy
2003-05-27  9:34   ` [devel] " Anton V. Boyarshinov
2003-05-27  9:37     ` Alexander Bokovoy
2003-05-27  9:55       ` Alexey I. Froloff
2003-05-27 10:02         ` Alexander Bokovoy
2003-05-27 10:18           ` Alexey I. Froloff
2003-05-27 10:40             ` Alexander Bokovoy
2003-05-27 11:14               ` Alexey I. Froloff
2003-05-27 11:21                 ` Alexander Bokovoy
2003-05-27 11:23                 ` Sergei Dolmatov
2003-05-27  9:42   ` [devel] " Alexey I. Froloff

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git