Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!apple!versatc!mips!prls!philabs!linus!nixbur!nixpbe!mboen From: mboen@nixpbe.UUCP (Martin Boening) Newsgroups: comp.os.minix Subject: Minimal version of C-Library in MINIX-ST?? Keywords: fopen dumb Message-ID: <284@nixpbe.UUCP> Date: 2 May 89 08:21:11 GMT Organization: Nixdorf Computer AG, Paderborn, Germany Lines: 49 Last week I tried porting zoo to MINIX-ST and noticed something strange: I achieved compression ratios of 100 - 101 percent. The debug-output gave a first clue: lzc wrote 0 bytes to output. So I looked at the zoo sources closely and 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 ? :-) Martin Email: in Europe: ...!unido!nixpbe!mboening.pad elsewhere: ...!uunet!philabs!linus!nixbur!mboening.pad -- Email: in the USA -> ...!uunet!philabs!linus!nixbur!mboening.pad outside USA -> {...!mcvax}!unido!nixpbe!mboening.pad