+static char *tf_buf = NULL;
+static int max_tf_len = 0;
+
+void
+alloc_tf_buf(void)
+{
+ char dummy = '\0';
+ int highest = num_test_files - 1;
+ int len;
+
+ len = snprintf(&dummy, 0, "%u ", highest);
+ if (len < 1) {
+ prterr("finding max tf_buf");
+ exit(1);
+ }
+ len++;
+ tf_buf = malloc(len);
+ if (tf_buf == NULL) {
+ prterr("allocating tf_buf");
+ exit(1);
+ }
+ max_tf_len = snprintf(tf_buf, len, "%u ", highest);
+ if (max_tf_len < 1) {
+ prterr("fiding max_tv_len\n");
+ exit(1);
+ }
+ if (max_tf_len != len - 1) {
+ warn("snprintf() gave %d instead of %d?\n",
+ max_tf_len, len - 1);
+ exit(1);
+ }
+}
+
+char *
+fill_tf_buf(struct test_file *tf)
+{
+ if (tf_buf == NULL)
+ alloc_tf_buf();
+
+ sprintf(tf_buf,"%lu ", (unsigned long)(tf - test_files));
+ return tf_buf;
+}
+
+void
+output_line(struct test_file *tf, int op, unsigned offset,
+ unsigned size, struct timeval *tv)
+{
+ char *tf_num = "";
+
+ char *ops[] = {
+ [OP_READ] = "read",
+ [OP_WRITE] = "write",
+ [OP_TRUNCATE] = "trunc from",
+ [OP_MAPREAD] = "mapread",
+ [OP_MAPWRITE] = "mapwrite",
+ };
+
+ if (fd_policy != FD_SINGLE)
+ tf_num = fill_tf_buf(tf);
+
+ /* W. */
+ if (!(!quiet && ((progressinterval &&
+ testcalls % progressinterval == 0) ||
+ (debug &&
+ (monitorstart == -1 ||
+ (offset + size > monitorstart &&
+ (monitorend == -1 || offset <= monitorend)))))))
+ return;
+
+ prt("%06lu %lu.%06lu %.*s%-10s %#08x %s %#08x\t(0x%x bytes)\n",
+ testcalls, tv->tv_sec, tv->tv_usec, max_tf_len,
+ tf_num, ops[op],
+ offset, op == OP_TRUNCATE ? " to " : "thru",
+ offset + size - 1, size);
+}