9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 92.11.04.01.00.56; author jromine; state Exp;
19 date 92.02.11.21.37.29; author jromine; state Exp;
24 date 92.01.31.22.26.14; author jromine; state Exp;
29 date 92.01.31.22.25.48; author jromine; state Exp;
43 @/* rmm.c - remove a message */
45 static char ident[] = "@@(#)$Id: rmm.c,v 1.4 1992/11/04 01:00:56 jromine Exp jromine $";
56 static struct swit switches[] = {
87 setlocale(LC_ALL, "");
89 invo_name = r1bindex (argv[0], '/');
90 if ((cp = m_find (invo_name)) != NULL) {
91 ap = brkstring (cp = getcpy (cp), " ", "\n");
92 ap = copyip (ap, arguments);
96 (void) copyip (argv + 1, ap);
101 while (cp = *argp++) {
103 switch (smatch (++cp, switches)) {
105 ambigsw (cp, switches);
108 adios (NULLCP, "-%s unknown\n", cp);
110 (void) sprintf (buf, "%s [+folder] [msgs] [switches]",
112 help (buf, switches);
115 if (*cp == '+' || *cp == '@@') {
117 adios (NULLCP, "only one folder at a time!");
119 folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
127 if (!m_find ("path"))
128 free (path ("./", TFOLDER));
130 msgs[msgp++] = "cur";
132 folder = m_getfolder ();
133 maildir = m_maildir (folder);
135 if (chdir (maildir) == NOTOK)
136 adios (maildir, "unable to change directory to");
137 if (!(mp = m_gmsg (folder)))
138 adios (NULLCP, "unable to read folder %s", folder);
139 if (mp -> hghmsg == 0)
140 adios (NULLCP, "no messages in %s", folder);
142 for (msgnum = 0; msgnum < msgp; msgnum++)
143 if (!m_convert (mp, msgs[msgnum]))
147 for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
148 if (mp -> msgstats[msgnum] & SELECTED) {
150 mp -> msgstats[msgnum] |= DELETED;
152 mp -> msgstats[msgnum] &= ~EXISTS;
154 mp -> msgflags |= SEQMOD;
156 m_replace (pfolder, folder);
161 if (mp -> numsel > MAXARGS - 2)
162 adios (NULLCP, "more than %d messages for %s exec", MAXARGS - 2,
164 vec = (char **) calloc ((unsigned) (mp -> numsel + 2), sizeof *vec);
166 adios (NULLCP, "unable to allocate exec vector");
168 for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
169 if (mp -> msgstats[msgnum] & SELECTED)
170 vec[vecp++] = getcpy (m_name (msgnum));
173 (void) fflush (stdout);
174 vec[0] = r1bindex (rmmproc, '/');
175 execvp (rmmproc, vec);
176 adios (rmmproc, "unable to exec");
179 for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
180 if (mp -> msgstats[msgnum] & SELECTED) {
181 (void) strcpy (buf, m_backup (dp = m_name (msgnum)));
182 if (rename (dp, buf) == NOTOK)
183 admonish (buf, "unable to rename %s to", dp);
198 static char ident[] = "@@(#)$Id: rmm.c,v 1.3 1992/02/11 21:37:29 jromine Exp jromine $";
208 @allow relative folders with "@@". I hope there isn't a reason
209 this wasn't already done.
214 static char ident[] = "@@(#)$Id: rmm.c,v 1.2 1992/01/31 22:26:14 jromine Exp jromine $";
227 static char ident[] = "@@(#)$Id: scan.c,v 1.9 1992/01/23 23:06:45 jromine Exp $";
233 folder = path (cp + 1, TFOLDER);