Filetype setting on fopen

John Tytgat John.Tytgat at aaug.net
Tue Aug 6 12:03:26 PDT 2002


In message <f672bb614b.peter at moo.chocky.org>
          Peter Naulls <peter at chocky.org> wrote:

> > > The following requested by Alex but I don't know where they'd
> > > be used (it's AcornNFS server-side notation, not for unixlib
> > > apps to be generating names like this)
> > 
> > > index.html,abc    index/html  (abc - explicit filetype override mime)
> > > index,abc         index       (abc - explicit filetype)
> > 
> > I thought __riscosify() already has code to handle this?
> 
> It does.  It doesn't trim the extension though - John?  John had a
> requirement to add this behaviour for CVS stuff.

Indeed.  __riscosify will strip off the ",xyz" filetype extention of its
Unix-alike filename spec parameter and interpret this as a 12bit RISC OS
filetype (as an option __RISCOSIFY_FILETYPE_EXT).  __unixify will add
",xyz" to its RISC OS-alike filename spec parameter (this happens e.g.
in dirent routines).

This does indeed have the disadvantage that when you write two files
like "/tmp/file,ffd" and "/tmp/file,fff", you will end up with only one
file but I don't think that's a major problem.

Stripping of the filename extention could be nice but compared to the
filetype extention case this can lead to many more problems in the
__riscosify -> __unixify process (which should end up with the original
filename as much as possible).  E.g. ".html" and ".htm" are both mappend to
0xFAF in __riscosify but in __unixify() only one of the filename extentions
can be used.  Such non bijective (sp?) mappings are deadly for reliable
CVS operations but might be interesting in other programs as an option.
I would say, the src is out there for those who want to add it ;-).

BTW, perhaps not such a good idea to mention this in this thread but
IMHO, why don't we get rid of __RISCOSIFY_LONG_TRUNCATE,
__RISCOSIFY_MEDIUM_TRUNCATE, __RISCOSIFY_SHORT_TRUNCATE and
__RISCOSIFY_DROP_VOWEL ? These days we no longer have a buggy SparkFS
(at least with respect to the long filename problem), but do have
LongFiles2, raFS, several network FS with decent filename length
limitations, long filenames in RISC OS 4, etc.  Are there any UnixLib
linked projects still using this today ?

John.
-- 
John Tytgat, in his comfy chair at home                                 BASS
John.Tytgat at aaug.net                             ARM powered, RISC OS driven



More information about the gcc mailing list