4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 1992 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
30 * Portions of this source code were derived from Berkeley
31 * under license from the Regents of the University of
35 #pragma ident "%Z%%M% %I% %E% SMI"
42 extern char *strdup();
45 * Add a name to the list
59 it
= (listofnames
*) malloc(sizeof (listofnames
));
70 * Assemble the list of names
76 listofnames
*nameslist
;
83 fyle
= fopen(filename
, "r");
88 while (fgets(line
, sizeof (line
), fyle
)) {
89 if (line
[0] == '#') continue;
90 if (line
[0] == '\0') continue;
91 if (line
[0] == '\n') continue;
92 nname
= newname(line
);
94 if (nameslist
== NULL
) {
98 end
->nextname
= nname
;
103 "file %s bad malloc %s\n", filename
, name
);
110 free_listofnames(locallist
)
111 listofnames
*locallist
;
113 listofnames
*next
= (listofnames
*)NULL
;
115 for (; locallist
; locallist
= next
) {
116 next
= locallist
->nextname
;
118 free(locallist
->name
);
119 free((char *)locallist
);
129 list
= names(argv
[1]);
131 print_listofnames(list
);
133 free_listofnames(list
);
142 print_listofnames(list
)
147 for (; list
; list
= list
->nextname
)
148 printf("%s\n", list
->name
);