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]
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
50 main(int argc
, char **argv
)
58 (void) setlocale(LC_ALL
, "");
59 #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
60 #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
62 (void) textdomain(TEXT_DOMAIN
);
63 if (argc
> 1 && *argv
[1] == '-') {
71 if ((iobuf
= fopen(*argv
, "r")) == NULL
) {
72 message
= gettext("can not open ");
73 write(2, message
, strlen(message
));
74 write(2, *argv
, size(*argv
));
76 /* continues to next file, if any, but the */
77 /* exit status will indicate an error */
83 if (*bp
== '/') *bp
= '\0';
86 while (*bp
!= '\0' && bp
> *argv
) bp
--;
92 if (cflg
) *cp
++ = 'c';
96 if (creat(ofile
, 0644) < 0) {
97 message
= gettext("can not create .i file\n");
98 write(2, message
, strlen(message
));
106 while (((c
= getc(iobuf
)) == '\n') ||
113 while (((*name
++ = c
= getc(iobuf
)) != ' ') &&
114 (c
!= EOF
) && (c
!= '\n'))
117 while (((c
= getc(iobuf
)) == ' ') || (c
== '\n'))
121 message
= gettext("unexpected eof\n");
122 write(2, message
, strlen(message
));
125 message
= gettext("missing initial quote for ");
126 write(2, message
, strlen(message
));
127 write(2, a2
, size(a2
));
129 gettext(" : remainder of line ignored\n");
130 write(2, message
, strlen(message
));
131 while ((c
= getc(iobuf
)) != '\n')
136 while (gotflg
|| (c
= getc(iobuf
)) != EOF
) {
142 switch (c
= getc(iobuf
)) {
159 if (c
<= '7' && c
>= '0')
160 *str
++ = getnm((char)c
);
170 message
= gettext("unexpected eof\n");
171 write(2, message
, strlen(message
));
174 while (((c
= getc(iobuf
)) == '\n') || (c
== ' '))
176 if (c
== '"') goto keeponl
;
181 if (!(sv
= v
= regcmp(a1
, 0))) {
182 message
= gettext("fail: ");
183 write(2, message
, strlen(message
));
184 write(2, a2
, size(a2
));
188 printf("/* \"%s\" */\n", a1
);
189 printf("char %s[] = {\n", a2
);
190 while (__i_size
> 0) {
191 for (k
= 0; k
< 12; k
++)
193 printf("0%o, ", *v
++);
223 while (++k
< 4 && (c
= getc(iobuf
)) >= '0' && c
<= '7')