free when both -file and -outfile switches were used on a MIME
message.
# check -nocheck, the default
run_test 'mhstore last -part 2 -check -nocheck' \
'storing message 11 part 2 as file 11.2.txt'
# 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`
# check reassembly of message/partial messages (RFC 1521, 7.3.2)
msgfile=`mhpath new`
if ((ct = parse_mime (file))) {
*ctp++ = ct;
if (outfile) {
if ((ct = parse_mime (file))) {
*ctp++ = ct;
if (outfile) {
- ct->c_storage = outfile;
+ ct->c_storage = add (outfile, NULL);
void
mhstoreinfo_free (mhstoreinfo_t info) {
free (info->cwd);
void
mhstoreinfo_free (mhstoreinfo_t info) {
free (info->cwd);
/* Support mhstore -outfile. The MIME parser doesn't
load c_storage, so we know that p->c_storage is
NULL here. */
/* 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);
}
result = store_switch (p, info);
if (result == OK && ct->c_subtype == MULTI_ALTERNATE)
break;
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. */
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);
}
result = store_switch (p, info);
p->c_partno = NULL;
return result;
p->c_partno = NULL;
return result;
}
} else {
/* The output filename was explicitly specified, so use it. */
}
} 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)) ==
char *cwd = NULL;
int check_again;
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 (info->clobber_policy == NMH_CLOBBER_ASK) {
/* Save cwd for possible use in loop below. */
char *slash;
if (slash) {
*slash = '\0';
} else {
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);
original_file = file;
} while (check_again);
original_file = file;
} while (check_again);
- if (cwd) {
- free (cwd);
- }