2012/2/2 Paul Eggert <egg...@cs.ucla.edu>: > On 02/02/2012 03:04 AM, Jens Staal wrote: >> do I need a custom made one >> and how should that one look? > > That's what it looks like. You can start by inspecting > <stdio.h> and look for fields in its FILE * structure.
The Plan9 APE stdio can be seen here: http://plan9.bell-labs.com/sources/plan9/sys/include/ape/stdio.h The important part is probably: typedef struct{ int fd; /* UNIX file pointer */ char flags; /* bits for must free buffer on close, line-buffered */ char state; /* last operation was read, write, position, error, eof */ char *buf; /* pointer to i/o buffer */ char *rp; /* read pointer (or write end-of-buffer) */ char *wp; /* write pointer (or read end-of-buffer) */ char *lp; /* actual write pointer used when line-buffering */ size_t bufl; /* actual length of buffer */ char unbuf[1]; /* tiny buffer for unbuffered io (used for ungetc?) */ }FILE; I am not sure exactly what I am looking for and how I should use this to implement a case in fpurge.c :( During compilation of fpurge.c, which came bundled in the lib/ directory of m4, it was mentioned that I should send the definitions fflush, setvbuf and ungetc. However, I do not see those mentioned anywhere in the other "#elif (operating system or other definition)" cases. It seems like the pointer "fp" or similar should do something with reading and writing to the end of a file? So I should use *rp and *wp - but how?