All diagnostics should go to stderr

incre
Howard Chu 11 years ago
parent ee599c5250
commit c5be1292ac
  1. 8
      libraries/liblmdb/mdb_dump.c
  2. 12
      libraries/liblmdb/mdb_load.c
  3. 16
      libraries/liblmdb/mdb_stat.c

@ -226,19 +226,19 @@ int main(int argc, char *argv[])
rc = mdb_env_open(env, envname, envflags | MDB_RDONLY, 0664); rc = mdb_env_open(env, envname, envflags | MDB_RDONLY, 0664);
if (rc) { if (rc) {
printf("mdb_env_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_env_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto env_close; goto env_close;
} }
rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn); rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
if (rc) { if (rc) {
printf("mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc));
goto env_close; goto env_close;
} }
rc = mdb_open(txn, subname, 0, &dbi); rc = mdb_open(txn, subname, 0, &dbi);
if (rc) { if (rc) {
printf("mdb_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
@ -249,7 +249,7 @@ int main(int argc, char *argv[])
rc = mdb_cursor_open(txn, dbi, &cursor); rc = mdb_cursor_open(txn, dbi, &cursor);
if (rc) { if (rc) {
printf("mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
while ((rc = mdb_cursor_get(cursor, &key, NULL, MDB_NEXT_NODUP)) == 0) { while ((rc = mdb_cursor_get(cursor, &key, NULL, MDB_NEXT_NODUP)) == 0) {

@ -305,7 +305,7 @@ int main(int argc, char *argv[])
rc = mdb_env_open(env, envname, envflags, 0664); rc = mdb_env_open(env, envname, envflags, 0664);
if (rc) { if (rc) {
printf("mdb_env_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_env_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto env_close; goto env_close;
} }
@ -324,19 +324,19 @@ int main(int argc, char *argv[])
rc = mdb_txn_begin(env, NULL, 0, &txn); rc = mdb_txn_begin(env, NULL, 0, &txn);
if (rc) { if (rc) {
printf("mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc));
goto env_close; goto env_close;
} }
rc = mdb_open(txn, subname, flags|MDB_CREATE, &dbi); rc = mdb_open(txn, subname, flags|MDB_CREATE, &dbi);
if (rc) { if (rc) {
printf("mdb_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
rc = mdb_cursor_open(txn, dbi, &mc); rc = mdb_cursor_open(txn, dbi, &mc);
if (rc) { if (rc) {
printf("mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
@ -366,12 +366,12 @@ int main(int argc, char *argv[])
} }
rc = mdb_txn_begin(env, NULL, 0, &txn); rc = mdb_txn_begin(env, NULL, 0, &txn);
if (rc) { if (rc) {
printf("mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc));
goto env_close; goto env_close;
} }
rc = mdb_cursor_open(txn, dbi, &mc); rc = mdb_cursor_open(txn, dbi, &mc);
if (rc) { if (rc) {
printf("mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
batch = 0; batch = 0;

@ -112,7 +112,7 @@ int main(int argc, char *argv[])
rc = mdb_env_open(env, envname, envflags | MDB_RDONLY, 0664); rc = mdb_env_open(env, envname, envflags | MDB_RDONLY, 0664);
if (rc) { if (rc) {
printf("mdb_env_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_env_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto env_close; goto env_close;
} }
@ -145,7 +145,7 @@ int main(int argc, char *argv[])
rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn); rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
if (rc) { if (rc) {
printf("mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc));
goto env_close; goto env_close;
} }
@ -158,12 +158,12 @@ int main(int argc, char *argv[])
dbi = 0; dbi = 0;
rc = mdb_cursor_open(txn, dbi, &cursor); rc = mdb_cursor_open(txn, dbi, &cursor);
if (rc) { if (rc) {
printf("mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
rc = mdb_stat(txn, dbi, &mst); rc = mdb_stat(txn, dbi, &mst);
if (rc) { if (rc) {
printf("mdb_stat failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_stat failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
prstat(&mst); prstat(&mst);
@ -201,13 +201,13 @@ int main(int argc, char *argv[])
rc = mdb_open(txn, subname, 0, &dbi); rc = mdb_open(txn, subname, 0, &dbi);
if (rc) { if (rc) {
printf("mdb_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
rc = mdb_stat(txn, dbi, &mst); rc = mdb_stat(txn, dbi, &mst);
if (rc) { if (rc) {
printf("mdb_stat failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_stat failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
printf("Status of %s\n", subname ? subname : "Main DB"); printf("Status of %s\n", subname ? subname : "Main DB");
@ -219,7 +219,7 @@ int main(int argc, char *argv[])
rc = mdb_cursor_open(txn, dbi, &cursor); rc = mdb_cursor_open(txn, dbi, &cursor);
if (rc) { if (rc) {
printf("mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
while ((rc = mdb_cursor_get(cursor, &key, NULL, MDB_NEXT_NODUP)) == 0) { while ((rc = mdb_cursor_get(cursor, &key, NULL, MDB_NEXT_NODUP)) == 0) {
@ -237,7 +237,7 @@ int main(int argc, char *argv[])
if (rc) continue; if (rc) continue;
rc = mdb_stat(txn, db2, &mst); rc = mdb_stat(txn, db2, &mst);
if (rc) { if (rc) {
printf("mdb_stat failed, error %d %s\n", rc, mdb_strerror(rc)); fprintf(stderr, "mdb_stat failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort; goto txn_abort;
} }
prstat(&mst); prstat(&mst);

Loading…
Cancel
Save