9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 92.01.31.21.55.34; author jromine; state Exp;
19 date 91.02.14.14.46.26; author mh; state Exp;
24 date 90.04.05.15.32.00; author sources; state Exp;
29 date 90.04.05.14.49.19; author sources; state Exp;
34 date 90.02.06.13.09.00; author sources; state Exp;
39 date 90.02.06.13.06.00; author sources; state Exp;
53 @/* m_seqnew.c - manage sequences */
55 static char ident[] = "@@(#)$Id: m_seqnew.c,v 1.6 1992/01/31 21:55:34 jromine Exp jromine $";
64 int m_seqnew (mp, cp, public)
65 register struct msgs *mp;
76 if (public == -1) /* XXX */
77 public = mp -> msgflags & READONLY ? 0 : 1;
80 for (i = 0; mp -> msgattrs[i]; i++)
81 if (strcmp (mp -> msgattrs[i], cp) == 0) {
82 for (j = mp -> lowmsg; j <= mp -> hghmsg; j++)
83 mp -> msgstats[j] &= ~(1 << (bits + i));
85 mp -> attrstats &= ~(1 << (bits + i));
87 mp -> attrstats |= 1 << (bits + i);
88 mp -> msgflags |= SEQMOD;
94 advise (NULLCP, "only %d sequences allowed (no room for %s)!",
99 mp -> msgattrs[i] = getcpy (cp);
100 for (j = mp -> lowmsg; j <= mp -> hghmsg; j++)
101 mp -> msgstats[j] &= ~(1 << (bits + i));
103 mp -> attrstats &= ~(1 << (bits + i));
105 mp -> attrstats |= 1 << (bits + i);
106 mp -> msgflags |= SEQMOD;
108 mp -> msgattrs[++i] = NULL;
115 int m_seqadd (mp, cp, j, public)
116 register struct msgs *mp;
128 /* keep mp->curmsg & msgattrs["cur"] in sync - see m_seq() */
129 if (strcmp (current,cp) == 0)
132 if (public == -1) /* XXX */
133 public = mp -> msgflags & READONLY ? 0 : 1;
136 for (i = 0; mp -> msgattrs[i]; i++)
137 if (strcmp (mp -> msgattrs[i], cp) == 0) {
138 mp -> msgstats[j] |= 1 << (bits + i);
140 mp -> attrstats &= ~(1 << (bits + i));
142 mp -> attrstats |= 1 << (bits + i);
143 mp -> msgflags |= SEQMOD;
149 advise (NULLCP, "only %d sequences allowed (no room for %s)!",
154 mp -> msgattrs[i] = getcpy (cp);
155 for (k = mp -> lowmsg; k <= mp -> hghmsg; k++)
156 mp -> msgstats[k] &= ~(1 << (bits + i));
157 mp -> msgstats[j] |= 1 << (bits + i);
159 mp -> attrstats &= ~(1 << (bits + i));
161 mp -> attrstats |= 1 << (bits + i);
162 mp -> msgflags |= SEQMOD;
164 mp -> msgattrs[++i] = NULL;
171 int m_seqdel (mp, cp, j)
172 register struct msgs *mp;
183 for (i = 0; mp -> msgattrs[i]; i++)
184 if (strcmp (mp -> msgattrs[i], cp) == 0) {
185 mp -> msgstats[j] &= ~(1 << (bits + i));
186 mp -> msgflags |= SEQMOD;
191 advise (NULLCP, "no such sequence as %s", cp);
197 static int m_seqok (cp)
202 if (cp == NULL || *cp == 0) {
203 advise (NULLCP, "empty sequence name");
207 if (strcmp (cp, "new") == 0
209 || strcmp (cp, "cur") == 0
211 || strcmp (cp, "all") == 0
212 || strcmp (cp, "first") == 0
213 || strcmp (cp, "last") == 0
214 || strcmp (cp, "prev") == 0
215 || strcmp (cp, "next") == 0) {
216 advise (NULLCP, "illegal sequence name: %s", cp);
220 if (!isalpha (*cp)) {
221 advise (NULLCP, "illegal sequence name: %s", cp);
224 for (pp = cp + 1; *pp; pp++)
225 if (!isalnum (*pp)) {
226 advise (NULLCP, "illegal sequence name: %s", cp);
242 static char ident[] = "@@(#)$Id: m_seqnew.c,v 1.5 1991/02/14 14:46:26 mh Exp jromine $";
252 @fix van jacobson bug.
258 static char ident[] = "@@(#)$Id: m_seqnew.c,v 1.4 90/04/05 15:32:00 sources Exp Locker: mh $";
261 if (cp == NULL || *cp == NULL) {
272 static char ident[] = "@@(#)$Id:$";
284 static char ident[] = "$Id:";