summaryrefslogtreecommitdiff
path: root/tools/hi-test.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-22 20:27:21 -0700
committerJohn Denker <jsd@av8n.com>2012-07-22 20:27:21 -0700
commit8164bf28464ad3e7628c422d6f02e3b515702d12 (patch)
tree72657534b46d2c4c16e589df498e7f9523330f2a /tools/hi-test.c
parent5b0852f0b2ddfd7d65711daf8602492a60917fbd (diff)
progress toward cleaning up logic of various modes and how the use their pipes
Diffstat (limited to 'tools/hi-test.c')
-rw-r--r--tools/hi-test.c20
1 files changed, 20 insertions, 0 deletions
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);
}