2 Proprietary Rand Corporation
, 1981.
3 Further distribution of
this software
4 subject to the terms of the Rand
11 extern char *malloc();
12 extern char *sprintf();
18 /* Look through a folder.
19 /* Alloc a 'struct msgs' structure and fill it in
20 /* with such things as what the low, high, and current messages are.
21 /* Return a pointer to this structure or a null pointer if trouble.
49 char xmsgs
[MAXFOLDER
+ 1];
52 if((ifp
= fopen(".", "r")) == 0)
54 for(j
= 0; j
<= MAXFOLDER
; j
++)
60 msgbuf
.xlowmsg
= 5000;
62 msgbuf
.xflags
= (access(".",2) == -1)? READONLY
:0; /*RAND sys call*/
67 if(fread(&dir
, sizeof dir
.ent
, 1, ifp
) != 1)
71 if(j
> msgbuf
.xhghmsg
)
74 if(j
< msgbuf
.xlowmsg
)
76 msgbuf
.xmsgs
[j
] = EXISTS
;
77 } else if(*cp
!= ',' && *cp
!= '.')
78 if(strcmp(cp
, current
) == 0)
80 else if(strcmp(cp
, listname
) == 0)
88 if(msgbuf
.xflags
&READONLY
) Block
{
90 VOID
sprintf(buf
, "cur-%s", name
);
91 /*** copy(name, copy("cur-", buf)); ***/
92 if((cp
= m_find(buf
)) != NULL
)
95 } else if(curfil
&& (i
= open(current
, 0)) >= 0) {
96 if((j
= read(i
, dir
.ent
.d_name
, sizeof dir
.ent
.d_name
)) >= 2){
97 dir
.ent
.d_name
[j
-1] = 0; /* Zap <lf> */
98 if(j
= mu_atoi(dir
.ent
.d_name
))
104 register struct msgs
*msgp
;
105 if( (char *) (msgp
= (struct msgs
*)
106 malloc((unsigned) (sizeof *mp
+ msgbuf
.xhghmsg
+ 2)))
109 msgp
->hghmsg
= msgbuf
.xhghmsg
;
110 msgp
->nummsg
= msgbuf
.xnummsg
;
111 msgp
->lowmsg
= msgbuf
.xlowmsg
;
112 msgp
->curmsg
= msgbuf
.xcurmsg
;
113 msgp
->selist
= msgbuf
.xselist
;
114 msgp
->msgflags
= msgbuf
.xflags
;
115 msgp
->others
= msgbuf
.xothers
;
116 msgp
->foldpath
= name
;
120 for(j
= 0; j
<= msgbuf
.xhghmsg
; j
++)
121 msgp
->msgstats
[j
] = msgbuf
.xmsgs
[j
];