xref: /titanic_51/usr/src/lib/libpkg/common/putcfile.c (revision 5c51f1241dbbdf2656d0e10011981411ed0c9673)
1*5c51f124SMoriah Waterland /*
2*5c51f124SMoriah Waterland  * CDDL HEADER START
3*5c51f124SMoriah Waterland  *
4*5c51f124SMoriah Waterland  * The contents of this file are subject to the terms of the
5*5c51f124SMoriah Waterland  * Common Development and Distribution License (the "License").
6*5c51f124SMoriah Waterland  * You may not use this file except in compliance with the License.
7*5c51f124SMoriah Waterland  *
8*5c51f124SMoriah Waterland  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*5c51f124SMoriah Waterland  * or http://www.opensolaris.org/os/licensing.
10*5c51f124SMoriah Waterland  * See the License for the specific language governing permissions
11*5c51f124SMoriah Waterland  * and limitations under the License.
12*5c51f124SMoriah Waterland  *
13*5c51f124SMoriah Waterland  * When distributing Covered Code, include this CDDL HEADER in each
14*5c51f124SMoriah Waterland  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*5c51f124SMoriah Waterland  * If applicable, add the following below this CDDL HEADER, with the
16*5c51f124SMoriah Waterland  * fields enclosed by brackets "[]" replaced with your own identifying
17*5c51f124SMoriah Waterland  * information: Portions Copyright [yyyy] [name of copyright owner]
18*5c51f124SMoriah Waterland  *
19*5c51f124SMoriah Waterland  * CDDL HEADER END
20*5c51f124SMoriah Waterland  */
21*5c51f124SMoriah Waterland 
22*5c51f124SMoriah Waterland /*
23*5c51f124SMoriah Waterland  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*5c51f124SMoriah Waterland  * Use is subject to license terms.
25*5c51f124SMoriah Waterland  */
26*5c51f124SMoriah Waterland 
27*5c51f124SMoriah Waterland /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28*5c51f124SMoriah Waterland /* All Rights Reserved */
29*5c51f124SMoriah Waterland 
30*5c51f124SMoriah Waterland 
31*5c51f124SMoriah Waterland 
32*5c51f124SMoriah Waterland #include <stdio.h>
33*5c51f124SMoriah Waterland #include <string.h>
34*5c51f124SMoriah Waterland #include <limits.h>
35*5c51f124SMoriah Waterland #include <sys/types.h>
36*5c51f124SMoriah Waterland #include "pkgstrct.h"
37*5c51f124SMoriah Waterland #include "pkglib.h"
38*5c51f124SMoriah Waterland 
39*5c51f124SMoriah Waterland /*
40*5c51f124SMoriah Waterland  * Name:	putcfile
41*5c51f124SMoriah Waterland  * Description:	Write contents file entry to specified FILE
42*5c51f124SMoriah Waterland  * Arguments:	struct cfent a_ept - data for contents file entry
43*5c51f124SMoriah Waterland  *		FILE *a_fp - FP of file to write contents file entry to
44*5c51f124SMoriah Waterland  * Notes:	This is identical to putcvfpfile() but this function takes a
45*5c51f124SMoriah Waterland  *		stdio FILE* file to write to instead of a VFP_T file. It is
46*5c51f124SMoriah Waterland  *		MUCH slower than putcvfpfile().
47*5c51f124SMoriah Waterland  */
48*5c51f124SMoriah Waterland 
49*5c51f124SMoriah Waterland int
50*5c51f124SMoriah Waterland putcfile(struct cfent *a_ept, FILE *a_fp)
51*5c51f124SMoriah Waterland {
52*5c51f124SMoriah Waterland 	struct pinfo *pinfo;
53*5c51f124SMoriah Waterland 
54*5c51f124SMoriah Waterland 	if (a_ept->ftype == 'i') {
55*5c51f124SMoriah Waterland 		return (0); /* no ifiles stored in contents DB */
56*5c51f124SMoriah Waterland 	}
57*5c51f124SMoriah Waterland 
58*5c51f124SMoriah Waterland 	if (a_ept->path == NULL) {
59*5c51f124SMoriah Waterland 		return (-1);	/* no path name - no entry to write */
60*5c51f124SMoriah Waterland 	}
61*5c51f124SMoriah Waterland 
62*5c51f124SMoriah Waterland 	if (fputs(a_ept->path, a_fp) == EOF) {
63*5c51f124SMoriah Waterland 		return (-1);
64*5c51f124SMoriah Waterland 	}
65*5c51f124SMoriah Waterland 
66*5c51f124SMoriah Waterland 	if (a_ept->ainfo.local) {
67*5c51f124SMoriah Waterland 		if (putc('=', a_fp) == EOF) {
68*5c51f124SMoriah Waterland 			return (-1);
69*5c51f124SMoriah Waterland 		}
70*5c51f124SMoriah Waterland 		if (fputs(a_ept->ainfo.local, a_fp) == EOF)
71*5c51f124SMoriah Waterland 			return (-1);
72*5c51f124SMoriah Waterland 	}
73*5c51f124SMoriah Waterland 
74*5c51f124SMoriah Waterland 	if (a_ept->volno) {
75*5c51f124SMoriah Waterland 		if (fprintf(a_fp, " %d", a_ept->volno) < 0) {
76*5c51f124SMoriah Waterland 			return (-1);
77*5c51f124SMoriah Waterland 		}
78*5c51f124SMoriah Waterland 	}
79*5c51f124SMoriah Waterland 
80*5c51f124SMoriah Waterland 	if (putc(' ', a_fp) == EOF) {
81*5c51f124SMoriah Waterland 		return (-1);
82*5c51f124SMoriah Waterland 	}
83*5c51f124SMoriah Waterland 
84*5c51f124SMoriah Waterland 	if (putc(a_ept->ftype, a_fp) == EOF) {
85*5c51f124SMoriah Waterland 		return (-1);
86*5c51f124SMoriah Waterland 	}
87*5c51f124SMoriah Waterland 
88*5c51f124SMoriah Waterland 	if (putc(' ', a_fp) == EOF) {
89*5c51f124SMoriah Waterland 		return (-1);
90*5c51f124SMoriah Waterland 	}
91*5c51f124SMoriah Waterland 
92*5c51f124SMoriah Waterland 	if (fputs(a_ept->pkg_class, a_fp) == EOF) {
93*5c51f124SMoriah Waterland 		return (-1);
94*5c51f124SMoriah Waterland 	}
95*5c51f124SMoriah Waterland 
96*5c51f124SMoriah Waterland 	if ((a_ept->ftype == 'c') || (a_ept->ftype == 'b')) {
97*5c51f124SMoriah Waterland 		if (a_ept->ainfo.major == BADMAJOR) {
98*5c51f124SMoriah Waterland 			if (putc(' ', a_fp) == EOF) {
99*5c51f124SMoriah Waterland 				return (-1);
100*5c51f124SMoriah Waterland 			}
101*5c51f124SMoriah Waterland 
102*5c51f124SMoriah Waterland 			if (putc('?', a_fp) == EOF) {
103*5c51f124SMoriah Waterland 				return (-1);
104*5c51f124SMoriah Waterland 			}
105*5c51f124SMoriah Waterland 		} else {
106*5c51f124SMoriah Waterland 			if (fprintf(a_fp, " %d", a_ept->ainfo.major) < 0)
107*5c51f124SMoriah Waterland 				return (-1);
108*5c51f124SMoriah Waterland 		}
109*5c51f124SMoriah Waterland 
110*5c51f124SMoriah Waterland 		if (a_ept->ainfo.minor == BADMINOR) {
111*5c51f124SMoriah Waterland 			if (putc(' ', a_fp) == EOF) {
112*5c51f124SMoriah Waterland 				return (-1);
113*5c51f124SMoriah Waterland 			}
114*5c51f124SMoriah Waterland 
115*5c51f124SMoriah Waterland 			if (putc('?', a_fp) == EOF) {
116*5c51f124SMoriah Waterland 				return (-1);
117*5c51f124SMoriah Waterland 			}
118*5c51f124SMoriah Waterland 		} else {
119*5c51f124SMoriah Waterland 			if (fprintf(a_fp, " %d", a_ept->ainfo.minor) < 0)
120*5c51f124SMoriah Waterland 				return (-1);
121*5c51f124SMoriah Waterland 		}
122*5c51f124SMoriah Waterland 	}
123*5c51f124SMoriah Waterland 
124*5c51f124SMoriah Waterland 	if ((a_ept->ftype == 'd') || (a_ept->ftype == 'x') ||
125*5c51f124SMoriah Waterland 		(a_ept->ftype == 'c') || (a_ept->ftype == 'b') ||
126*5c51f124SMoriah Waterland 		(a_ept->ftype == 'p') || (a_ept->ftype == 'f') ||
127*5c51f124SMoriah Waterland 		(a_ept->ftype == 'v') || (a_ept->ftype == 'e')) {
128*5c51f124SMoriah Waterland 		if (fprintf(a_fp,
129*5c51f124SMoriah Waterland 			((a_ept->ainfo.mode == BADMODE) ? " ?" : " %04o"),
130*5c51f124SMoriah Waterland 			a_ept->ainfo.mode) < 0)
131*5c51f124SMoriah Waterland 			return (-1);
132*5c51f124SMoriah Waterland 
133*5c51f124SMoriah Waterland 		if (putc(' ', a_fp) == EOF) {
134*5c51f124SMoriah Waterland 			return (-1);
135*5c51f124SMoriah Waterland 		}
136*5c51f124SMoriah Waterland 
137*5c51f124SMoriah Waterland 		if (fputs(a_ept->ainfo.owner, a_fp) == EOF) {
138*5c51f124SMoriah Waterland 			return (-1);
139*5c51f124SMoriah Waterland 		}
140*5c51f124SMoriah Waterland 
141*5c51f124SMoriah Waterland 		if (putc(' ', a_fp) == EOF) {
142*5c51f124SMoriah Waterland 			return (-1);
143*5c51f124SMoriah Waterland 		}
144*5c51f124SMoriah Waterland 
145*5c51f124SMoriah Waterland 		if (fputs(a_ept->ainfo.group, a_fp) == EOF) {
146*5c51f124SMoriah Waterland 			return (-1);
147*5c51f124SMoriah Waterland 		}
148*5c51f124SMoriah Waterland 	}
149*5c51f124SMoriah Waterland 
150*5c51f124SMoriah Waterland 	if ((a_ept->ftype == 'f') || (a_ept->ftype == 'v') ||
151*5c51f124SMoriah Waterland 		(a_ept->ftype == 'e')) {
152*5c51f124SMoriah Waterland 		if (fprintf(a_fp,
153*5c51f124SMoriah Waterland 			((a_ept->cinfo.size == BADCONT) ? " ?" : " %llu"),
154*5c51f124SMoriah Waterland 			a_ept->cinfo.size) < 0)
155*5c51f124SMoriah Waterland 			return (-1);
156*5c51f124SMoriah Waterland 
157*5c51f124SMoriah Waterland 		if (fprintf(a_fp,
158*5c51f124SMoriah Waterland 			((a_ept->cinfo.cksum == BADCONT) ? " ?" : " %ld"),
159*5c51f124SMoriah Waterland 			a_ept->cinfo.cksum) < 0)
160*5c51f124SMoriah Waterland 			return (-1);
161*5c51f124SMoriah Waterland 
162*5c51f124SMoriah Waterland 		if (fprintf(a_fp,
163*5c51f124SMoriah Waterland 		    ((a_ept->cinfo.modtime == BADCONT) ? " ?" : " %ld"),
164*5c51f124SMoriah Waterland 		    a_ept->cinfo.modtime) < 0)
165*5c51f124SMoriah Waterland 			return (-1);
166*5c51f124SMoriah Waterland 	}
167*5c51f124SMoriah Waterland 
168*5c51f124SMoriah Waterland 	pinfo = a_ept->pinfo;
169*5c51f124SMoriah Waterland 	while (pinfo) {
170*5c51f124SMoriah Waterland 		if (putc(' ', a_fp) == EOF) {
171*5c51f124SMoriah Waterland 			return (-1);
172*5c51f124SMoriah Waterland 		}
173*5c51f124SMoriah Waterland 
174*5c51f124SMoriah Waterland 		if (pinfo->status) {
175*5c51f124SMoriah Waterland 			if (fputc(pinfo->status, a_fp) == EOF) {
176*5c51f124SMoriah Waterland 				return (-1);
177*5c51f124SMoriah Waterland 			}
178*5c51f124SMoriah Waterland 		}
179*5c51f124SMoriah Waterland 
180*5c51f124SMoriah Waterland 		if (fputs(pinfo->pkg, a_fp) == EOF) {
181*5c51f124SMoriah Waterland 			return (-1);
182*5c51f124SMoriah Waterland 		}
183*5c51f124SMoriah Waterland 
184*5c51f124SMoriah Waterland 		if (pinfo->editflag) {
185*5c51f124SMoriah Waterland 			if (putc('\\', a_fp) == EOF) {
186*5c51f124SMoriah Waterland 				return (-1);
187*5c51f124SMoriah Waterland 			}
188*5c51f124SMoriah Waterland 		}
189*5c51f124SMoriah Waterland 
190*5c51f124SMoriah Waterland 		if (pinfo->aclass[0]) {
191*5c51f124SMoriah Waterland 			if (putc(':', a_fp) == EOF) {
192*5c51f124SMoriah Waterland 				return (-1);
193*5c51f124SMoriah Waterland 			}
194*5c51f124SMoriah Waterland 			if (fputs(pinfo->aclass, a_fp) == EOF) {
195*5c51f124SMoriah Waterland 				return (-1);
196*5c51f124SMoriah Waterland 			}
197*5c51f124SMoriah Waterland 		}
198*5c51f124SMoriah Waterland 		pinfo = pinfo->next;
199*5c51f124SMoriah Waterland 	}
200*5c51f124SMoriah Waterland 
201*5c51f124SMoriah Waterland 	if (putc('\n', a_fp) == EOF) {
202*5c51f124SMoriah Waterland 		return (-1);
203*5c51f124SMoriah Waterland 	}
204*5c51f124SMoriah Waterland 	return (0);
205*5c51f124SMoriah Waterland }
206*5c51f124SMoriah Waterland 
207*5c51f124SMoriah Waterland /*
208*5c51f124SMoriah Waterland  * Name:	putcvfpfile
209*5c51f124SMoriah Waterland  * Description:	Write contents file entry to specified VFP
210*5c51f124SMoriah Waterland  * Arguments:	struct cfent a_ept - data for contents file entry
211*5c51f124SMoriah Waterland  *		VFP_T *a_vfp - VFP of file to write contents file entry to
212*5c51f124SMoriah Waterland  * Notes:	This is identical to putcfile() but this function takes a
213*5c51f124SMoriah Waterland  *		VFP_T file to write to instead of a stdio FILE file. It is
214*5c51f124SMoriah Waterland  *		MUCH faster tha putcfile().
215*5c51f124SMoriah Waterland  */
216*5c51f124SMoriah Waterland 
217*5c51f124SMoriah Waterland int
218*5c51f124SMoriah Waterland putcvfpfile(struct cfent *a_ept, VFP_T *a_vfp)
219*5c51f124SMoriah Waterland {
220*5c51f124SMoriah Waterland 	struct pinfo *pinfo;
221*5c51f124SMoriah Waterland 
222*5c51f124SMoriah Waterland 	/* contents file does not maintain any 'i' file entries */
223*5c51f124SMoriah Waterland 
224*5c51f124SMoriah Waterland 	if (a_ept->ftype == 'i') {
225*5c51f124SMoriah Waterland 		return (0);
226*5c51f124SMoriah Waterland 	}
227*5c51f124SMoriah Waterland 
228*5c51f124SMoriah Waterland 	/* cannot create an entry if it has no file name */
229*5c51f124SMoriah Waterland 
230*5c51f124SMoriah Waterland 	if (a_ept->path == NULL) {
231*5c51f124SMoriah Waterland 		return (-1);
232*5c51f124SMoriah Waterland 	}
233*5c51f124SMoriah Waterland 
234*5c51f124SMoriah Waterland 	/*
235*5c51f124SMoriah Waterland 	 * Format of contents file line could be one of:
236*5c51f124SMoriah Waterland 	 * /file=./dir/file s class SUNWxxx
237*5c51f124SMoriah Waterland 	 * /file=../dir/file l class SUNWxxx
238*5c51f124SMoriah Waterland 	 * /dir d class mode owner group SUNWxxx SUNWyyy
239*5c51f124SMoriah Waterland 	 * /devices/name c class major minor mode owner group SUNWxxx
240*5c51f124SMoriah Waterland 	 * /file f class mode owner group size cksum modtime SUNWxxx
241*5c51f124SMoriah Waterland 	 * /file x class mode owner group SUNWppro
242*5c51f124SMoriah Waterland 	 * /file v class mode owner group size cksum modtime SUNWxxx
243*5c51f124SMoriah Waterland 	 * /file e class mode owner group size cksum modtime SUNWxxx
244*5c51f124SMoriah Waterland 	 * The package name could be prefixed by one of the following
245*5c51f124SMoriah Waterland 	 * status indicators: +-*!%@#~
246*5c51f124SMoriah Waterland 	 */
247*5c51f124SMoriah Waterland 
248*5c51f124SMoriah Waterland 	/*
249*5c51f124SMoriah Waterland 	 * Adding an entry to the specified VFP.  During normal processing the
250*5c51f124SMoriah Waterland 	 * contents file is copied to a temporary contents file and entries are
251*5c51f124SMoriah Waterland 	 * added as appropriate.  When this processing is completed, a decision
252*5c51f124SMoriah Waterland 	 * is made on whether or not to overwrite the real contents file with
253*5c51f124SMoriah Waterland 	 * the contents of the temporary contents file.  If the temporary
254*5c51f124SMoriah Waterland 	 * contents file is just a copy of the real contents file then there is
255*5c51f124SMoriah Waterland 	 * no need to overwrite the real contents file with the contents of the
256*5c51f124SMoriah Waterland 	 * temporary contents file.  This decision is made in part on whether
257*5c51f124SMoriah Waterland 	 * or not any new or modified entries have been added to the temporary
258*5c51f124SMoriah Waterland 	 * contents file.  Set the "data is modified" indication associated
259*5c51f124SMoriah Waterland 	 * with this VFP so that the real contents file is overwritten when
260*5c51f124SMoriah Waterland 	 * processing is done.
261*5c51f124SMoriah Waterland 	 */
262*5c51f124SMoriah Waterland 
263*5c51f124SMoriah Waterland 	(void) vfpSetModified(a_vfp);
264*5c51f124SMoriah Waterland 
265*5c51f124SMoriah Waterland 	/* write initial path [all entries] */
266*5c51f124SMoriah Waterland 
267*5c51f124SMoriah Waterland 	vfpPuts(a_vfp, a_ept->path);
268*5c51f124SMoriah Waterland 
269*5c51f124SMoriah Waterland 	/* if link, write out '=' portion */
270*5c51f124SMoriah Waterland 
271*5c51f124SMoriah Waterland 	if (a_ept->ainfo.local) {
272*5c51f124SMoriah Waterland 		vfpPutc(a_vfp, '=');
273*5c51f124SMoriah Waterland 		vfpPuts(a_vfp, a_ept->ainfo.local);
274*5c51f124SMoriah Waterland 	}
275*5c51f124SMoriah Waterland 
276*5c51f124SMoriah Waterland 	/* if volume, write it out */
277*5c51f124SMoriah Waterland 
278*5c51f124SMoriah Waterland 	if (a_ept->volno) {
279*5c51f124SMoriah Waterland 		vfpPutc(a_vfp, ' ');
280*5c51f124SMoriah Waterland 		vfpPutInteger(a_vfp, a_ept->volno);
281*5c51f124SMoriah Waterland 	}
282*5c51f124SMoriah Waterland 
283*5c51f124SMoriah Waterland 	/* write out <space><entry type><space>class> */
284*5c51f124SMoriah Waterland 
285*5c51f124SMoriah Waterland 	vfpPutc(a_vfp, ' ');
286*5c51f124SMoriah Waterland 	vfpPutc(a_vfp, a_ept->ftype);
287*5c51f124SMoriah Waterland 	vfpPutc(a_vfp, ' ');
288*5c51f124SMoriah Waterland 	vfpPuts(a_vfp, a_ept->pkg_class);
289*5c51f124SMoriah Waterland 
290*5c51f124SMoriah Waterland 	/* if char/block device, write out major/minor numbers */
291*5c51f124SMoriah Waterland 
292*5c51f124SMoriah Waterland 	if ((a_ept->ftype == 'c') || (a_ept->ftype == 'b')) {
293*5c51f124SMoriah Waterland 		/* major device number */
294*5c51f124SMoriah Waterland 		if (a_ept->ainfo.major == BADMAJOR) {
295*5c51f124SMoriah Waterland 			vfpPutc(a_vfp, ' ');
296*5c51f124SMoriah Waterland 			vfpPutc(a_vfp, '?');
297*5c51f124SMoriah Waterland 		} else {
298*5c51f124SMoriah Waterland 			vfpPutc(a_vfp, ' ');
299*5c51f124SMoriah Waterland 			vfpPutInteger(a_vfp, a_ept->ainfo.major);
300*5c51f124SMoriah Waterland 		}
301*5c51f124SMoriah Waterland 
302*5c51f124SMoriah Waterland 		/* minor device number */
303*5c51f124SMoriah Waterland 		if (a_ept->ainfo.minor == BADMINOR) {
304*5c51f124SMoriah Waterland 			vfpPutc(a_vfp, ' ');
305*5c51f124SMoriah Waterland 			vfpPutc(a_vfp, '?');
306*5c51f124SMoriah Waterland 		} else {
307*5c51f124SMoriah Waterland 			vfpPutc(a_vfp, ' ');
308*5c51f124SMoriah Waterland 			vfpPutInteger(a_vfp, a_ept->ainfo.minor);
309*5c51f124SMoriah Waterland 		}
310*5c51f124SMoriah Waterland 	}
311*5c51f124SMoriah Waterland 
312*5c51f124SMoriah Waterland 	/* if dxcbpfve, write out mode, owner, group */
313*5c51f124SMoriah Waterland 
314*5c51f124SMoriah Waterland 	if ((a_ept->ftype == 'd') || (a_ept->ftype == 'x') ||
315*5c51f124SMoriah Waterland 		(a_ept->ftype == 'c') || (a_ept->ftype == 'b') ||
316*5c51f124SMoriah Waterland 		(a_ept->ftype == 'p') || (a_ept->ftype == 'f') ||
317*5c51f124SMoriah Waterland 		(a_ept->ftype == 'v') || (a_ept->ftype == 'e')) {
318*5c51f124SMoriah Waterland 
319*5c51f124SMoriah Waterland 		/* mode */
320*5c51f124SMoriah Waterland 		vfpPutFormat(a_vfp,
321*5c51f124SMoriah Waterland 			((a_ept->ainfo.mode == BADMODE) ? " ?" : " %04o"),
322*5c51f124SMoriah Waterland 			a_ept->ainfo.mode);
323*5c51f124SMoriah Waterland 
324*5c51f124SMoriah Waterland 		/* owner */
325*5c51f124SMoriah Waterland 		vfpPutc(a_vfp, ' ');
326*5c51f124SMoriah Waterland 		vfpPuts(a_vfp, a_ept->ainfo.owner);
327*5c51f124SMoriah Waterland 
328*5c51f124SMoriah Waterland 		/* group */
329*5c51f124SMoriah Waterland 		vfpPutc(a_vfp, ' ');
330*5c51f124SMoriah Waterland 		vfpPuts(a_vfp, a_ept->ainfo.group);
331*5c51f124SMoriah Waterland 	}
332*5c51f124SMoriah Waterland 	/* if f/v/e, write out size, cksum, modtime */
333*5c51f124SMoriah Waterland 
334*5c51f124SMoriah Waterland 	if ((a_ept->ftype == 'f') || (a_ept->ftype == 'v') ||
335*5c51f124SMoriah Waterland 		(a_ept->ftype == 'e')) {
336*5c51f124SMoriah Waterland 		/* size */
337*5c51f124SMoriah Waterland 		vfpPutFormat(a_vfp,
338*5c51f124SMoriah Waterland 			((a_ept->cinfo.size == BADCONT) ? " ?" : " %llu"),
339*5c51f124SMoriah Waterland 			a_ept->cinfo.size);
340*5c51f124SMoriah Waterland 
341*5c51f124SMoriah Waterland 		/* cksum */
342*5c51f124SMoriah Waterland 		vfpPutFormat(a_vfp,
343*5c51f124SMoriah Waterland 			((a_ept->cinfo.cksum == BADCONT) ? " ?" : " %ld"),
344*5c51f124SMoriah Waterland 			a_ept->cinfo.cksum);
345*5c51f124SMoriah Waterland 
346*5c51f124SMoriah Waterland 		/* modtime */
347*5c51f124SMoriah Waterland 		vfpPutFormat(a_vfp,
348*5c51f124SMoriah Waterland 			((a_ept->cinfo.modtime == BADCONT) ? " ?" : " %ld"),
349*5c51f124SMoriah Waterland 			a_ept->cinfo.modtime);
350*5c51f124SMoriah Waterland 	}
351*5c51f124SMoriah Waterland 
352*5c51f124SMoriah Waterland 	/* write out list of all packages referencing this entry */
353*5c51f124SMoriah Waterland 
354*5c51f124SMoriah Waterland 	pinfo = a_ept->pinfo;
355*5c51f124SMoriah Waterland 	while (pinfo) {
356*5c51f124SMoriah Waterland 		vfpPutc(a_vfp, ' ');
357*5c51f124SMoriah Waterland 		if (pinfo->status) {
358*5c51f124SMoriah Waterland 			vfpPutc(a_vfp, pinfo->status);
359*5c51f124SMoriah Waterland 		}
360*5c51f124SMoriah Waterland 
361*5c51f124SMoriah Waterland 		vfpPuts(a_vfp, pinfo->pkg);
362*5c51f124SMoriah Waterland 
363*5c51f124SMoriah Waterland 		if (pinfo->editflag) {
364*5c51f124SMoriah Waterland 			vfpPutc(a_vfp, '\\');
365*5c51f124SMoriah Waterland 		}
366*5c51f124SMoriah Waterland 
367*5c51f124SMoriah Waterland 		if (pinfo->aclass[0]) {
368*5c51f124SMoriah Waterland 			vfpPutc(a_vfp, ':');
369*5c51f124SMoriah Waterland 			vfpPuts(a_vfp, pinfo->aclass);
370*5c51f124SMoriah Waterland 		}
371*5c51f124SMoriah Waterland 		pinfo = pinfo->next;
372*5c51f124SMoriah Waterland 	}
373*5c51f124SMoriah Waterland 
374*5c51f124SMoriah Waterland 	vfpPutc(a_vfp, '\n');
375*5c51f124SMoriah Waterland 	return (0);
376*5c51f124SMoriah Waterland }
377