[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fpurge.c on Plan9/APE

From: Jens Staal
Subject: Re: fpurge.c on Plan9/APE
Date: Fri, 3 Feb 2012 05:14:49 +0100

2012/2/2 Paul Eggert <address@hidden>:
> 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:

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?) */

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?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]