| 13 | #define FMTSZ 512 |
| 14 | |
| 15 | void tdprintf(FILE *f, cdb2_hndl_tp *db, const char *func, int line, |
| 16 | const char *format, ...) |
| 17 | { |
| 18 | va_list ap; |
| 19 | char fmt[FMTSZ]; |
| 20 | char buf[128]; |
| 21 | |
| 22 | fmt[0] = '\0'; |
| 23 | |
| 24 | if (strncasecmp(format, "XXX ", 3) == 0) { |
| 25 | strcat(fmt, "XXX "); |
| 26 | } |
| 27 | |
| 28 | snprintf(buf, sizeof(buf), "td %"PRIdPTR" ", (intptr_t)pthread_self()); |
| 29 | strcat(fmt, buf); |
| 30 | |
| 31 | snprintf(buf, sizeof(buf), "handle %p ", db); |
| 32 | strcat(fmt, buf); |
| 33 | |
| 34 | snprintf(buf, sizeof(buf), "%s:%d ", func, line); |
| 35 | strcat(fmt, buf); |
| 36 | |
| 37 | snprintf(buf, sizeof(buf), "cnonce '%s' ", db ? cdb2_cnonce(db) : "(null)"); |
| 38 | strcat(fmt, buf); |
| 39 | |
| 40 | int file = -1, offset = -1; |
| 41 | if (db) cdb2_snapshot_file(db, &file, &offset); |
| 42 | snprintf(buf, sizeof(buf), "snapshot_lsn [%d][%d] ", file, offset); |
| 43 | strcat(fmt, buf); |
| 44 | |
| 45 | strcat(fmt, format); |
| 46 | va_start(ap, format); |
| 47 | vfprintf(f, fmt, ap); |
| 48 | va_end(ap); |
| 49 | } |
| 50 | |
| 51 | char *master(const char *dbname, const char *cltype) |
| 52 | { |
no test coverage detected