puts(
"Usage:\n"
"tbtreetest [ -c CACHESIZE ] [-r] [-k] [-f FILE] [-D | -L | -b | -i KEY -v VALUE [ -S strategynumber ] | -d KEY | -s KEY ] [-V] [-q]\n"
+ "\t-c CACHESIZE - cache size in pages (default 0)\n"
+ "\t-r - readonly mode\n"
+ "\t-k - fixed size key (integer)\n"
+ "\t-f FILE - db-file (default ./BTREE)");
+ puts(
+ "\t-D - dump data base\n"
+ "\t-L - list all pairs (in bulk format)\n"
+ "\t-b - bulk operations from stdin in format (insert/delete/search):\n"
+ "\t I KEY VALUE\n"
+ "\t D KEY\n"
+ "\t S KEY\n"
+ "\t-i KEY -v VALUE - insert KEY/VALUE\n"
+ "\t-d KEY - delete key\n"
+ "\t-s KEY - search key\n"
+ "\t-V - print page read/writes at the end\n"
+ "\t-q - do not print results of searches\n"
);
exit(1);
}
extern char *optarg;
extern int opterr;
+#define MODE_NO 0
#define MODE_SEARCH 1
#define MODE_INSERT 2
#define MODE_DELETE 3
int rc=0;
char *file="BTREE";
char *key=NULL, *val=NULL;
- int mode=0, verbose=0, quietout=0;
+ int mode=MODE_NO, verbose=0, quietout=0;
opentlog(TL_OPEN_STDERR,TL_DEBUG, NULL);
}
}
- db.cmpkey = (db.keylen) ? cmpINT : cmpSTR;
+ if ( mode==MODE_NO )
+ usage();
+ db.cmpkey = (db.keylen) ? cmpINT : cmpSTR;
+
if ( (rc=TBTOpen(&db, file))!= TBT_OK )
exit(1);