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.
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.
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]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
36 #include <sys/types.h>
46 removef(int argc
, char *argv
[])
55 flag
= strcmp(argv
[0], "-") == 0;
58 max_eptnum
= 64; /* starting size of array */
59 extlist
= malloc(max_eptnum
* sizeof (struct cfextra
*));
63 if (fgets(buf
, PATH_MAX
, stdin
) == NULL
)
66 /* strip trailing new line */
68 if (buf
[len
- 1] == '\n')
79 * This strips the install root from the path using
80 * a questionable algorithm. This should go away as
81 * we define more precisely the command line syntax
82 * with our '-R' option. - JST
84 path
= orig_path_ptr(path
);
87 logerr(gettext("ERROR: no pathname was provided"));
94 "WARNING: relative pathname <%s> ignored"), path
);
99 new = calloc(1, sizeof (struct cfextra
));
101 progerr(strerror(errno
));
104 new->cf_ent
.ftype
= '-';
106 (void) eval_path(&(new->server_path
), &(new->client_path
),
107 &(new->map_path
), path
);
109 new->cf_ent
.path
= new->client_path
;
111 extlist
[eptnum
++] = new;
112 if (eptnum
>= max_eptnum
) {
113 /* array size grows exponentially */
115 extlist
= realloc(extlist
,
116 max_eptnum
* sizeof (struct cfextra
*));
117 if (extlist
== NULL
) {
118 progerr(strerror(errno
));
123 extlist
[eptnum
] = (struct cfextra
*)NULL
;
125 qsort((char *)extlist
,
126 (unsigned)eptnum
, sizeof (struct cfextra
*), cfentcmp
);