- err(1, "Opening tdb %s", argv[2]);
- } else if (streq(words[0], "tdb_lockall")) {
- add_op(&op, i, OP_TDB_LOCKALL, NULL, NULL, 0, 0);
- } else if (streq(words[0], "tdb_lockall_mark")) {
- add_op(&op, i, OP_TDB_LOCKALL_MARK, NULL, NULL, 0, 0);
- } else if (streq(words[0], "tdb_lockall_unmark")) {
- add_op(&op, i, OP_TDB_LOCKALL_UNMARK, NULL, NULL, 0, 0);
- } else if (streq(words[0], "tdb_lockall_nonblock")) {
- add_op(&op, i, OP_TDB_LOCKALL_NONBLOCK, NULL, NULL, 0,
- atoi(words[1]));
- } else if (streq(words[0], "tdb_unlockall")) {
- add_op(&op, i, OP_TDB_UNLOCKALL, NULL, NULL, 0, 0);
- } else if (streq(words[0], "tdb_lockall_read")) {
- add_op(&op, i, OP_TDB_LOCKALL_READ, NULL, NULL, 0, 0);
- } else if (streq(words[0], "tdb_lockall_read_nonblock")) {
- add_op(&op, i, OP_TDB_LOCKALL_READ_NONBLOCK, NULL, NULL,
- 0, atoi(words[1]));
- } else if (streq(words[0], "tdb_unlockall_read\n")) {
- add_op(&op, i, OP_TDB_UNLOCKALL_READ, NULL, NULL, 0, 0);
- } else if (streq(words[0], "tdb_chainlock")) {
- add_op(&op, i, OP_TDB_CHAINLOCK, words[1], NULL, 0, 0);
- } else if (streq(words[0], "tdb_chainlock_nonblock")) {
- add_op(&op, i, OP_TDB_CHAINLOCK_NONBLOCK,
- words[1], NULL, 0, atoi(words[3]));
- } else if (streq(words[0], "tdb_chainlock_mark")) {
- add_op(&op, i, OP_TDB_CHAINLOCK_MARK, words[1], NULL,
- 0, 0);
- } else if (streq(words[0], "tdb_chainlock_unmark")) {
- add_op(&op, i, OP_TDB_CHAINLOCK_UNMARK, words[1], NULL,
- 0, 0);
- } else if (streq(words[0], "tdb_chainunlock")) {
- add_op(&op, i, OP_TDB_CHAINUNLOCK, words[1], NULL,
- 0, 0);
- } else if (streq(words[0], "tdb_chainlock_read")) {
- add_op(&op, i, OP_TDB_CHAINLOCK_READ, words[1],
- NULL, 0, 0);
- } else if (streq(words[0], "tdb_chainunlock_read")) {
- add_op(&op, i, OP_TDB_CHAINUNLOCK_READ, words[1],
- NULL, 0, 0);
- } else if (streq(words[0], "tdb_close")) {
- add_op(&op, i, OP_TDB_CLOSE, NULL, NULL, 0, 0);
- } else if (streq(words[0], "tdb_increment_seqnum_nonblock")) {
- add_op(&op, i, OP_TDB_INCREMENT_SEQNUM_NONBLOCK,
- NULL, NULL, 0, 0);
- } else if (streq(words[0], "tdb_fetch")) {
- if (streq(words[3], "ENOENT"))
- add_op(&op, i, OP_TDB_FETCH, words[1], NULL, 0,
- -TDB_ERR_NOEXIST);
- else
- add_op(&op, i, OP_TDB_FETCH, words[1], words[3],
- 0, 0);
- } else if (streq(words[0], "tdb_parse_record")) {
- if (streq(words[3], "ENOENT"))
- add_op(&op, i, OP_TDB_PARSE_RECORD,
- words[1], NULL, 0, -TDB_ERR_NOEXIST);
- else
- add_op(&op, i, OP_TDB_PARSE_RECORD,
- words[1], NULL, 0, atoi(words[3]));
- } else if (streq(words[0], "tdb_exists")) {
- add_op(&op, i, OP_TDB_EXISTS, words[1], NULL, 0,
- atoi(words[3]));
- } else if (streq(words[0], "tdb_delete")) {
- add_op(&op, i, OP_TDB_DELETE, words[1], NULL, 0,
- streq(words[3], "ENOENT")
- ? -TDB_ERR_NOEXIST : 0);
- } else if (streq(words[0], "tdb_store")) {
- int flag;
-
- if (streq(words[1], "insert"))
- flag = TDB_INSERT;
- else if (streq(words[1], "modify"))
- flag = TDB_MODIFY;
- else if (streq(words[1], "normal"))
- flag = 0;
- else
- errx(1, "Line %u: invalid tdb_store", i+1);
-
- if (streq(words[5], "EEXIST"))
- add_op(&op, i, OP_TDB_STORE, words[2], words[3],
- flag, -TDB_ERR_EXISTS);
- else if (streq(words[5], "ENOENT"))
- add_op(&op, i, OP_TDB_STORE, words[2], words[3],
- flag, -TDB_ERR_NOEXIST);
- else
- add_op(&op, i, OP_TDB_STORE, words[2], words[3],
- flag, 0);
- } else if (streq(words[0], "tdb_append")) {
- add_op(&op, i, OP_TDB_STORE, words[1], words[2], 0, 0);
- } else if (streq(words[0], "tdb_get_seqnum")) {
- add_op(&op, i, OP_TDB_GET_SEQNUM, NULL, NULL, 0,
- atoi(words[2]));
- } else if (streq(words[0], "tdb_wipe_all")) {
- add_op(&op, i, OP_TDB_WIPE_ALL, NULL, NULL, 0, 0);
- } else if (streq(words[0], "tdb_transaction_start")) {
- add_op(&op, i, OP_TDB_TRANSACTION_START, NULL, NULL,
- 0, 0);
- } else if (streq(words[0], "tdb_transaction_cancel")) {
- add_op(&op, i, OP_TDB_TRANSACTION_CANCEL, NULL, NULL,
- 0, 0);
- } else if (streq(words[0], "tdb_transaction_commit")) {
- add_op(&op, i, OP_TDB_TRANSACTION_COMMIT, NULL, NULL,
- 0, 0);
- } else if (streq(words[0], "tdb_traverse_read_start")) {
- add_op(&op, i, OP_TDB_TRAVERSE_READ_START, NULL, NULL,
- 0, 0);
- } else if (streq(words[0], "tdb_traverse_start")) {
- add_op(&op, i, OP_TDB_TRAVERSE_START, NULL, NULL,
- 0, 0);
- } else if (streq(words[0], "tdb_traverse_end")) {
- add_op(&op, i, OP_TDB_TRAVERSE_END, NULL, NULL,
- 0, atoi(words[2]));
- } else if (streq(words[0], "traverse")) {
- add_op(&op, i, OP_TDB_TRAVERSE, words[1], words[2],
- 0, 0);
- } else if (streq(words[0], "tdb_firstkey")) {
- if (streq(words[2], "ENOENT"))
- add_op(&op, i, OP_TDB_FIRSTKEY, NULL, NULL,
- 0, -TDB_ERR_NOEXIST);
- else
- add_op(&op, i, OP_TDB_FIRSTKEY, NULL, words[2],
- 0, 0);
- } else if (streq(words[0], "tdb_nextkey")) {
- if (streq(words[3], "ENOENT"))
- add_op(&op, i, OP_TDB_NEXTKEY, words[1], NULL,
- 0, -TDB_ERR_NOEXIST);
- else
- add_op(&op, i, OP_TDB_NEXTKEY,
- words[1], words[3], 0, 0);
- } else
- errx(1, "Line %u: unknown op '%s'", i+1, words[0]);