9 date 95.12.06.23.44.31; author jromine; state Exp;
14 date 92.12.15.00.20.22; author jromine; state Exp;
19 date 92.11.04.00.44.21; author jromine; state Exp;
24 date 92.01.31.22.12.18; author jromine; state Exp;
29 date 92.01.31.22.11.55; author jromine; state Exp;
43 @/* mark.c - mark messages */
45 static char ident[] = "@@(#)$Id: mark.c,v 1.4 1992/12/15 00:20:22 jromine Exp jromine $";
56 static struct swit switches[] = {
116 setlocale(LC_ALL, "");
118 invo_name = r1bindex (argv[0], '/');
119 if ((cp = m_find (invo_name)) != NULL) {
120 ap = brkstring (cp = getcpy (cp), " ", "\n");
121 ap = copyip (ap, arguments);
125 (void) copyip (argv + 1, ap);
130 while (cp = *argp++) {
132 switch (smatch (++cp, switches)) {
134 ambigsw (cp, switches);
137 adios (NULLCP, "-%s unknown\n", cp);
139 (void) sprintf (buf, "%s [+folder] [msgs] [switches]",
141 help (buf, switches);
146 deletesw = listsw = 0;
154 addsw = deletesw = 0;
158 if (!(cp = *argp++) || *cp == '-')
159 adios (NULLCP, "missing argument to %s", argp[-2]);
163 adios (NULLCP, "only %d sequences allowed!", NATTRS);
184 if (*cp == '+' || *cp == '@@') {
186 adios (NULLCP, "only one folder at a time!");
188 folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
196 if (!addsw && !deletesw && !listsw)
202 if (!m_find ("path"))
203 free (path ("./", TFOLDER));
205 msgs[msgp++] = listsw ? "all" :"cur";
207 folder = m_getfolder ();
208 maildir = m_maildir (folder);
210 if (chdir (maildir) == NOTOK)
211 adios (maildir, "unable to change directory to");
212 if (!(mp = m_gmsg (folder)))
213 adios (NULLCP, "unable to read folder %s", folder);
214 if (mp -> hghmsg == 0)
215 adios (NULLCP, "no messages in %s", folder);
217 for (msgnum = 0; msgnum < msgp; msgnum++)
218 if (!m_convert (mp, msgs[msgnum]))
222 publicsw = mp -> msgflags & READONLY ? 0 : 1;
223 if (publicsw && (mp -> msgflags & READONLY))
224 adios (NULLCP, "folder %s is read-only, so -public not allowed",
230 printf ("invo_name=%s mypath=%s defpath=%s\n",
231 invo_name, mypath, defpath);
232 printf ("ctxpath=%s context flags=%s\n",
233 ctxpath, sprintb (buf, (unsigned) ctxflags, DBITS));
234 printf ("foldpath=%s flags=%s\n",
236 sprintb (buf, (unsigned) mp -> msgflags, FBITS));
237 printf ("lowmsg=%d hghmsg=%d nummsg=%d curmsg=%d\n",
238 mp -> lowmsg, mp -> hghmsg, mp -> nummsg, mp -> curmsg);
239 printf ("lowsel=%d hghsel=%d numsel=%d\n",
240 mp -> lowsel, mp -> hghsel, mp -> numsel);
242 printf ("lowoff=%d hghoff=%d\n",
243 mp -> lowoff, mp -> hghoff);
245 printf ("lowoff=%d hghoff=%d msgbase=0x%x msgstats=0x%x\n",
246 mp -> lowoff, mp -> hghoff, mp -> msgbase, mp -> msgstats);
250 if (seqp == 0 && (addsw || deletesw))
251 adios (NULLCP, "-%s requires at least one -sequence argument",
252 addsw ? "add" : "delete");
256 for (seqp = 0; seqs[seqp]; seqp++) {
257 if (zerosw && !m_seqnew (mp, seqs[seqp], publicsw))
259 for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
260 if (mp -> msgstats[msgnum] & SELECTED)
261 if (!m_seqadd (mp, seqs[seqp], msgnum, publicsw))
266 for (seqp = 0; seqs[seqp]; seqp++) {
268 for (msgnum = mp -> lowmsg; msgnum <= mp -> hghmsg; msgnum++)
269 if (mp -> msgstats[msgnum] & EXISTS)
270 if (!m_seqadd (mp, seqs[seqp], msgnum, publicsw))
272 for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
273 if (mp -> msgstats[msgnum] & SELECTED)
274 if (!m_seqdel (mp, seqs[seqp], msgnum))
279 int bits = FFATTRSLOT;
281 #define empty(s) ((s) ? (s) : "")
283 for (i = 0; mp -> msgattrs[i]; i++)
284 printf ("%s%s: %s\n", mp -> msgattrs[i],
285 mp -> attrstats & (1 << (bits + i))
287 empty(m_seq (mp, mp -> msgattrs[i])));
289 for (seqp = 0; seqs[seqp]; seqp++)
290 printf ("%s: %s\n", seqs[seqp], empty(m_seq (mp, seqs[seqp])));
294 for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
295 if (mp -> msgstats[msgnum] & SELECTED)
296 printf ("%*d: %s\n", DMAXFOLDER, msgnum,
297 sprintb (buf, (unsigned) mp -> msgstats[msgnum],
301 m_replace (pfolder, folder);
317 static char ident[] = "@@(#)$Id: mark.c,v 1.3 1992/11/04 00:44:21 jromine Exp jromine $";
321 m_seq (mp, mp -> msgattrs[i]));
324 printf ("%s: %s\n", seqs[seqp], m_seq (mp, seqs[seqp]));
335 static char ident[] = "@@(#)$Id: mark.c,v 1.2 1992/01/31 22:12:18 jromine Exp jromine $";
353 static char ident[] = "@@(#)$Id: scan.c,v 1.9 1992/01/23 23:06:45 jromine Exp $";