1 /* m_sync.c - synchronize message sequences */
3 static char ident[] = "@(#)$Id: m_sync.c,v 1.8 1992/12/15 00:20:22 jromine Exp $";
10 #define sigmask(s) (1 << ((s) - 1))
11 #endif /* not sigmask */
15 1. public and folder readonly: make it private
16 2a. public: add it to the sequences file
17 2b. private: add it to the profile
22 register struct msgs *mp;
32 TYPESIG (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
37 if (!(mp -> msgflags & SEQMOD))
39 mp -> msgflags &= ~SEQMOD;
42 (void) sprintf (seq, "%s/%s", mp -> foldpath, mh_seq);
46 flags = mp -> msgflags;
47 if (mh_seq == NULL || *mh_seq == 0)
48 mp -> msgflags |= READONLY;
50 for (i = 0; mp -> msgattrs[i]; i++) {
51 (void) sprintf (attr, "atr-%s-%s", mp -> msgattrs[i], mp -> foldpath);
52 if (mp -> msgflags & READONLY
53 || mp -> attrstats & (1 << (bits + i))) {
55 if (cp = m_seq (mp, mp -> msgattrs[i]))
58 (void) m_delete (attr);
61 (void) m_delete (attr);
62 if ((cp = m_seq (mp, mp -> msgattrs[i])) == NULL)
65 if ((fp = fopen (seq, "w")) == NULL
66 && (unlink (seq) == NOTOK ||
67 (fp = fopen (seq, "w")) == NULL)) {
68 admonish (attr, "unable to write");
72 hstat = signal (SIGHUP, SIG_IGN);
73 istat = signal (SIGINT, SIG_IGN);
74 qstat = signal (SIGQUIT, SIG_IGN);
75 tstat = signal (SIGTERM, SIG_IGN);
77 smask = sigblock (sigmask (SIGHUP) | sigmask (SIGINT)
78 | sigmask (SIGQUIT) | sigmask (SIGTERM));
81 fprintf (fp, "%s: %s\n", mp -> msgattrs[i], cp);
88 (void) signal (SIGHUP, hstat);
89 (void) signal (SIGINT, istat);
90 (void) signal (SIGQUIT, qstat);
91 (void) signal (SIGTERM, tstat);
93 (void) sigsetmask (smask);
97 if (!(mp -> msgflags & READONLY))
100 mp -> msgflags = flags;