[comp.sys.amiga] Matt Dillon's shell under Manx YOUR DEFINES ARE INCORRECT!

dillon@CORY.BERKELEY.EDU.UUCP (11/23/86)

>   In response to several (well, one :-)) requests, here are the changes
>I made to Matt Dillon's shell as he posted it in order to compile it
>under Aztec C.  These apply to Version 2.01, which is the most recent
>one for which source has been posted to the USENET.
>   First, it has to be compiled with the +L switch to force 32-bit ints,
>but you knew that.  Second, I #defined the xstdio library out of
>existence by adding the following lines to the end of shell.h:
>
>#ifdef MCH_AMIGA
>#define check32()
>#define xopen(a,b,c) fopen(a,b)
>#define xgets(f,s,n) fgets(s,n,f)
>#define xclose(a) fclose(a)
>#define xseek(a,b,c) fseek(a,b,c)
>#define bmov(a,b,c) movmem(a,b,c)
>#endif
>		...
>the shell's cat command, it comes out double-spaced.  I haven't checked
>sout why.
>				Steve Walton

	Two things:

xseek() uses the AMIGA seek standard (-1,0,1).  fseek() uses the UNIX
standard (0,1,2)

fgets() returns a string pointer and the string CONTAINS the newline (\n).
xgets() returns the number of characters loaded into the buffer (including
the \0), AND THE NEWLINE IS NOT IN THE STRING!

	your file had the line "charlie" in it:

	ptr = fgets(s,n,f)		"charlie\n\0"
	  8 = xgets(f,s,n)		"charlie\0"

	
Thus, your changes are incorrect (but a good try!).

					-Matt