/* dump out all information */ retvalue files_printmd5sums(void) { retvalue result, r; struct cursor *cursor; const char *filekey, *checksum; r = table_newglobalcursor(rdb_checksums, &cursor); if (!RET_IS_OK(r)) return r; result = RET_NOTHING; while (cursor_nexttemp(rdb_checksums, cursor, &filekey, &checksum)) { result = RET_OK; (void)fputs(filekey, stdout); (void)putchar(' '); while (*checksum == ':') { while (*checksum != ' ' && *checksum != '\0') checksum++; if (*checksum == ' ') checksum++; } (void)fputs(checksum, stdout); (void)putchar('\n'); } r = cursor_close(rdb_checksums, cursor); RET_ENDUPDATE(result, r); return result; }
/* dump all references to stdout */ retvalue references_dump(void) { struct cursor *cursor; retvalue result, r; const char *found_to, *found_by; r = table_newglobalcursor(rdb_references, &cursor); if (!RET_IS_OK(r)) return r; result = RET_OK; while (cursor_nexttemp(rdb_references, cursor, &found_to, &found_by)) { if (fputs(found_by, stdout) == EOF || putchar(' ') == EOF || puts(found_to) == EOF) { result = RET_ERROR; break; } result = RET_OK; if (interrupted()) { result = RET_ERROR_INTERRUPTED; break; } } r = cursor_close(rdb_references, cursor); RET_ENDUPDATE(result, r); return result; }
/* callback for each registered file */ retvalue files_foreach(per_file_action action, void *privdata) { retvalue result, r; struct cursor *cursor; const char *filekey, *checksum; r = table_newglobalcursor(rdb_checksums, &cursor); if (!RET_IS_OK(r)) return r; result = RET_NOTHING; while (cursor_nexttemp(rdb_checksums, cursor, &filekey, &checksum)) { if (interrupted()) { RET_UPDATE(result, RET_ERROR_INTERRUPTED); break; } r = action(privdata, filekey); RET_UPDATE(result, r); } r = cursor_close(rdb_checksums, cursor); RET_ENDUPDATE(result, r); return result; }
retvalue files_printchecksums(void) { retvalue result, r; struct cursor *cursor; const char *filekey, *checksum; r = table_newglobalcursor(rdb_checksums, &cursor); if (!RET_IS_OK(r)) return r; result = RET_NOTHING; while (cursor_nexttemp(rdb_checksums, cursor, &filekey, &checksum)) { result = RET_OK; (void)fputs(filekey, stdout); (void)putchar(' '); (void)fputs(checksum, stdout); (void)putchar('\n'); if (interrupted()) { result = RET_ERROR_INTERRUPTED; break; } } r = cursor_close(rdb_checksums, cursor); RET_ENDUPDATE(result, r); return result; }