view sbr/m_setvis.c @ 17:76d91e545ea8 default tip

addrsbr and dtimep fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 24 Nov 2014 14:49:25 +0900
parents bce86c4163a3
children
line wrap: on
line source

/* m_setvis.c - set the unseen-sequence */

#include "../h/mh.h"
#include <stdio.h>


void m_setvis (mp, seen)
register struct msgs *mp;
int	seen;
{
    register int    msgnum;
    register char  *cp,
                   *dp,
                  **ap;

    dp = NULL;
    if ((cp = m_find (usequence)) == NULL
	    || (ap = brkstring (dp = getcpy (cp), " ", "\n")) == NULL
	    || *ap == NULL) {
	if (dp)
	    free (dp);
	return;
    }

    for (; *ap; ap++)
	if (seen) {
	    if (m_seqflag (mp, *ap))
		for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
		    if (mp -> msgstats[msgnum] & UNSEEN)
			(void) m_seqdel (mp, *ap, msgnum);
	}
	else
	    for (msgnum = mp -> lowmsg; msgnum <= mp -> hghmsg; msgnum++)
		if (mp -> msgstats[msgnum] & UNSEEN)
		    (void) m_seqadd (mp, *ap, msgnum, -1);

    if (dp)
	free (dp);
}