version 1.2, 1999/11/18 00:54:17 |
version 1.4, 2001/05/04 01:06:30 |
|
|
/*$OpenXM$ */ |
/*$OpenXM: OpenXM/src/kan96xx/plugin/file2.c,v 1.3 1999/11/18 23:57:19 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include <sys/time.h> |
#include <sys/time.h> |
#include <sys/types.h> |
#include <sys/types.h> |
Line 98 int fp2fputc(int c,FILE2 *fp2) { |
|
Line 98 int fp2fputc(int c,FILE2 *fp2) { |
|
printf("fp2 = %x.\n",(int) fp2); |
printf("fp2 = %x.\n",(int) fp2); |
} |
} |
if (fp2->watch || WatchStream) { |
if (fp2->watch || WatchStream) { |
if (fp2->watch) fp = fp2->watchFile; |
if (fp2->watch) fp = fp2->watchFile; |
else fp = stderr; |
else fp = stderr; |
if (c >= ' ' && c <='z') { |
if (c >= ' ' && c <='z') { |
fprintf(fp," %2x(%c)-> ",c,c); |
fprintf(fp," %2x(%c)-> ",c& 0xff,c); |
}else{ |
}else{ |
fprintf(fp," %2x( )-> ",c); |
fprintf(fp," %2x( )-> ",c& 0xff); |
} |
} |
fflush(NULL); |
fflush(NULL); |
} |
} |
Line 127 int fp2fgetc(FILE2 *fp2) { |
|
Line 127 int fp2fgetc(FILE2 *fp2) { |
|
fp2->readpos++; |
fp2->readpos++; |
c = fp2->readBuf[fp2->readpos -1]; |
c = fp2->readBuf[fp2->readpos -1]; |
if (fp2->watch || WatchStream) { |
if (fp2->watch || WatchStream) { |
if (fp2->watch) fp = fp2->watchFile; |
if (fp2->watch) fp = fp2->watchFile; |
else fp = stderr; |
else fp = stderr; |
if (c >= ' ' && c <= 'z') { |
if (c >= ' ' && c <= 'z') { |
fprintf(fp," %2x(%c) ",c,c); |
fprintf(fp," %2x(%c) ",c,c); |
}else{ |
}else{ |
fprintf(fp," %2x( ) ",c); |
fprintf(fp," %2x( ) ",c); |
} |
} |
fflush(NULL); |
fflush(NULL); |
} |
} |
Line 143 int fp2fgetc(FILE2 *fp2) { |
|
Line 143 int fp2fgetc(FILE2 *fp2) { |
|
read(fp2->fd, fp2->readBuf, fp2->limit); |
read(fp2->fd, fp2->readBuf, fp2->limit); |
if (fp2->readsize == 0) { |
if (fp2->readsize == 0) { |
if (fp2->watch || WatchStream) { |
if (fp2->watch || WatchStream) { |
if (fp2->watch) fp = fp2->watchFile; |
if (fp2->watch) fp = fp2->watchFile; |
else fp = stderr; |
else fp = stderr; |
fprintf(fp," <%2x ",c); |
fprintf(fp," <%2x ",c); |
fflush(NULL); |
fflush(NULL); |
} |
} |
return(-1); |
return(-1); |
} |
} |
Line 217 int fp2clearReadBuf(FILE2 *fp2) { |
|
Line 217 int fp2clearReadBuf(FILE2 *fp2) { |
|
if (FD_ISSET(fd,&readfds)) { |
if (FD_ISSET(fd,&readfds)) { |
n = read(fd,tmp00, TMP00SIZE); |
n = read(fd,tmp00, TMP00SIZE); |
if (n <= 0) { |
if (n <= 0) { |
fprintf(stderr,"fp2clearReadBuf: File is closed or read error.\n"); |
fprintf(stderr,"fp2clearReadBuf: File is closed or read error.\n"); |
return(-1); |
return(-1); |
} |
} |
if ( n < TMP00SIZE ) { |
if ( n < TMP00SIZE ) { |
return(0); |
return(0); |
} |
} |
}else { |
}else { |
return(0); |
return(0); |