static filetype_t str2filetype(const char *);
static void strange_header(dumpfile_t *, const char *,
size_t, const char *, const char *);
-static ssize_t hexdump(const char *buffer, size_t len);
static char *quote_heredoc(char *text, char *delimiter_prefix);
static char *parse_heredoc(char *line, char **saveptr);
if (expected == NULL)
expected = "<null>";
- g_fprintf(stderr, _("%s: strange amanda header: \"%.*s\"\n"), get_pname(),
- (int)buflen, buffer);
-
- g_fprintf(stderr, _("%s: Expected: \"%s\" Actual: \"%s\"\n"), get_pname(),
- expected, actual);
+ g_debug("strange amanda header: \"%.*s\"", (int)buflen, buffer);
+ g_debug("Expected: \"%s\" Actual: \"%s\"", expected, actual);
file->type = F_WEIRD;
}
tok = strtok_r(line1, " ", &saveptr);
if (tok == NULL) {
- g_fprintf(stderr, _("%s: Empty amanda header: buflen=%zu lsize=%zu\n"), get_pname(),
- buflen,
- lsize);
- hexdump(buffer, lsize);
+ g_debug("Empty amanda header: buflen=%zu lsize=%zu", buflen, lsize);
strange_header(file, buffer, buflen, _("<Non-empty line>"), tok);
goto out;
}
strange_header(file, buffer, buflen, _("<total parts param>"), tok);
goto out;
}
+ } else if (file->type == F_DUMPFILE) {
+ /* only one part in this dump, so call it partnum 1 */
+ file->partnum = 1;
+ file->totalparts = 1;
+ } else {
+ file->partnum = 0;
+ file->totalparts = 0;
}
tok = strtok_r(NULL, " ", &saveptr);
g_string_append_printf(rval, "\n");
if (file->cont_filename[0] != '\0') {
- validate_no_space(file->cont_filename, "cont_filename");
g_string_append_printf(rval, "CONT_FILENAME=%s\n",
file->cont_filename);
}
if (file->application[0] != '\0') {
- validate_no_space(file->application, "application");
g_string_append_printf(rval, "APPLICATION=%s\n", file->application);
}
if (file->is_partial != 0) {
amfree(info);
}
-static ssize_t
-hexdump(
- const char *buffer,
- size_t len)
-{
- ssize_t rc = -1;
-
- FILE *stream = popen("od -c -x -", "w");
-
- if (stream != NULL) {
- fflush(stdout);
- rc = (ssize_t)fwrite(buffer, len, 1, stream);
- if (ferror(stream))
- rc = -1;
- pclose(stream);
- }
- return rc;
-}
-
static char *quote_heredoc(
char *text,
char *delimiter_prefix)