1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /* Copyright (c) 1988 AT&T */
22 /* All Rights Reserved */
23 /*
24  * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
25  * Use is subject to license terms.
26  */
27 /*
28  * Copyright 2011-2020 J. Schilling
29  *
30  * @(#)pf_ab.c	1.6 20/09/06 J. Schilling
31  */
32 #if defined(sun)
33 #pragma ident "@(#)pf_ab.c 1.6 20/09/06 J. Schilling"
34 #endif
35 /*
36  * @(#)pf_ab.c 1.6 06/12/12
37  */
38 
39 #if defined(sun)
40 #pragma ident	"@(#)pf_ab.c"
41 #pragma ident	"@(#)sccs:lib/comobj/pf_ab.c"
42 #endif
43 # include	<defines.h>
44 
45 void
46 pf_ab(s,pp,all)
47 char *s;
48 register struct pfile *pp;
49 int all;
50 {
51 	register char *p;
52 	register int i;
53 	extern char *Datep;
54 	char *xp;
55 	char stmp[MAXLINE];
56 
57 	if (size(s) > MAXLINE)
58 		fatal(gettext("line too long (co31)"));
59 	xp = p = stmp;
60 	copy(s,p);
61 	for (; *p; p++)
62 		if (*p == '\n') {
63 			*p = 0;
64 			break;
65 		}
66 	p = xp;
67 	p = sid_ab(p,&pp->pf_gsid);
68 	++p;
69 	p = sid_ab(p,&pp->pf_nsid);
70 	++p;
71 	i = sccs_index(p," ");
72 	pp->pf_user[0] = 0;
73 	if (((unsigned)i) < LOGSIZE) {
74 		strncpy(pp->pf_user,p,(unsigned) i);
75 		pp->pf_user[i] = 0;
76 	}
77 	else
78 		fatal(gettext("bad p-file format (co17)"));
79 	p = p + i + 1;
80 	date_ab(p,&pp->pf_date, 0);
81 	p = Datep;
82 	pp->pf_ilist = 0;
83 	pp->pf_elist = 0;
84 	pp->pf_cmrlist = 0;
85 	if (!all || !*p)
86 		return;
87 	p += 2;
88 	xp = fmalloc(size(p));
89 	copy(p,xp);
90 	p = xp;
91 	if (*p == 'i') {
92 		pp->pf_ilist = ++p;
93 		for (; *p; p++)
94 			if (*p == ' ') {
95 				*p++ = 0;
96 				p++;
97 				break;
98 			}
99 	}
100 	if (*p == 'x')
101 		{
102 		pp->pf_elist = ++p;
103 		for(;*p;p++)
104 			if(*p == ' ')
105 			{
106 				*p++ = 0;
107 				p++;
108 				break;
109 			}
110 	}
111 	if(*p == 'z')
112 		{
113 		pp->pf_cmrlist = ++p;
114 		}
115 }
116