|
|
1.1 root 1: /* fifo_read.c -- Read from an internally typed fifo. */
2: #include <sys/typed.h>
3:
4: /* Read a typed space from a fifo.
5: * Return a pointer to the next typed space in the fifo ffp. Returns
6: * NULL on end of fifo.
7: *
8: * This read assumes that ffp->f_space has type T_FIFO_SIC.
9: */
10: typed_space *
11: fifo_read(ffp)
12: register FIFO *ffp;
13: {
14: typed_space *retval;
15:
16: /* Read MUST be set. */
17: if (F_READ != F_READ & ffp->f_flags ) {
18: return(T_NULL); /* This ffp is not open for reading. */
19: }
20:
21: /* From here to the end of fifo_read is really fifo_read_sic(). */
22:
23:
24: /* Space of size 0 marks EOFIFO. */
25: if ((long)0 == ffp->f_offset->ts_size) {
26: retval = T_NULL;
27: } else {
28: /* Return the next space. */
29: retval = ffp->f_offset;
30: /* Advance to the next space. */
31: (char *) ffp->f_offset += ffp->f_offset->ts_size;
32: }
33:
34: return(retval);
35: } /* fifo_read() */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.