#include <fcntl.h>
#include <signal.h>
#include <h/mime.h>
+#include <h/utils.h>
static struct swit whatnowswitches[] = {
#define DFOLDSW 0
while (argp[i])
i++;
}
- if ((args = (char **) malloc((i + 2) * sizeof(char *))) == NULL)
- adios (NULL, "unable to malloc memory");
+ args = (char **) mh_xmalloc((i + 2) * sizeof(char *));
/*
* For backward compatibility, we need to add -build
{ "user", SASLminc(-4) },
#define SNDATTACHSW 39
{ "attach file", 6 },
+#define SNDATTACHFORMAT 40
+ { "attachformat", 7 },
{ NULL, 0 }
};
char **arguments, *vec[MAXARGS];
struct stat st;
char *attach = (char *)0; /* attachment header field name */
+ int attachformat = 0; /* mhbuild format specifier for
+ attachments */
#ifndef lint
int distsw = 0;
return;
}
continue;
+
+ case SNDATTACHFORMAT:
+ if (! *argp || **argp == '-')
+ adios (NULL, "missing argument to %s", argp[-1]);
+ else {
+ attachformat = atoi (*argp);
+ if (attachformat < 0 ||
+ attachformat > ATTACHFORMATS - 1) {
+ advise (NULL, "unsupported attachformat %d",
+ attachformat);
+ continue;
+ }
+ }
+ ++argp;
+ continue;
}
}
advise (NULL, "usage: %s [switches]", sp);
vec[0] = r1bindex (postproc, '/');
closefds (3);
- if (sendsbr (vec, vecp, file, &st, 1, attach) == OK)
+ if (sendsbr (vec, vecp, file, &st, 1, attach, attachformat) == OK)
done (0);
}