advise(NULL, "usage is alist [-ln].");
else
- annolist(drft, attach_hdr, l, n);
+ snprintf(buf, sizeof buf,
+ "anno -list -comp '%s' "
+ "%s%s '%s'",
+ attach_hdr,
+ n ? "-number all" : "",
+ l ? "-text IGNORE " : "",
+ drft);
+ if (system(buf) != 0) {
+ advise(NULL, "Could not list attachment headers.");
+ }
break;
** Add the attachment annotation to the draft.
*/
if ((f = popen_in_dir(cwd, buf, "r"))) {
+ char buf[BUFSIZ];
+
while (fgets(shell, sizeof(shell), f)) {
*(strchr(shell, '\n')) = '\0';
sprintf(file, "%s/%s", cwd,
shell);
}
- annotate(drft, attach_hdr, file, 0,
- -2, 1, 0);
+ snprintf(buf, sizeof buf,
+ "anno -nodate -append "
+ "-comp '%s' -text '%s'"
+ " '%s'",
+ attach_hdr, file,
+ drft);
+ if (system(buf) != 0) {
+ advise(NULL, "Could not add attachment header.");
+ }
}
pclose(f);
** names and numbers aren't allowed, so this
** catches a -n anywhere in the argument list.
*/
-
for (n = 0, arguments = argp + 1;
*arguments != NULL;
arguments++) {
** just processed after processing each one so
** that the numbering stays correct.
*/
-
if (n == 1) {
- for (arguments = argp + 1;
- *arguments != NULL;
+ for (arguments=argp+1; *arguments;
arguments++) {
if (strcmp(*arguments, "-n") == 0)
continue;
if (**arguments != '\0') {
+ char buf[BUFSIZ];
+
n = atoi(*arguments);
- annotate(drft, attach_hdr,
- NULL, 0,
- n, 1, 0);
+ snprintf(buf, sizeof buf, "anno -delete -comp '%s' -number '%d' '%s'", attach_hdr, n, drft);
+ if (system(buf) != 0) {
+ advise(NULL, "Could not delete attachment header.");
+ }
- for (argp = arguments + 1; *argp; argp++) {
+ for (argp=arguments+1; *argp;
+ argp++) {
if (atoi(*argp) > n) {
if (atoi(*argp) == 1)
*argp = "";
}
}
}
+ break;
}
+ /* else */
/*
** The arguments are interpreted as file names.
if ((f = popen_in_dir(cwd, buf, "r"))) {
while (fgets(shell, sizeof (shell), f)) {
*(strchr(shell, '\n')) = '\0';
- annotate(drft, attach_hdr, shell,
- 0, 0, 1, 0);
+ snprintf(buf, sizeof buf,
+ "anno -delete -comp "
+ "'%s' -text '%s' '%s'",
+ attach_hdr, shell,
+ drft);
+ if (system(buf) != 0) {
+ advise(NULL, "Could not delete attachment header.");
+ }
}
pclose(f);
} else {