void (*cb)(const char *buf, void *private_data),
void *private_data);
+/**
+ * Write dump of binary data to a FILE
+ */
+void dump_data_file(const uint8_t *buf, int len, bool omit_zero_bytes,
+ FILE *f);
+
/**
* Write dump of binary data to the log file.
*
dump_data_cb(buf, len, true, debugadd_cb, &level);
}
+static void fprintf_cb(const char *buf, void *private_data)
+{
+ FILE *f = (FILE *)private_data;
+ fprintf(f, "%s", buf);
+}
+
+void dump_data_file(const uint8_t *buf, int len, bool omit_zero_bytes,
+ FILE *f)
+{
+ dump_data_cb(buf, len, omit_zero_bytes, fprintf_cb, f);
+}
/**
malloc that aborts with smb_panic on fail or zero size.
return p;
}
-static void printf_cb(const char *buf, void *private_data)
-{
- printf("%s", buf);
-}
-
static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
{
- dump_data_cb(d, l, !force, printf_cb, NULL);
+ dump_data_file(d, l, !force, stdout);
}
static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
return 0;
}
-static void printf_cb(const char *buf, void *private_data)
-{
- printf("%s", buf);
-}
-
/****************************************************************************
Get the EA list of a file
****************************************************************************/
for (i=0; i<num_eas; i++) {
d_printf("%s (%d) =\n", eas[i].name, (int)eas[i].flags);
- dump_data_cb(eas[i].value.data, eas[i].value.length, false,
- printf_cb, NULL);
+ dump_data_file(eas[i].value.data, eas[i].value.length, false,
+ stdout);
d_printf("\n");
}