
; The program "SCTest" shows up the problem I had using PacMan's -Y option.
; Just run SCTest as follows: (CLI ONLY !!)

; SCTest Ram:TestFile

; SCTest will create a file of zero bytes size.
; Look at the Ram disk then. The file will have the file comment "TestComment".

; Now run SCTest again with the following args:

; SCTest DH0:TestFile

; or

; SCTest DF0:TestFile

; Examine the new file. You'll see that the file comment is missing !
; This strange effect occurs under Kick 1.3 as well as with Kick 2.04.

; The problem is, that you have to close file opened with MODE_NEW, before you
; may change it's comment. I really don't know why the SetComment call works
; fine if the file is stored in the RAM: device...

; I didn't find the bug because I always test my programs using the RAM:
; device; I NEVER work with my harddisk...(I'm NOT crazy...:^)

; You may test everything yourself using this little source code.
; (quite primitive; without any include stuff).


	tst.l	d0		; Check for arguments
	bne.s	Continue
	rts			; Quit if no args typed.

Continue
	move.l	a0,FileName
	move.b	#0,-1(a0,d0.w)	; Convert args => DOS string

	move.l	4.w,a6		; ExecBase
	lea	DosName(pc),a1	; dos.library
	moveq	#33,d0		; Version 33.xx (Kick 1.2+)
	jsr	-552(a6)	; OpenLibrary
	move.l	d0,a6		; DosBase; no error check.

	move.l	FileName,d1
	move.l	#1006,d2	; MODE_NEW
	jsr	-30(a6)		; Open
	move.l	d0,FileHandle
	beq.s	Quit

	move.l	FileName,d1
	move.l	#NewFileComment,d2
	jsr	-180(a6)	; SetComment

	move.l	FileHandle,d1
	jsr	-36(a6)		; Close

Quit
	move.l	a6,a1
	move.l	4.w,a6		; Exec
	jsr	-414(a6)	; Close dos.library
	rts

;------------------------------------------------------------------------------

FileHandle	dc.l	0
FileName	dc.l	0

DosName		dc.b	"dos.library",0
NewFileComment	dc.b	"TestComment",0

	end

                                                         BLOODROCK / SYNDICATE
