static char *subname = NULL;
-static size_t lineno;
+static mdb_size_t lineno;
static int version;
static int flags;
static MDB_val kbuf, dbuf;
-#define Z MDB_FMT_Z
#define Y MDB_FMT_Y
#define STRLENOF(s) (sizeof(s)-1)
if (!strncmp(dbuf.mv_data, "VERSION=", STRLENOF("VERSION="))) {
version=atoi((char *)dbuf.mv_data+STRLENOF("VERSION="));
if (version > 3) {
- fprintf(stderr, "%s: line %" Z "d: unsupported VERSION %d\n",
+ fprintf(stderr, "%s: line %" Y "u: unsupported VERSION %d\n",
prog, lineno, version);
exit(EXIT_FAILURE);
}
if (!strncmp((char *)dbuf.mv_data+STRLENOF("FORMAT="), "print", STRLENOF("print")))
mode |= PRINT;
else if (strncmp((char *)dbuf.mv_data+STRLENOF("FORMAT="), "bytevalue", STRLENOF("bytevalue"))) {
- fprintf(stderr, "%s: line %" Z "d: unsupported FORMAT %s\n",
+ fprintf(stderr, "%s: line %" Y "u: unsupported FORMAT %s\n",
prog, lineno, (char *)dbuf.mv_data+STRLENOF("FORMAT="));
exit(EXIT_FAILURE);
}
subname = strdup((char *)dbuf.mv_data+STRLENOF("database="));
} else if (!strncmp(dbuf.mv_data, "type=", STRLENOF("type="))) {
if (strncmp((char *)dbuf.mv_data+STRLENOF("type="), "btree", STRLENOF("btree"))) {
- fprintf(stderr, "%s: line %" Z "d: unsupported type %s\n",
+ fprintf(stderr, "%s: line %" Y "u: unsupported type %s\n",
prog, lineno, (char *)dbuf.mv_data+STRLENOF("type="));
exit(EXIT_FAILURE);
}
if (ptr) *ptr = '\0';
i = sscanf((char *)dbuf.mv_data+STRLENOF("mapaddr="), "%p", &info.me_mapaddr);
if (i != 1) {
- fprintf(stderr, "%s: line %" Z "d: invalid mapaddr %s\n",
+ fprintf(stderr, "%s: line %" Y "u: invalid mapaddr %s\n",
prog, lineno, (char *)dbuf.mv_data+STRLENOF("mapaddr="));
exit(EXIT_FAILURE);
}
if (ptr) *ptr = '\0';
i = sscanf((char *)dbuf.mv_data+STRLENOF("mapsize="), "%" Y "u", &info.me_mapsize);
if (i != 1) {
- fprintf(stderr, "%s: line %" Z "d: invalid mapsize %s\n",
+ fprintf(stderr, "%s: line %" Y "u: invalid mapsize %s\n",
prog, lineno, (char *)dbuf.mv_data+STRLENOF("mapsize="));
exit(EXIT_FAILURE);
}
if (ptr) *ptr = '\0';
i = sscanf((char *)dbuf.mv_data+STRLENOF("maxreaders="), "%u", &info.me_maxreaders);
if (i != 1) {
- fprintf(stderr, "%s: line %" Z "d: invalid maxreaders %s\n",
+ fprintf(stderr, "%s: line %" Y "u: invalid maxreaders %s\n",
prog, lineno, (char *)dbuf.mv_data+STRLENOF("maxreaders="));
exit(EXIT_FAILURE);
}
if (!dbflags[i].bit) {
ptr = memchr(dbuf.mv_data, '=', dbuf.mv_size);
if (!ptr) {
- fprintf(stderr, "%s: line %" Z "d: unexpected format\n",
+ fprintf(stderr, "%s: line %" Y "u: unexpected format\n",
prog, lineno);
exit(EXIT_FAILURE);
} else {
*ptr = '\0';
- fprintf(stderr, "%s: line %" Z "d: unrecognized keyword ignored: %s\n",
+ fprintf(stderr, "%s: line %" Y "u: unrecognized keyword ignored: %s\n",
prog, lineno, (char *)dbuf.mv_data);
}
}
static void badend(void)
{
- fprintf(stderr, "%s: line %" Z "d: unexpected end of input\n",
+ fprintf(stderr, "%s: line %" Y "u: unexpected end of input\n",
prog, lineno);
}
buf->mv_data = realloc(buf->mv_data, buf->mv_size*2);
if (!buf->mv_data) {
Eof = 1;
- fprintf(stderr, "%s: line %" Z "d: out of memory, line too long\n",
+ fprintf(stderr, "%s: line %" Y "u: out of memory, line too long\n",
prog, lineno);
return EOF;
}
rc = readline(&data, &dbuf);
if (rc) {
- fprintf(stderr, "%s: line %" Z "d: failed to read key value\n", prog, lineno);
+ fprintf(stderr, "%s: line %" Y "u: failed to read key value\n", prog, lineno);
goto txn_abort;
}
if (batch == 100) {
rc = mdb_txn_commit(txn);
if (rc) {
- fprintf(stderr, "%s: line %" Z "d: txn_commit: %s\n",
+ fprintf(stderr, "%s: line %" Y "u: txn_commit: %s\n",
prog, lineno, mdb_strerror(rc));
goto env_close;
}
rc = mdb_txn_commit(txn);
txn = NULL;
if (rc) {
- fprintf(stderr, "%s: line %" Z "d: txn_commit: %s\n",
+ fprintf(stderr, "%s: line %" Y "u: txn_commit: %s\n",
prog, lineno, mdb_strerror(rc));
goto env_close;
}