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-29 15:32:36 -0700
commit4e5612a4e83eee652b8bc79cfdcbd24e515879b8 (patch)
tree69902739b71e899474e44c43759271db40e80881 /tools/hi-test.c
parent8f18b37fd5a46d28544a4f31465c47428a43398b (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);
}