13503Seric # include	"../hdr/defines.h"
23503Seric 
3*36473Ssam static char Sccsid[] = "@(#)pf_ab.c	1.5	12/22/88";
43503Seric 
pf_ab(s,pp,all)53503Seric pf_ab(s,pp,all)
63503Seric char *s;
73503Seric register struct pfile *pp;
83503Seric int all;
93503Seric {
103503Seric 	register char *p;
113503Seric 	register int i;
123503Seric 	extern char *Datep;
13*36473Ssam 	char *xp, *buf;
143503Seric 
15*36473Ssam 	xp = p = buf = alloc(size(s));
163503Seric 	copy(s,p);
173503Seric 	for (; *p; p++)
183503Seric 		if (*p == '\n') {
193503Seric 			*p = 0;
203503Seric 			break;
213503Seric 		}
223503Seric 	p = xp;
233503Seric 	p = sid_ab(p,&pp->pf_gsid);
243503Seric 	++p;
253503Seric 	p = sid_ab(p,&pp->pf_nsid);
263503Seric 	++p;
2719940Ssam 	xp = index(p,' ');
283503Seric 	pp->pf_user[0] = 0;
2919940Ssam 	if ((unsigned)(i = xp-p) < SZLNAM) {
3019940Ssam 		bcopy(p,pp->pf_user,i);
313503Seric 		pp->pf_user[i] = 0;
323503Seric 	}
333503Seric 	else
343503Seric 		fatal("bad p-file format (co17)");
3519940Ssam 	p = xp + 1;
363503Seric 	date_ab(p,&pp->pf_date);
373503Seric 	p = Datep;
383503Seric 	pp->pf_ilist = 0;
393503Seric 	pp->pf_elist = 0;
40*36473Ssam 	if (!all || !*p) {
41*36473Ssam 		free(buf);
423503Seric 		return;
43*36473Ssam 	}
4430497Slepreau 	p += 2;
453503Seric 	xp = alloc(size(p));
463503Seric 	copy(p,xp);
473503Seric 	p = xp;
483503Seric 	if (*p == 'i') {
493503Seric 		pp->pf_ilist = ++p;
503503Seric 		for (; *p; p++)
513503Seric 			if (*p == ' ') {
523503Seric 				*p++ = 0;
533503Seric 				p++;
543503Seric 				break;
553503Seric 			}
563503Seric 	}
573503Seric 	if (*p == 'x')
583503Seric 		pp->pf_elist = ++p;
59*36473Ssam 	free(buf);
603503Seric }
61