New cache subsystem
[tedtools.git] / tbtreetest.c
index a6e96db..a3779ca 100644 (file)
@@ -41,7 +41,7 @@ static void
 usage() {
        puts(
        "Usage:\n"
-       "tbtreetest [ -c CACHESIZE ] [-r] [-k] [-f FILE] [-D | -L | -b | -i KEY -v VALUE [ -S strategynumber ] | -d KEY | -s KEY ] [-V]\n"
+       "tbtreetest [ -c CACHESIZE ] [-r] [-k] [-f FILE] [-D | -L | -b | -i KEY -v VALUE [ -S strategynumber ] | -d KEY | -s KEY ] [-V] [-q]\n"
        );
        exit(1);
 }
@@ -104,14 +104,17 @@ main(int argn, char *argv[]) {
        int rc=0;
        char *file="BTREE";
        char *key=NULL, *val=NULL;
-       int mode=0, verbose=0;
+       int mode=0, verbose=0, quietout=0;
 
        opentlog(TL_OPEN_STDERR,TL_DEBUG, NULL);
 
        memset(&db, 0, sizeof(TBTree));
 
-       while((i=getopt(argn,argv,"VbS:Dc:hrkf:i:v:d:s:L")) != EOF) {
+       while((i=getopt(argn,argv,"qVbS:Dc:hrkf:i:v:d:s:L")) != EOF) {
                switch(i) {
+                       case 'q':
+                               quietout=1;
+                               break;
                        case 'V':
                                verbose=1;
                                break;
@@ -251,7 +254,7 @@ main(int argn, char *argv[]) {
                                }
                                if ( *buf == 'D' ) {
                                        rc=TBTDelete(&db, &key);
-                               } else if ( (rc=TBTFind(&db, &key, &value))==TBT_OK ) {
+                               } else if ( (rc=TBTFind(&db, &key, &value))==TBT_OK && quietout==0) {
                                        if ( db.keylen )
                                                printf("%d", *(int*)(key.value));
                                        else