Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!dftsrv!news From: news@dftsrv.gsfc.nasa.gov (news) Newsgroups: comp.os.minix Subject: Re: Minimal version of C-Library in MINIX-ST?? Keywords: fopen dumb Message-ID: <198@dftsrv.gsfc.nasa.gov> Date: 5 May 89 10:54:17 GMT References: <284@nixpbe.UUCP> Reply-To: stailey@iris613.UUCP (Ken Stailey) Organization: Goddard Space Flight Center Climate and Radiation Branch Lines: 56 + In article <284@nixpbe.UUCP> mboen@nixpbe.UUCP (Martin Boening) writes: +>[stuff del'd] noticed that for **NIX-like systems the following opening modes +>for files are defined: +> +>> #define Z_READ "r" +>> #define Z_WRITE "r+" +>> #define Z_RDWR "r+" +>> #define Z_NEW "w" +> +>In the Minix sources the fopen-Routine doesn't scan the whole modestring +>though. It just looks at the first character. As a result, only three modes +>are supported: +> +> 'w' -> create file +> 'r' -> read file +> 'a' -> write to file (append) +> +>i.e with mode 'w', creat is called, with 'r' an 'open (fn, 0)' and with 'w' +>an 'open (fn, 1)'. +> +>All, open does is a 'callm3(FS,OPEN,mode,name)'. Looking at do_open I saw +>that 3 modes are supported: +> +> 0 read file +> 1 write file +> 2 read and write file <--!!! +> +>So, why can't fopen do an 'open (fn, 2)' to open a file for reading and +>writing when the modestring contains "r+" or "w+". I tried this and now +>zoo seems to work alright (some problems with the time settings remain +>[did you know that yesterday was may 1st, 1997?:-)]) +> +>My question: is the library supplied with MINIX-ST a minimal version? Has +>this been fixed? Does anybody know what GCC does and if it handles this +>better? Does anybody know of problems that might occur when opening a file +>for reading and writing using fopen (buffer problems, etc.) Does anybody +>even care to comment ? :-) From: stailey@iris613.gsfc.nasa.gov (Ken Stailey) Path: iris613!stailey What did the real version 7 have? Maybe it was somewhat small (primitive) just like MINIX. If I have some time this weekend I will try to re-write fopen(). I made freopen() for my MINIX in order to bring up some forgotten application; a modern fopen() can't be that hard, because it's so high level. I tried to bring up GCC but decided that it was not in the MINIX style because it was too big. (Also I only have 5 meg reserved on my HD for MINIX) Ken *========================================================================* { eat more disclaimer ken@all.over.the.place } *========================================================================*