# check -nocheck, the default
run_test 'mhstore last -part 2 -check -nocheck' \
'storing message 11 part 2 as file 11.2.txt'
-check "$expected" 11.2.txt
+check "$expected" 11.2.txt 'keep first'
+
+# check -outfile - with -file
+run_prog mhstore -noverbose -file `mhpath 11` -part 2 -outfile - >"$actual" 2>&1
+check "$expected" "$actual"
# check reassembly of message/partial messages (RFC 1521, 7.3.2)
msgfile=`mhpath new`
void
mhstoreinfo_free (mhstoreinfo_t info) {
free (info->cwd);
+ free (info->dir);
free (info);
}
/* Support mhstore -outfile. The MIME parser doesn't
load c_storage, so we know that p->c_storage is
NULL here. */
- p->c_storage = ct->c_storage;
+ p->c_storage = add (ct->c_storage, NULL);
}
result = store_switch (p, info);
- p->c_storage = NULL;
if (result == OK && ct->c_subtype == MULTI_ALTERNATE)
break;
if (ct->c_storage) {
/* Support mhstore -outfile. The MIME parser doesn't load
c_storage, so we know that p->c_storage is NULL here. */
- p->c_storage = ct->c_storage;
+ p->c_storage = add (ct->c_storage, NULL);
}
result = store_switch (p, info);
- p->c_storage = NULL;
p->c_partno = NULL;
return result;
}
} else {
/* The output filename was explicitly specified, so use it. */
- if ((ct->c_storage = clobber_check (add (ct->c_storage, NULL), info)) ==
+ if ((ct->c_storage = clobber_check (ct->c_storage, info)) ==
NULL) {
return NOTOK;
}
char *cwd = NULL;
int check_again;
+ if (! strcmp (original_file, "-")) {
+ return original_file;
+ }
+
if (info->clobber_policy == NMH_CLOBBER_ASK) {
/* Save cwd for possible use in loop below. */
char *slash;
if (slash) {
*slash = '\0';
} else {
- /* original_file wasn't a full path, which shouldn't happen. */
+ /* original_file isn't a full path, which should only happen if
+ it is -. */
+ free (cwd);
cwd = NULL;
}
}
original_file = file;
} while (check_again);
- if (cwd) {
- free (cwd);
- }
+ free (cwd);
return file;
}