Skip to content

Commit

Permalink
add logging on eof
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/svn/nwr/trunk@17 103c2249-d0a5-da11-ade6-0050bffea3d9
  • Loading branch information
greg committed Feb 20, 2003
1 parent 9d71222 commit 8177ee8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ int main(int argc, char *argv[])
char buf[4096];
int n = fread(buf, 1, sizeof(buf), stdin);
if (n == 0) {
fprintf(stderr, "log: eof on input\n");
break;
}
int hour = (time(0) / 3600) % 24;
Expand Down
1 change: 1 addition & 0 deletions monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ int main(int argc, char *argv[])
char buf[4096];
int n = fread(buf, 1, sizeof(buf), f);
if (n == 0) {
fprintf(stderr, "monitor: eof on input\n");
break;
}
float fbuf[sizeof(buf)/2];
Expand Down
1 change: 1 addition & 0 deletions rec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ int main(int argc, char *argv[])
char buf[4096];
int n = read(fd, buf, sizeof(buf));
if (n == 0) {
fprintf(stderr, "rec: eof on input\n");
break;
}
fwrite(buf, 1, n, f);
Expand Down
1 change: 1 addition & 0 deletions splitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ int main(int argc, char *argv[])
perror("read");
break;
} else if (n == 0) {
fprintf(stderr, "splitter: eof on input\n");
break;
}
for (int i = 0; i < nfds; i++) {
Expand Down
1 change: 1 addition & 0 deletions squelch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ int main(int argc, char *argv[])
char buf[4096];
int n = fread(buf, 1, sizeof(buf), stdin);
if (n == 0) {
fprintf(stderr, "squelch: eof on input\n");
break;
}
for (int i = 0; i < n/2; i++) {
Expand Down
2 changes: 2 additions & 0 deletions streamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ printf("RawInputStream::notifyRead\n");
perror("read");
exit(1);
} else if (n == 0) {
fprintf(stderr, "streamer: eof on input\n");
exit(0);
}
//printf("read raw %d\n", n);
Expand Down Expand Up @@ -235,6 +236,7 @@ bool TitleMonitor::notifyRead()
if (buf[i] == '\n') {
Title = title;
title.erase();
printf("Title: %s\n", Title.c_str());
} else {
title += buf[i];
}
Expand Down

0 comments on commit 8177ee8

Please sign in to comment.