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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
27 * University Copyright- Copyright (c) 1982, 1986, 1988
28 * The Regents of the University of California
31 * University Acknowledgment- Portions of this document are derived from
32 * software developed by the University of California, Berkeley, and its
36 #pragma ident "%Z%%M% %I% %E% SMI"
41 translate(struct name
*np
)
43 struct name
*n
, *t
, *x
;
44 void (*sigint
)(int), (*sigquit
)(int);
45 char *xl
= value("translate");
57 for (n
= np
; n
; n
= n
->n_flink
)
58 if (! (n
->n_type
& GDEL
))
59 i
+= strlen(n
->n_name
) + 3;
60 cmd
= (char *)salloc((unsigned)i
);
62 for (n
= np
; n
; n
= n
->n_flink
)
63 if (! (n
->n_type
& GDEL
)) {
65 strcat(cmd
, n
->n_name
);
68 if ((pp
= npopen(cmd
, "r")) == NULL
) {
73 sigint
= sigset(SIGINT
, SIG_IGN
);
74 sigquit
= sigset(SIGQUIT
, SIG_IGN
);
75 fgets(postmark
, sizeof postmark
, pp
);
78 postmark
[strlen(postmark
)-1] = 0;
79 assign("postmark", postmark
);
81 for (n
= np
; n
; n
= n
->n_flink
) {
84 if (fgets(line
, sizeof line
, pp
) == NULL
)
86 line
[strlen(line
)-1] = 0;
87 if (!strcmp(line
, n
->n_name
))
89 x
= extract(line
, n
->n_type
);
92 if (x
&& !x
->n_flink
&& strpbrk(n
->n_full
, "(<"))
93 x
->n_full
= splice(x
->n_name
, n
->n_full
);
104 if (npclose(pp
) != 0 || n
)
106 sigset(SIGINT
, sigint
);
107 sigset(SIGQUIT
, sigquit
);