--- /dev/null
+#!/bin/sh
+######################################################
+#
+# Test the use of the Attach: header
+#
+######################################################
+
+if test -z "${MH_OBJ_DIR}"; then
+ srcdir=`dirname "$0"`/../..
+ MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
+
+setup_test
+
+draft="$MH_TEST_DIR/$$.draft"
+expected="$MH_TEST_DIR/$$.expected"
+actual="$MH_TEST_DIR/$$.actual"
+
+#
+# Test out a simple draft
+#
+
+cat > "$draft" <<EOF
+To: Mr Test <mrtest@example.com>
+cc:
+Fcc: +outbox
+Attach: ${srcdir}/test/mhbuild/tiny.jpg
+------
+Test
+EOF
+
+mhbuild "$draft"
+
+cat $draft
+
+exit $failed
if (strcasecmp(ATTACH_FIELD, np) == 0) {
struct attach_list *entry;
+ char *s = vp, *e = vp + strlen(vp) - 1;
free(np);
+
+ /*
+ * Make sure we can find the start of this filename.
+ * If it's blank, we skip completely. Otherwise, strip
+ * off any leading spaces and trailing newlines.
+ */
+
+ while (isspace((unsigned char) *s))
+ s++;
+
+ while (e > s && *e == '\n')
+ *e-- = '\0';
+
+ if (*s == '\0') {
+ free(vp);
+ goto finish_field;
+ }
+
entry = mh_xmalloc(sizeof(*entry));
- entry->filename = vp;
- if (! attach_tail) {
+ entry->filename = getcpy(s);
+ free(vp);
+ if (attach_tail) {
attach_tail->next = entry;
attach_tail = entry;
} else {
struct part *part;
CT p;
- if (! access(at_entry->filename, R_OK)) {
+ if (access(at_entry->filename, R_OK) != 0) {
adios("reading", "Unable to open %s for", at_entry->filename);
}
}
ct->c_descr = getcpy(filename);
+ ct->c_cefile.ce_file = getcpy(filename);
/*
* If it's a text/calendar, we need to make sure it's an inline,