[comp.sys.amiga.tech] Indicating end of file

ben@epmooch.UUCP (Rev. Ben A. Mesander) (10/07/90)

>In article <14935@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes:
[...]
>	There is no "end of file" character in amigados.
[...]

What is ctrl-\ then? Does it not indicate EOF to a stream that is connected
to a console at least? (Yes, I realize that the character is not put as the
last character in a file ala CP/M ctrl-Z).

>-- 
>Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
>{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
>Common phrase heard at Amiga Devcon '89: "It's in there!"

--
| ben@epmooch.UUCP   (Ben Mesander)       | "Cash is more important than |
| ben%servalan.UUCP@uokmax.ecn.uoknor.edu |  your mother." - Al Shugart, |
| !chinet!uokmax!servalan!epmooch!ben     |  CEO, Seagate Technologies   |

jesup@cbmvax.commodore.com (Randell Jesup) (10/08/90)

In article <1990Oct3.172801.26802@jato.jpl.nasa.gov> jdickson@jato.Jpl.Nasa.Gov (Jeff Dickson) writes:
>	copy SID:2400,1,8,N,031 sidout
...
>	If the file exists, Copy concludes by printing the message,
>"Error during writing - sidout removed". Otherwise, copy doesn't
>print an error, but I can't Type the file because (I guess) the 
>end of file (^J ?) has been obscured. Funny thing is according to
>the List command, the file contains the same number of bytes as
>the characters I typed on the terminal.

	There is no "end of file" character in amigados.  It almost sounds
like the file was never closed.

>		ACTION_LOCATE_OBJECT
>		ACTION_EXAMINE_OBJECT
>			...so that the whatever is inputing from
>			the SID doesn't give up because there is
>			nothing to read, I block the DOS packet
>			until something does become available.
>
>		        When the DOS request can be satisfied, I
>			insert the number of bytes available in
>			the 'fib_Size' field and the number of
>			blocks in the 'fib_NumBlocks' field (usally
>			zero). I have no idea what to initialize
>			the 'fib_DiskKey' field as. I've tried -1
>			and 0.

	Copy makes use of the fib_Size field.  You actually might wish to
reject the ACTION_LOCATE_OBJECT packet with ERROR_ACTION_NOT_KNOWN.  This
tells copy (and other system routines/commands) that you're a handler and
not a filesystem (2.0 has an ACTION_IS_FILESYSTEM packet).  The standard
SER:, PAR:, etc reject lock attempts.

...
>		ACTION_END
>
>	I have a rather old Transactor magazine that includes an article
>on AmigaDOS. It says on end of file that the 'RES1' field of the DOS packet
>is to contain a -1 (DOSFALSE) and that the 'RES2' is to contain the end of
>file indication (in my case zero). I tried that, but it didn't work. So
>now, I just put zero in the 'RES1' field when end of file occurs.

	URK!  DOSTRUE is -1, DOSFALSE is 0 (aka FALSE).  Most boolean
routines/actions return this.  Read and Write return the length read or
written, or 0 for end of file, or -1 for an error.  For all routines, the
reason for the error is put in dp_Res2 (eventually it can be retrieved from
pr_Result2 by IoErr()).  See dos/dos.h for a listing of error codes.

	There is an example of a port-handler on the Washington devcon disk.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"

S.J.Raybould@fulcrum.bt.co.uk (Simon Raybould) (10/09/90)

In article <ben.2920@epmooch.UUCP> ben@epmooch.UUCP (Rev. Ben A. Mesander) writes:
>>In article <14935@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes:
>>	There is no "end of file" character in amigados.
>
>What is ctrl-\ then? Does it not indicate EOF to a stream that is connected

ctrl-\ is not an end of file character !!!!

ctrl-\ has nothing to do with files !

It is interpreted as meaning the end of input from the console and that is all.
It causes the corresponding read on that console to return 0 which is not an
error, but no bytes were read. This is then interpreted by the application as
meaning there is no more data to read from this source. It is not an end of
file marker because the only things it applies to are NOT files.

An End Of File character is the ^Z you see in MSDOS files and old CPM stuff.

So I will back up Randell ->
	There is no "end of file" character in amigados.




+-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
|   British Telecom Fulcrum  | name : Simon John Raybould   {^.^}   |
|   Fordrough Lane           | path : sie@fulcrum.bt.co.uk   \~/    |
|   Birmingham               +-----------+--------------------------|
|   B9 5LD                   |   //      | AMIGA B2000              |
|   ENGLAND                  | \X/AMIGA  | Lattice C V5.05          |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-+

dillon@overload.Berkeley.CA.US (Matthew Dillon) (10/10/90)

In article <ben.2920@epmooch.UUCP> ben@epmooch.UUCP (Rev. Ben A. Mesander) writes:
>>In article <14935@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes:
>[...]
>>	There is no "end of file" character in amigados.
>[...]
>
>What is ctrl-\ then? Does it not indicate EOF to a stream that is connected
>to a console at least? (Yes, I realize that the character is not put as the
>last character in a file ala CP/M ctrl-Z).

    ctrl-\ sent to a cooked console causes the console to send an EOF
    (i.e. Read() returns an error) to the program doing the Read().  The
    ctrl-\ character itself is NEVER interpreted by a program as meaning
    EOF, it is just a specially cooked character by the console device, just
    like ^X and other control characters.

    In otherwords, a ctrl-\ inside a text file does not cause, generate or
    indicate an EOF.

    The original idea of having an EOF character took off with CP/M, where
    files were always multiples of the sector size long and an EOF
    character was required so programs would not misinterpret extra garbage
    after the 'end' of the file.  Unfortunately, the IBM-PC propogated the
    idiocy, and in fact never phased it out even though PC-DOS/MS-DOS
    finally did implement a real file length and support calls to handle
    it.

--

    Matthew Dillon	    dillon@Overload.Berkeley.CA.US
    891 Regal Rd.	    uunet.uu.net!overload!dillon
    Berkeley, Ca. 94708
    USA

jesup@cbmvax.commodore.com (Randell Jesup) (10/10/90)

In article <ben.2920@epmooch.UUCP> ben@epmooch.UUCP (Rev. Ben A. Mesander) writes:
>>In article <14935@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes:
>>	There is no "end of file" character in amigados.
>[...]
>
>What is ctrl-\ then? Does it not indicate EOF to a stream that is connected
>to a console at least? (Yes, I realize that the character is not put as the
>last character in a file ala CP/M ctrl-Z).

	Yes, it is a special keystroke to the console-handler (CON:/RAW:).
It is not special to AmigaDos itself, and as you know, it's not put at the
end of a file (even if you send the output of a CON: window to a file).

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"