[lwatch-cvs] files/src lwatch.c,1.14,1.15
Brought to you by:
arturcz
|
From: <ar...@us...> - 2003-04-04 12:01:48
|
Update of /cvsroot/lwatch/files/src
In directory sc8-pr-cvs1:/tmp/cvs-serv21146/src
Modified Files:
lwatch.c
Log Message:
- when reading from stdin close on EOF
Index: lwatch.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/lwatch.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** lwatch.c 3 Apr 2003 15:09:29 -0000 1.14
--- lwatch.c 4 Apr 2003 12:01:43 -0000 1.15
***************
*** 53,57 ****
--- 53,59 ----
char *pbuf,*pstart,*pstop;
struct pollfd input;
+ int checkeof;
+ checkeof=0;
parse_options(argc,argv);
parse_config();
***************
*** 80,84 ****
res=poll(&input,1,-1);
if(errno!=EINTR) io_check(res,"poll");
! if(input.revents==POLLHUP) {
/* other end closed fifo */
if(fd) {
--- 82,88 ----
res=poll(&input,1,-1);
if(errno!=EINTR) io_check(res,"poll");
! if(input.revents==POLLHUP) checkeof=1;
! if(checkeof) {
! checkeof=0;
/* other end closed fifo */
if(fd) {
***************
*** 101,105 ****
if(res<1) continue;
io_check(res=read(fd,(void*)rbuf,BUFSIZE),"read input");
! if(!res) continue;
rbuf[res]='\0';
pstart=pbuf=addstr(pbuf,rbuf);
--- 105,112 ----
if(res<1) continue;
io_check(res=read(fd,(void*)rbuf,BUFSIZE),"read input");
! if(!res) {
! checkeof=1;
! continue;
! }
rbuf[res]='\0';
pstart=pbuf=addstr(pbuf,rbuf);
|