io.c (11128de9739990e6d4b199d3b09e958aa68ba4c7) | io.c (e1b4d8d0746069292d84708b0e11b17a7e1ef5e0) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 34 unchanged lines hidden (view full) --- 43 * This file contains the I/O handling and the exchange of 44 * edit characters. This connection itself is established in 45 * ctl.c 46 */ 47 48#include <errno.h> 49#include <string.h> 50#include <sys/filio.h> | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 34 unchanged lines hidden (view full) --- 43 * This file contains the I/O handling and the exchange of 44 * edit characters. This connection itself is established in 45 * ctl.c 46 */ 47 48#include <errno.h> 49#include <string.h> 50#include <sys/filio.h> |
51#include <unistd.h> |
|
51#include "talk.h" 52 53#define A_LONG_TIME 10000000 54 55/* 56 * The routine to do the actual talking 57 */ 58void --- 41 unchanged lines hidden (view full) --- 100 } 101 if (FD_ISSET(fileno(stdin), &read_set)) { 102 /* 103 * We can't make the tty non_blocking, because 104 * curses's output routines would screw up 105 */ 106 int i; 107 ioctl(0, FIONREAD, (struct sgttyb *) &nb); | 52#include "talk.h" 53 54#define A_LONG_TIME 10000000 55 56/* 57 * The routine to do the actual talking 58 */ 59void --- 41 unchanged lines hidden (view full) --- 101 } 102 if (FD_ISSET(fileno(stdin), &read_set)) { 103 /* 104 * We can't make the tty non_blocking, because 105 * curses's output routines would screw up 106 */ 107 int i; 108 ioctl(0, FIONREAD, (struct sgttyb *) &nb); |
108 nb = read(0, buf, nb); | 109 nb = read(STDIN_FILENO, buf, nb); |
109 display(&my_win, buf, nb); 110 /* might lose data here because sockt is non-blocking */ 111 for (i = 0; i < nb; ++i) 112 if (buf[i] == '\r') 113 buf[i] = '\n'; 114 write(sockt, buf, nb); 115 } 116 } --- 32 unchanged lines hidden --- | 110 display(&my_win, buf, nb); 111 /* might lose data here because sockt is non-blocking */ 112 for (i = 0; i < nb; ++i) 113 if (buf[i] == '\r') 114 buf[i] = '\n'; 115 write(sockt, buf, nb); 116 } 117 } --- 32 unchanged lines hidden --- |