From 4e5612a4e83eee652b8bc79cfdcbd24e515879b8 Mon Sep 17 00:00:00 2001 From: John Denker Date: Sun, 22 Jul 2012 20:27:21 -0700 Subject: progress toward cleaning up logic of various modes and how the use their pipes --- tools/hi-test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tools/hi-test.c') diff --git a/tools/hi-test.c b/tools/hi-test.c index 47128a9..e2626cc 100644 --- a/tools/hi-test.c +++ b/tools/hi-test.c @@ -50,10 +50,22 @@ void dump(const string var){ else cerr << " is not set." << endl; } +void countsome(const int unit){ + char buf[3000]; + int total(0); + for (;;) { + int rslt = read(unit, buf, sizeof(buf)); + if (rslt <= 0) break; + total += rslt; + } + cerr << "read " << total << " bytes from unit " << unit << endl; +} + int main(int _argc, const char** _argv){ int snooze(0); int status(0); int killmode(0); + int countmode(0); int argc(_argc); const char **argv(_argv); progname = *argv; argv++; argc--; @@ -84,6 +96,10 @@ int main(int _argc, const char** _argv){ killmode++; continue; } + if (prefix(arg, "-count")) { + countmode++; + continue; + } if (arg.substr(0,1) == "x") { continue; } @@ -103,6 +119,10 @@ int main(int _argc, const char** _argv){ if (foo) cerr << " HI_Q_GROUP: " << foo; cerr << endl; sleep(snooze); + if (countmode) { + countsome(0); + countsome(1); + } if (killmode) exeunt(status); exit(status); } -- cgit v1.2.3