1: #ifndef lint
2: static char sccsid[] = "@(#)wwrint.c 3.4 4/24/85";
3: #endif
4:
5: /*
6: * Copyright (c) 1983 Regents of the University of California,
7: * All rights reserved. Redistribution permitted subject to
8: * the terms of the Berkeley Software License Agreement.
9: */
10:
11: #include "ww.h"
12: #include <fcntl.h>
13: #include <sys/signal.h>
14:
15: /*
16: * Tty input interrupt handler.
17: * (1) Read input into buffer (wwib*).
18: * (2) If the flag wwsetjmp is true, do longjmp(wwjmpbuf) for asyncronous
19: * actions, and to avoid race conditions, clear wwsetjmp.
20: * Currently, the last is used to get out of the blocking
21: * select() in wwiomux().
22: * To avoid race conditions, we only modify wwibq in here, except
23: * when the buffer is empty; and everywhere else, we only change wwibp.
24: * It should be completely safe.
25: */
26: wwrint()
27: {
28: register n;
29:
30: if (wwibp == wwibq)
31: wwibp = wwibq = wwib;
32: wwnread++;
33: (void) fcntl(0, F_SETFL, FNDELAY|wwnewtty.ww_fflags);
34: n = read(0, wwibq, wwibe - wwibq);
35: (void) fcntl(0, F_SETFL, wwnewtty.ww_fflags);
36: if (n > 0) {
37: wwibq += n;
38: wwnreadc += n;
39: } else if (n == 0)
40: wwnreadz++;
41: else
42: wwnreade++;
43: if (wwinterrupt() && wwsetjmp) {
44: wwsetjmp = 0;
45: (void) sigsetmask(sigblock(0) & ~sigmask(SIGIO));
46: longjmp(wwjmpbuf, 1);
47: }
48: }
Defined functions
Defined variables
sccsid
defined in line
2;
never used