home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
back2roots/padua
/
padua.7z
/
padua
/
text
/
ExAll.patch
< prev
next >
Wrap
Internet Message Format
|
2014-05-19
|
3KB
Path: zikzak!cbmger!cbmehq!cbmvax!jesup
From: jesup@cbmvax.commodore.com (Randell Jesup)
Newsgroups: adsp.betatips
Subject: Re: ExAll() & ED_COMMENT
Message-ID: <31483@cbmvax.commodore.com>
Date: 29 May 92 20:27:14 GMT
References: <sticht.05ql@edith.deg.sub.org> <31443@cbmvax.commodore.com>
Reply-To: jesup@cbmvax.commodore.com (Randell Jesup)
Distribution: adsp
Organization: Commodore, West Chester, PA
Lines: 77
mks@cbmvax.commodore.com (Michael Sinz) writes:
>sticht@edith.deg.sub.org (Stefan Sticht) writes:
>>I'm just using ExAll() (dos.library 37.44) the first time with ED_COMMENT.
>>Everything works fine except that the string ead->ed_Comment points to
>>isn't NULL-terminated.
>>
>>Is this a bug or am I doing something wrong?
>>If it's a bug, is there a more simple work-around than looking at the
>>FileInfoBlock?
>
>This is a bug... It turns out that the V37 FFS does the comment wrong when
>in ExAll(). It does it as a BSTR rather than a standard C-String. Other
>filesystems (such as RAM) do it right. Also, filesystems that do not directly
>support ExAll() but have DOS simulate it do it right too.
A workable but _ugly_ workaround (rough code, modify to suit):
// Assumes you used ED_COMMENT
if (dosversion <= 37)
{
if (ed->ed_Comment)
{
// The rom fs and ram: and dos emulation all store name first.
// If there's no ed_Next, though, we don't know how big it is.
if (ed->ed_Comment > ed->ed_Name)
if (ed->ed_Next)
size = ed->ed_Next - ed->ed_Comment;
else
size = -1;
else
it's a C-string comment.
// We now have the size available for the comment. does this
// appear to be a comment?
// The tests for long-aligned ptrs takes advantage of knowledge
// that the filesystem with this problem always did that.
// This _can_ be fooled (for example by a 66-character comment
// that starts with an 'A').
// The devicename() != NULL check will kick out NFS volumes.
if (devicename(lock) != NULL &&
strcmp(devicename(lock),"RAM") != SAME &&
(!(ed->ed_Comment & 3)) &&
(!(ed->ed_Name & 3)) &&
((UBYTE) (ed->ed_Comment)[0]) < 80 &&
(size == -1 ||
(((UBYTE) (ed->ed_Comment)[0]) <= size-1 &&
((UBYTE) (ed->ed_Comment)[0]) >= size-5)))
{
BtoCStr(ed->ed_Comment);
} else
it's a c-string comment.
}
}
devicename() probably should be done before calling exall so you only do it
once (ditto for the RAM compare). scan the dos device list for a DLT_DEVICE
with the same dol_Task, and if found return BADDR(dol_Name)+1 otherwise NULL.
(Use LockDosList/etc).
For pure paranoia, see if any comments don't fit BCPL, and if any don't then
you know that all of them aren't BCPL. However, the tests above will do
almost as well.
Any publicly released system with > V37 dos will have a fixed FS, though
early betas may not.
Ugh, what an annoying bug....
--
"Thus spake the Master Ninjei: If your application does not run correctly,
do not blame the operating system." - The Zen of Programming
-
Randell Jesup, Jack-of-quite-a-few-trades, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com BIX: rjesup
Disclaimer: Nothing I say is anything other than my personal opinion.