backslash
Bill Campbell
linux-sxs at celestial.com
Thu Jun 26 08:34:50 PDT 2008
On Thu, Jun 26, 2008, Jorge Almeida wrote:
> On Thu, 26 Jun 2008, Roger Oberholtzer wrote:
>
>>>> Perhaps you could choose some obscure utf-8 character. Even though Linux
>>>> file systems are often utf-8, you could choose some obscure Burmese
>>>> character that seldom shows up in a file name...
>>>>
>>> I know nothing about this kind of stuff. It would have to be something
>>> that I can manage through a lean C program, not requiring some strange
>>> library...
>>
>> utf-8 is only a 16-bit (a.k.a. wide) character set. All this is
>> available in C. For example, the utf-8 compatible printf is called
>> wprintf. All these are controlled by the LC_CTYPE environment variable.
>> You could set this in your code (via setenv in C) to some obscure
>> locale, like the suggested Burmese, and then use a character from that
>> in your work. It is actually very little different in your code (depends
>> on your code) to do this. Granted this has 'hack' written all over it...
>>
> It seems problematic... I'm linking it against dietlibc, to produce a
> lean static binary, and I don't think it plays well with locales stuff.
> And I want to change the input string ("/usr/bin/less") in place,
> without allocating more memory and copying it somewhere else, so using
> 2 bytes to replace 1 would break it (and using 2 bytes everywhere would
> be a large overhead---the directory is about 9M...)
>
> Maybe I have to think more about this. Perhaps accepting some ambiguity
> is not that bad...
This seems to me to be a bit of a stretch (using the file system to handle
this). I would probably use a bsddb (Berkeley/Sleepycat) btree or hash
file to track things like this, keying on the file name.
These are simple to implement, are very fast, and can be accessed with
python, perl, C, very easily.
Bill
--
INTERNET: bill at celestial.com Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
Voice: (206) 236-1676 Mercer Island, WA 98040-0820
Fax: (206) 232-9186
The question is, why are politicians so eager to be president? What is
it about the job that makes it worth revealing, on national television,
that you have the ethical standards of a slime-coated piece of
industrial waste? -- Dave Barry, "On Presidential Politics"
More information about the Linux-users
mailing list