|
|
1.1 root 1: /* fifo_rewind.c -- Rewind an internally typed fifo. */
2: #include <sys/typed.h>
3:
4: /* Go back to the start of the fifo.
5: * Takes a FIFO. For reading, go back to the first space; for writing
6: * truncate the FIFO to empty.
7: * Returns 1 on success, 0 otherwise.
8: */
9: int
10: fifo_rewind(ffp)
11: FIFO *ffp;
12: {
13: /* Error checking of arguments. */
14: if (0 == ffp->f_flags) {
15: return(0); /* This ffp is not open. */
16: }
17:
18: /* Either reading or writing MUST be set. */
19: if ((F_READ != F_READ & ffp->f_flags) &&
20: (F_WRITE != F_WRITE & ffp->f_flags) ){
21: return(0); /* Illegal flags. */
22: }
23:
24: /* Rewind to the first space in this fifo (skip the header). */
25: ffp->f_offset = ((typed_space *) (ffp->f_space)) + 1;
26:
27: return(1);
28: } /* fifo_rewind() */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.