[comp.sys.atari.st] Where is my Fshrink

alderaan@tubopal.UUCP (Thomas Cervera) (07/28/89)

Hi,

  is there any problem adding a Fshrink(handle,newsize) GEMDOS call
to the next GEMDOS release ? I think it's very frustrating to shrink files
through a temporary file (the archiving program I'm writing has to do this
while deleting files from archive).

  I would like to know what's the opinion especially of you ATARI people
about this subject (Alan, do you hear me ?).

  Besides, would it be too difficult (or impossible) to include a FAT pointer
into the floppy boot sector ? This could enhance disk I/O performance, I guess
(placing the FAT at the middle of the disk).

That's it for now, fellows, have a nice time.

ignac@electro.UUCP (Ignac Kolenko) (08/01/89)

In article <629@siena.tubopal.UUCP> alderaan@tubopal.UUCP (Thomas Cervera) writes:
>Hi,
>
>  is there any problem adding a Fshrink(handle,newsize) GEMDOS call
>to the next GEMDOS release ? I think it's very frustrating to shrink files
>through a temporary file (the archiving program I'm writing has to do this
>while deleting files from archive).
>



why not just open the file for write, move the file pointer using
Fseek() and then close the file. that should do what you ask for.



if not, what will do it, Atari?????






-- 
=====Ignac A. Kolenko (The Ig)           watmath!watcgl!electro!ignac=====
     co-author of QuickST, and the entire line of Quick Shareware!!!!
       "I don't care if I don't win, 'cause I don't care if I fail"
             from 'Youth Of Today' by SUBURBAN DISTORTION 

alderaan@tubopal.UUCP (Thomas Cervera) (08/02/89)

In article <667@electro.UUCP> ignac@electro.UUCP (Ignac Kolenko) writes:
>In article <629@siena.tubopal.UUCP> alderaan@tubopal.UUCP (Thomas Cervera) writes:
>>  is there any problem adding a Fshrink(handle,newsize) GEMDOS call
>>to the next GEMDOS release ? I think it's very frustrating to shrink files
>>through a temporary file (the archiving program I'm writing has to do this
>>while deleting files from archive).
>>
>why not just open the file for write, move the file pointer using
>Fseek() and then close the file. that should do what you ask for.

  According to this little machine code I wrote for testing, this has
absolutely NO effect to the tested file or to GEMDOS.

.GEMDOS		macro
		move.w	#\1,-(SP)	; pass subfunction #
		trap	#1
		lea	\2+2(SP),SP	; stack correction
		endm

		text

		; Init & Mshrink () stuff

FStest		move.w	#1,-(SP)	; open for write
		pea	fn
		.GEMDOS	$3D,6		; Fopen ()
		move.l	D0,D1		; store file handle
		tst.l	D0
		bmi	error

		clr.w	-(SP)		; seek from beginning of file
		move.w	D1,-(SP)	; pass file handle
		move.l	#1000,-(SP)	; skip 1000 bytes
		.GEMDOS	$42,8		; Fseek ()
		tst.l	D0
		bmi	error

		move.w	D1,-(SP)	; pass file handle
		.GEMDOS	$3E,2		; Fclose ()
		tst.l	D0
		bmi	error

mummy		.GEMDOS	0,0		; back to mum

error		; display an error message
		bra	mummy

		data

fn		'globber.fil',0		; file exists and has about 32k

		bss

		...

  I did not upload this code, but it should be error-free :-) Or is it not ?!
I used TOS 1.4 (GEMDOS V0.15). The file was a cached hard disk file (CACHEXXX).

-- 
Thomas Cervera         | UUCP:   alderaan@tubopal.UUCP       
SysMan RKOpdp (RSTS/E) |         alderaan%tubopal.UUCP@TUB.BITNET (saves $$$)
D-1000 Berlin 30       |         ...!pyramid!unido!tub!opal!alderaan
Motzstrasze 14         | BITNET: alderaan%tub@DB0TUI11.BITNET 

agollum@engr.uky.edu (Kenneth Herron) (08/06/89)

I don't have an ST myself, but in MS-DOS you accomplish this by
seeking to the desired position and issuing a write of 0 characters.
It's worth a try...

Kenneth Herron

leo@philmds.UUCP (Leo de Wit) (08/08/89)

In article <2951@ukecc.engr.uky.edu> agollum@engr.uky.edu (Kenneth Herron) writes:
|I don't have an ST myself, but in MS-DOS you accomplish this by
|seeking to the desired position and issuing a write of 0 characters.
|It's worth a try...
|
|Kenneth Herron

Alas, it won't work, or better: fortunately. If such a stupid system
design had been made, you had to check all your ordinary writes for
zero-length writes, perhaps by writing a wrapper for Fwrite(). This
really ought to be a separate system call a la BSD fruncate() (now I
remember System V Unix also did something special with zero-length
writes, but memory fades here).

The file's length won't be affected (using Fopen with either mode 1 -
writeonly - or 2 - read/write). And if you issue a write of > 0
characters, those characters will replace the ones already there in the
file.

There is one situation in which you can truncate a file, that is to
length zero (using the Fcreate call). This is faster than explicit
removing the file first (so my documentation says).

   Leo.