[comp.os.minix] fopen

V61%DHDURZ1.BITNET@cunyvm.cuny.edu (Ronald Lamprecht) (06/27/89)

Included are new versions of  fdopen.c,fflush.c,fgetc.c,fopen.c,fputc.c,
freopen.c,prints.c and a patch for stdio.h  which add r+,w+,a+ modes,
correct the append mode and flush the write buffers on every newline char.:

Mode    Create    Trunc    Read     Write   Append

"r"     no        no       yes      no      no
"w"     yes       yes      no       yes     no
"a"     yes       no       no       no      yes

"r+"    no        no       yes      yes     no
"w+"    yes       no       yes      yes     no
"a+"    yes       no       yes      no      yes

The new version is hacked together from the PC version 1.3 including the
following patches and comments:

 -  Minor bugs in Atari ST minix library    by Jwahar R. Bammi     27 Oct 88
 -  Minix/ST getc bug + fix                 by Frans Meulenbroeks  31 Oct 88
 -  fopen/fclose bug + fix                  by Frans Meulenbroeks  11 Nov 88
 -  new and improved freopen.c (I hope)     by Frans Meulenbroeks  11 Nov 88
 -  Re: new and improved freopen.c (I hope) by Brian Katzung       14 Nov 88
 -  Re: new and improved freopen.c (I hope) by Frans Meulenbroeks  18 Nov 88
 -  flushing stdandard io streams           by Martin Leisner      28 Feb 89

Additionally I have modified prints.c, which issued a direct write call
without previously flushing the buffer:
  putchar('a');prints("b");      result:   ba       !!
Furthermore I eliminated the limit of a maximum of 128 characters per prints
call.

What remains to be done: totally new f* routines which are much faster (fread,
fwrite still call fgetc res. fputc once for every byte !!) and with a better
error handling.

ST: - the Makefile should be modified according to the official updates
      (getc -> fgetc, putc -> fputc)
    - fcntl.h  is included  (from PC version 1.3)
    - fseek.c  is included  (slightly improved PC version 1.3)
        (the ST version contains a bug reported by F.Meulenbroeks 11 Nov 88)

The files are tared, compressed and uuencoded.(Sorry, but I'm on EBCDIC-Bitnet)

Bitnet:  V61@DHDURZ1                               Ronald Lamprecht
UUCP:    ...!unido!DHDURZ1.bitnet!V61              Theoretische Physik
ARPAnet: V61%DHDURZ1.BITNET@CUNYVM.CUNY.EDU       (Heidelberg, West Germany)

--------------------------------cut here------------------------------------
table
 !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ZB3NBD+K&FGEGC+.4 O.HZT.JO'NNP6>XO3X2.p
M@NOISNLS?_#!CA:I3NQ;;^S(CBHJH.RK4J_TU>S/?NT;..T@4.W0OH'OO.W"o
MXNT[#^ZO#@?D[O)XCN[9 O4+QN[NKO3<G.TI,._U?N]&EV#[CNAKX.]@C^<#n
M[^F/?/:_GO8\L?!GT_ /?P(1GRV(7^L6'_,8C_:[J%:Y0R9*I-98[1%:?44]m
MU1$T0"(7C!(V( -!51,WX(@V<-9KO?S,+\)Q#Q6S;Q!?\!%AD !4@ 9U$!5El
M( 8@( -&XH@Z( ,XH ,>$@,Y@ ,XH  R]LO1CP;6C_TG/"3 _Q+A3P/A;P.Ik
M?/XYH #/W__^__S\+^ZE,AGP7E1"_U-_,F8 OA<CL?Y:@&;!#,L!!$BA :(]j
MVL,,0! \ 0*R!YLA!:  9N(+: $C/$ U81<Z5!+(3.H"+0B5].<D-*!=4%AQi
M@B?,!!N@ %H@"3P+#<M5,1H,&*= @)8P W9D+$2%>:%9%$#;>W5O[U'(/2C'h
M[.:>L],5?4_:[2IJ9^TT4.CX>_3%R@4^"_/MCDSA.WP/3_'MNE#7^/1&NTM/g
M\(YMR#O;4?G@R^73=R.OW[6 ?T?Q!![!LS &;_0E/+1@^MI>ZEM]G<_U@3I=f
.EP?_7/,[A(@P$2I"* *Oe
 d
end
--------------------------------end-----------------------------------------

culberts@hpccc.HP.COM (Bruce Culbertson) (07/21/89)

I think there are some incompatibilities between the recently posted
buffered I/O library routines and the ones I have used on BSD and
System V Unix.  In my experience, buffered files are flushed

	1) when their buffers fill,
	2) when explicitly flushed with a call to fflush(),
	3) when the file is closed,
	4) when the process calls exit(), and
	5) if stdin is read, stdout is flushed.

Unfortunately, I cannot seem to find a description of this in my
Unix documentation.  Perhaps someone else will find the documentation
and comment.

The new routines differ in the following ways:

	A) Stdout is not flushed when stdin is read.
	B) Stdout is flushed on all (f)printf's to stdout.
	C) Stdout is flushed after all newlines are written to stdout.

Problem A breaks several applications which perform fine on various
Unix systems.  The problem is not apparent if prompts for interactive
input are written with (f)printf because of B.  However, if a prompt is
written with (f)putc or fwrite, it never appears.  B and C are merely
performance issues, but perhaps are worth considering since stdio
exists solely to improve performance.  After implementing 5, I had
no further trouble with the new routines.  Having the "+" options
in fopen is a nice improvement.

------------------------------------------------------------------
/*  17 Jun 89   r+,w+,a+  added    RAL */

#include <stdio.h>



fgetc(iop)
FILE *iop;
{
	int ch;

	if ( testflag(iop, (_EOF | _ERR )))
		return (EOF);

	if (iop == stdin && stdout->_count > 0)
		fflush (stdout);

	if ( !testflag(iop, READMODE) ) {
                if (!testflag(iop, RDWRMODE))
		        return (EOF);
                fflush(iop);
                iop->_count = 0;
                iop->_ptr = iop->_buf;
                iop->_flags &= ~WRITEMODE;
                iop->_flags |= READMODE;
        }

	if (iop->_count <= 0){

		if ( testflag(iop, UNBUFF) )
			iop->_count = read(iop->_fd,&ch,1);
		else
			iop->_count = read(iop->_fd,iop->_buf,BUFSIZ);

		if (iop->_count <= 0){
			if (iop->_count == 0)
				iop->_flags |= _EOF;
			else
				iop->_flags |= _ERR;

			return (EOF);
		}
		else
			iop->_ptr = iop->_buf;
	}

	iop->_count--;		/* account one char */
	if (testflag(iop,UNBUFF))
		return (ch & CMASK);
	else
		return (*iop->_ptr++ & CMASK);
}

AJB@dlvh.daresbury.ac.uk (10/23/90)

I noticed in patching BISON for GNUC on the ST that the following code
segment doesn't work on either the ACK or GNUC (or PC?) compilers.

FILE *fp;
char line[10];

fp = fopen("anyfile","w+");
fprintf(fp,"Hello\nWorld\n");

rewind(fp);
fgets(line,10,fp);
printf("%s",line);

You definitely end up with a file containing the requisite text but the
rewind doesn't work (which is not surprising looking at fopen.c) hence
no 'Hello' is printed.
To get bison to work I had to fclose(fp) and fopen() with "r" in place of
the rewind().

BEWARE! the man pages I have says 'w+' is a valid option.

Alan Bleasby
SERC Daresbury Laboratory
Daresbury
Warrington UK
Email: AJB@UK.AC.DARESBURY.DLVH

cechew@bruce.cs.monash.OZ.AU (Earl Chew) (10/25/90)

In <34240@nigel.ee.udel.edu> AJB@dlvh.daresbury.ac.uk writes:

>BEWARE! the man pages I have says 'w+' is a valid option.

Use estdio.

Earl
-- 
Earl Chew, Dept of Computer Science, Monash University, Australia 3168
EMAIL: cechew@bruce.cs.monash.edu.au PHONE: 03 5655447 FAX: 03 5655146
----------------------------------------------------------------------

eesrajm@cc.brunel.ac.uk (Andrew J Michael) (03/17/91)

Would one of the POSIX police please let me know what the current state of
thinking is with regard to the access mods for fopen() ?

I am particularly interested in the use of the 'b' flag.  This is obviously
meaningless to MINIX/UNIX, but what should be done with it ?  Should it
be silently ignored, or flagged as an error ?

Andy Michael


-- 
Andy Michael                                     "You might think that.  I
85 Hawthorne Crescent                             couldn't possibly comment."
West Drayton					    - `House of Cards'
Middlesex            email: eesrajm@brunel.ac.uk                             
UB7 9PA           or Andrew.Michael@brunel.ac.uk

waltje@uwalt.nl.mugnet.org (Fred 'The Rebel' van Kempen) (03/22/91)

eesrajm@cc.brunel.ac.uk (Andrew J Michael) wrote:
> 
> Would one of the POSIX police please let me know what the current state of
> thinking is with regard to the access mods for fopen() ?
I am just a programmer, but:

Estdio(3) does it correctly.  Use it, and Be Happy :-)

> I am particularly interested in the use of the 'b' flag.  This is obviously
> meaningless to MINIX/UNIX, but what should be done with it ?  Should it
> be silently ignored, or flagged as an error ?
It means "binary open" (as you probably know), and it mainly causes the
stdio functions to:

- not treat byte 0xFF as EOF ( == -1 !)
- not perform any data conversion

Again, Estdio does the job well...

Fred.
--
MicroWalt Corporation, for MINIX Development	waltje@uwalt.nl.mugnet.org
Tel (+31) 252 230 205, Hoefbladhof  27, 2215 DV  VOORHOUT, The Netherlands