- /*
- ** The arguments are interpreted as file names.
- ** Run them through the user's shell for wildcard
- ** expansion and other goodies. Do this from
- ** the current working directory if the argument
- ** is not an absolute path name (does not begin
- ** with a /).
- **
- ** We feed all the file names to the shell at
- ** once, otherwise you can't provide a file name
- ** with a space in it.
- */
- writelscmd(buf, sizeof(buf), argp);
- if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
- while (fgets(shell, sizeof (shell), f)
- != NULL) {
- *(strchr(shell, '\n')) = '\0';
- annotate(drft, attach_hdr, shell,
- 0, 0, 1, 0);
+ n = atoi(*arguments);
+ 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++) {
+ if (atoi(*argp) > n) {
+ if (atoi(*argp) == 1) {
+ *argp = "";
+ } else {
+ sprintf(*argp, "%d", atoi(*argp) - 1);
+ }
+ }