rpc_hout.c revision 1.23 1 1.23 dholland /* $NetBSD: rpc_hout.c,v 1.23 2015/05/09 23:12:57 dholland Exp $ */
2 1.1 glass /*
3 1.1 glass * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
4 1.1 glass * unrestricted use provided that this legend is included on all tape
5 1.1 glass * media and as a part of the software program in whole or part. Users
6 1.1 glass * may copy or modify Sun RPC without charge, but are not authorized
7 1.1 glass * to license or distribute it to anyone else except as part of a product or
8 1.4 pk * program developed by the user or with the express written consent of
9 1.4 pk * Sun Microsystems, Inc.
10 1.4 pk *
11 1.1 glass * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12 1.1 glass * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13 1.1 glass * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14 1.4 pk *
15 1.1 glass * Sun RPC is provided with no support and without any obligation on the
16 1.1 glass * part of Sun Microsystems, Inc. to assist in its use, correction,
17 1.1 glass * modification or enhancement.
18 1.4 pk *
19 1.1 glass * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20 1.1 glass * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21 1.1 glass * OR ANY PART THEREOF.
22 1.4 pk *
23 1.1 glass * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24 1.1 glass * or profits or other special, indirect and consequential damages, even if
25 1.1 glass * Sun has been advised of the possibility of such damages.
26 1.4 pk *
27 1.1 glass * Sun Microsystems, Inc.
28 1.1 glass * 2550 Garcia Avenue
29 1.1 glass * Mountain View, California 94043
30 1.1 glass */
31 1.4 pk
32 1.20 jmc #if HAVE_NBTOOL_CONFIG_H
33 1.20 jmc #include "nbtool_config.h"
34 1.20 jmc #endif
35 1.20 jmc
36 1.6 christos #include <sys/cdefs.h>
37 1.17 tv #if defined(__RCSID) && !defined(lint)
38 1.6 christos #if 0
39 1.4 pk static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI";
40 1.6 christos #else
41 1.23 dholland __RCSID("$NetBSD: rpc_hout.c,v 1.23 2015/05/09 23:12:57 dholland Exp $");
42 1.6 christos #endif
43 1.1 glass #endif
44 1.1 glass
45 1.1 glass /*
46 1.7 lukem * rpc_hout.c, Header file outputter for the RPC protocol compiler
47 1.1 glass */
48 1.17 tv #include <ctype.h>
49 1.17 tv #include <err.h>
50 1.1 glass #include <stdio.h>
51 1.6 christos #include "rpc_scan.h"
52 1.4 pk #include "rpc_parse.h"
53 1.1 glass #include "rpc_util.h"
54 1.1 glass
55 1.22 christos static void pconstdef(definition *);
56 1.22 christos static void pargdef(definition *);
57 1.22 christos static void pstructdef(definition *);
58 1.22 christos static void puniondef(definition *);
59 1.22 christos static void pdefine(const char *, const char *);
60 1.22 christos static void puldefine(const char *, const char *);
61 1.22 christos static int define_printed(proc_list *, version_list *);
62 1.22 christos static void pprogramdef(definition *);
63 1.22 christos static void penumdef(definition *);
64 1.22 christos static void ptypedef(definition *);
65 1.22 christos static int undefined2(const char *, const char *);
66 1.22 christos static void cplusplusstart(void);
67 1.22 christos static void cplusplusend(void);
68 1.1 glass
69 1.1 glass /*
70 1.7 lukem * Print the C-version of an xdr definition
71 1.1 glass */
72 1.1 glass void
73 1.21 dholland print_datadef(definition *def)
74 1.1 glass {
75 1.4 pk
76 1.7 lukem if (def->def_kind == DEF_PROGRAM) /* handle data only */
77 1.7 lukem return;
78 1.4 pk
79 1.1 glass if (def->def_kind != DEF_CONST) {
80 1.1 glass f_print(fout, "\n");
81 1.1 glass }
82 1.1 glass switch (def->def_kind) {
83 1.1 glass case DEF_STRUCT:
84 1.1 glass pstructdef(def);
85 1.1 glass break;
86 1.1 glass case DEF_UNION:
87 1.1 glass puniondef(def);
88 1.1 glass break;
89 1.1 glass case DEF_ENUM:
90 1.1 glass penumdef(def);
91 1.1 glass break;
92 1.1 glass case DEF_TYPEDEF:
93 1.1 glass ptypedef(def);
94 1.1 glass break;
95 1.1 glass case DEF_PROGRAM:
96 1.1 glass pprogramdef(def);
97 1.1 glass break;
98 1.1 glass case DEF_CONST:
99 1.1 glass pconstdef(def);
100 1.1 glass break;
101 1.1 glass }
102 1.4 pk }
103 1.4 pk
104 1.4 pk void
105 1.22 christos print_progdef(definition *def)
106 1.4 pk {
107 1.4 pk switch (def->def_kind) {
108 1.4 pk case DEF_PROGRAM:
109 1.1 glass f_print(fout, "\n");
110 1.4 pk pprogramdef(def);
111 1.4 pk break;
112 1.6 christos case DEF_CONST:
113 1.6 christos case DEF_TYPEDEF:
114 1.6 christos case DEF_ENUM:
115 1.6 christos case DEF_UNION:
116 1.6 christos case DEF_STRUCT:
117 1.6 christos break;
118 1.7 lukem }
119 1.4 pk }
120 1.4 pk
121 1.6 christos void
122 1.22 christos print_funcdef(definition *def, int *did)
123 1.22 christos {
124 1.22 christos switch (def->def_kind) {
125 1.22 christos case DEF_PROGRAM:
126 1.22 christos case DEF_CONST:
127 1.22 christos break;
128 1.22 christos case DEF_TYPEDEF:
129 1.22 christos case DEF_ENUM:
130 1.22 christos case DEF_UNION:
131 1.22 christos case DEF_STRUCT:
132 1.22 christos if (!*did) {
133 1.22 christos f_print(fout, "\n");
134 1.22 christos cplusplusstart();
135 1.22 christos *did = 1;
136 1.22 christos }
137 1.22 christos pxdrfuncdecl(def->def_name,
138 1.22 christos def->def_kind != DEF_TYPEDEF ||
139 1.22 christos !isvectordef(def->def.ty.old_type, def->def.ty.rel));
140 1.22 christos break;
141 1.22 christos }
142 1.22 christos }
143 1.22 christos
144 1.22 christos void
145 1.22 christos print_funcend(int did) {
146 1.22 christos if (did) {
147 1.22 christos cplusplusend();
148 1.22 christos }
149 1.22 christos }
150 1.22 christos
151 1.22 christos void
152 1.21 dholland pxdrfuncdecl(const char *name, int pointerp)
153 1.7 lukem {
154 1.7 lukem
155 1.22 christos f_print(fout, "bool_t xdr_%s(XDR *, %s%s);\n", name,
156 1.13 lukem name, pointerp ? (" *") : "");
157 1.1 glass }
158 1.1 glass
159 1.4 pk
160 1.6 christos static void
161 1.21 dholland pconstdef(definition *def)
162 1.1 glass {
163 1.1 glass pdefine(def->def_name, def->def.co);
164 1.1 glass }
165 1.21 dholland
166 1.7 lukem /* print out the definitions for the arguments of functions in the
167 1.7 lukem header file
168 1.4 pk */
169 1.7 lukem static void
170 1.21 dholland pargdef(definition *def)
171 1.4 pk {
172 1.4 pk decl_list *l;
173 1.4 pk version_list *vers;
174 1.7 lukem char *name;
175 1.4 pk proc_list *plist;
176 1.22 christos int did;
177 1.4 pk
178 1.7 lukem
179 1.4 pk for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
180 1.22 christos for (plist = vers->procs; plist != NULL; plist = plist->next) {
181 1.7 lukem if (!newstyle || plist->arg_num < 2) {
182 1.7 lukem continue; /* old style or single args */
183 1.7 lukem }
184 1.7 lukem name = plist->args.argname;
185 1.7 lukem f_print(fout, "struct %s {\n", name);
186 1.7 lukem for (l = plist->args.decls;
187 1.7 lukem l != NULL; l = l->next) {
188 1.7 lukem pdeclaration(name, &l->decl, 1, ";\n");
189 1.4 pk }
190 1.7 lukem f_print(fout, "};\n");
191 1.7 lukem f_print(fout, "typedef struct %s %s;\n", name, name);
192 1.4 pk }
193 1.7 lukem }
194 1.22 christos did = 0;
195 1.22 christos for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
196 1.22 christos if (!newstyle || plist->arg_num < 2) {
197 1.22 christos continue; /* old style or single args */
198 1.22 christos }
199 1.22 christos for (plist = vers->procs; plist != NULL; plist = plist->next) {
200 1.22 christos if (!did) {
201 1.22 christos cplusplusstart();
202 1.22 christos did = 1;
203 1.22 christos }
204 1.22 christos pxdrfuncdecl(plist->args.argname, 1);
205 1.22 christos }
206 1.22 christos }
207 1.22 christos if (did) {
208 1.22 christos cplusplusend();
209 1.22 christos }
210 1.4 pk
211 1.4 pk }
212 1.4 pk
213 1.4 pk
214 1.7 lukem static void
215 1.21 dholland pstructdef(definition *def)
216 1.1 glass {
217 1.1 glass decl_list *l;
218 1.21 dholland const char *name = def->def_name;
219 1.1 glass
220 1.1 glass f_print(fout, "struct %s {\n", name);
221 1.1 glass for (l = def->def.st.decls; l != NULL; l = l->next) {
222 1.4 pk pdeclaration(name, &l->decl, 1, ";\n");
223 1.1 glass }
224 1.1 glass f_print(fout, "};\n");
225 1.1 glass f_print(fout, "typedef struct %s %s;\n", name, name);
226 1.1 glass }
227 1.1 glass
228 1.6 christos static void
229 1.21 dholland puniondef(definition *def)
230 1.1 glass {
231 1.1 glass case_list *l;
232 1.21 dholland const char *name = def->def_name;
233 1.1 glass declaration *decl;
234 1.1 glass
235 1.1 glass f_print(fout, "struct %s {\n", name);
236 1.1 glass decl = &def->def.un.enum_decl;
237 1.1 glass if (streq(decl->type, "bool")) {
238 1.1 glass f_print(fout, "\tbool_t %s;\n", decl->name);
239 1.1 glass } else {
240 1.1 glass f_print(fout, "\t%s %s;\n", decl->type, decl->name);
241 1.1 glass }
242 1.1 glass f_print(fout, "\tunion {\n");
243 1.1 glass for (l = def->def.un.cases; l != NULL; l = l->next) {
244 1.7 lukem if (l->contflag == 0)
245 1.7 lukem pdeclaration(name, &l->case_decl, 2, ";\n");
246 1.1 glass }
247 1.1 glass decl = def->def.un.default_decl;
248 1.1 glass if (decl && !streq(decl->type, "void")) {
249 1.7 lukem pdeclaration(name, decl, 2, ";\n");
250 1.1 glass }
251 1.1 glass f_print(fout, "\t} %s_u;\n", name);
252 1.1 glass f_print(fout, "};\n");
253 1.1 glass f_print(fout, "typedef struct %s %s;\n", name, name);
254 1.1 glass }
255 1.1 glass
256 1.6 christos static void
257 1.21 dholland pdefine(const char *name, const char *num)
258 1.1 glass {
259 1.1 glass f_print(fout, "#define %s %s\n", name, num);
260 1.1 glass }
261 1.1 glass
262 1.6 christos static void
263 1.21 dholland puldefine(const char *name, const char *num)
264 1.1 glass {
265 1.12 fvdl f_print(fout, "#define %s %s\n", name, num);
266 1.1 glass }
267 1.1 glass
268 1.6 christos static int
269 1.21 dholland define_printed(proc_list *stop, version_list *start)
270 1.1 glass {
271 1.1 glass version_list *vers;
272 1.1 glass proc_list *proc;
273 1.1 glass
274 1.1 glass for (vers = start; vers != NULL; vers = vers->next) {
275 1.1 glass for (proc = vers->procs; proc != NULL; proc = proc->next) {
276 1.1 glass if (proc == stop) {
277 1.1 glass return (0);
278 1.7 lukem } else
279 1.7 lukem if (streq(proc->proc_name, stop->proc_name)) {
280 1.7 lukem return (1);
281 1.7 lukem }
282 1.1 glass }
283 1.1 glass }
284 1.23 dholland errx(1, "Internal error at %s:%d: procedure not found",
285 1.6 christos __FILE__, __LINE__);
286 1.1 glass /* NOTREACHED */
287 1.1 glass }
288 1.1 glass
289 1.6 christos static void
290 1.22 christos cplusplusstart(void)
291 1.22 christos {
292 1.22 christos if (BSDflag)
293 1.22 christos f_print(fout, "__BEGIN_DECLS\n");
294 1.22 christos else
295 1.22 christos f_print(fout, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
296 1.22 christos }
297 1.22 christos
298 1.22 christos static void
299 1.22 christos cplusplusend(void)
300 1.22 christos {
301 1.22 christos if (BSDflag)
302 1.22 christos f_print(fout, "__END_DECLS\n");
303 1.22 christos else
304 1.22 christos f_print(fout, "#ifdef __cplusplus\n};\n#endif\n");
305 1.22 christos }
306 1.22 christos
307 1.22 christos static void
308 1.21 dholland pprogramdef(definition *def)
309 1.1 glass {
310 1.1 glass version_list *vers;
311 1.1 glass proc_list *proc;
312 1.7 lukem
313 1.4 pk pargdef(def);
314 1.1 glass
315 1.1 glass puldefine(def->def_name, def->def.pr.prog_num);
316 1.1 glass for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
317 1.4 pk if (tblflag) {
318 1.4 pk f_print(fout, "extern struct rpcgen_table %s_%s_table[];\n",
319 1.7 lukem locase(def->def_name), vers->vers_num);
320 1.4 pk f_print(fout, "extern %s_%s_nproc;\n",
321 1.7 lukem locase(def->def_name), vers->vers_num);
322 1.4 pk }
323 1.1 glass puldefine(vers->vers_name, vers->vers_num);
324 1.22 christos for (proc = vers->procs; proc != NULL; proc = proc->next) {
325 1.22 christos if (!define_printed(proc, def->def.pr.versions)) {
326 1.22 christos puldefine(proc->proc_name, proc->proc_num);
327 1.1 glass }
328 1.22 christos }
329 1.22 christos }
330 1.4 pk
331 1.22 christos /*
332 1.22 christos * Print out 3 definitions, one for ANSI-C, another for C++, a
333 1.22 christos * third for old style C
334 1.22 christos */
335 1.22 christos f_print(fout, "\n");
336 1.22 christos cplusplusstart();
337 1.22 christos for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
338 1.22 christos for (proc = vers->procs; proc != NULL; proc = proc->next) {
339 1.22 christos pprocdef(proc, vers, "CLIENT *", 0);
340 1.22 christos pprocdef(proc, vers, "struct svc_req *", 1);
341 1.1 glass }
342 1.1 glass }
343 1.22 christos cplusplusend();
344 1.1 glass }
345 1.1 glass
346 1.6 christos void
347 1.21 dholland pprocdef(proc_list *proc, version_list *vp, const char *addargtype,
348 1.22 christos int server_p)
349 1.4 pk {
350 1.15 mycroft decl_list *dl;
351 1.4 pk
352 1.15 mycroft if (Mflag) {
353 1.15 mycroft if (server_p)
354 1.15 mycroft f_print(fout, "bool_t ");
355 1.15 mycroft else
356 1.15 mycroft f_print(fout, "enum clnt_stat ");
357 1.15 mycroft } else {
358 1.15 mycroft ptype(proc->res_prefix, proc->res_type, 1);
359 1.15 mycroft f_print(fout, "*");
360 1.15 mycroft }
361 1.7 lukem if (server_p)
362 1.4 pk pvname_svc(proc->proc_name, vp->vers_num);
363 1.4 pk else
364 1.4 pk pvname(proc->proc_name, vp->vers_num);
365 1.4 pk
366 1.22 christos f_print(fout, "(");
367 1.22 christos if (proc->arg_num < 2 && newstyle &&
368 1.22 christos streq(proc->args.decls->decl.type, "void")) {
369 1.22 christos /* 0 argument in new style: do nothing */
370 1.22 christos } else {
371 1.22 christos for (dl = proc->args.decls; dl != NULL; dl = dl->next) {
372 1.22 christos ptype(dl->decl.prefix, dl->decl.type, 1);
373 1.22 christos if (!newstyle)
374 1.15 mycroft f_print(fout, "*");
375 1.15 mycroft f_print(fout, ", ");
376 1.15 mycroft }
377 1.15 mycroft }
378 1.22 christos if (Mflag) {
379 1.22 christos if (streq(proc->res_type, "void"))
380 1.22 christos f_print(fout, "char");
381 1.22 christos else
382 1.22 christos ptype(proc->res_prefix, proc->res_type, 0);
383 1.22 christos if (!isvectordef(proc->res_type, REL_ALIAS))
384 1.22 christos f_print(fout, "*");
385 1.22 christos f_print(fout, ", ");
386 1.22 christos }
387 1.22 christos f_print(fout, "%s);\n", addargtype);
388 1.4 pk }
389 1.4 pk
390 1.1 glass
391 1.6 christos static void
392 1.21 dholland penumdef(definition *def)
393 1.1 glass {
394 1.21 dholland const char *name = def->def_name;
395 1.1 glass enumval_list *l;
396 1.21 dholland const char *last = NULL;
397 1.21 dholland int count = 0;
398 1.21 dholland const char *first = "";
399 1.1 glass
400 1.1 glass f_print(fout, "enum %s {\n", name);
401 1.1 glass for (l = def->def.en.vals; l != NULL; l = l->next) {
402 1.18 christos f_print(fout, "%s\t%s", first, l->name);
403 1.1 glass if (l->assignment) {
404 1.1 glass f_print(fout, " = %s", l->assignment);
405 1.1 glass last = l->assignment;
406 1.1 glass count = 1;
407 1.1 glass } else {
408 1.1 glass if (last == NULL) {
409 1.1 glass f_print(fout, " = %d", count++);
410 1.1 glass } else {
411 1.1 glass f_print(fout, " = %s + %d", last, count++);
412 1.1 glass }
413 1.1 glass }
414 1.18 christos first = ",\n";
415 1.1 glass }
416 1.18 christos f_print(fout, "\n};\n");
417 1.1 glass f_print(fout, "typedef enum %s %s;\n", name, name);
418 1.1 glass }
419 1.1 glass
420 1.6 christos static void
421 1.21 dholland ptypedef(definition *def)
422 1.1 glass {
423 1.21 dholland const char *name = def->def_name;
424 1.21 dholland const char *old = def->def.ty.old_type;
425 1.7 lukem char prefix[8]; /* enough to contain "struct ", including NUL */
426 1.1 glass relation rel = def->def.ty.rel;
427 1.1 glass
428 1.1 glass
429 1.1 glass if (!streq(name, old)) {
430 1.1 glass if (streq(old, "string")) {
431 1.1 glass old = "char";
432 1.1 glass rel = REL_POINTER;
433 1.7 lukem } else
434 1.7 lukem if (streq(old, "opaque")) {
435 1.7 lukem old = "char";
436 1.7 lukem } else
437 1.7 lukem if (streq(old, "bool")) {
438 1.7 lukem old = "bool_t";
439 1.7 lukem }
440 1.1 glass if (undefined2(old, name) && def->def.ty.old_prefix) {
441 1.1 glass s_print(prefix, "%s ", def->def.ty.old_prefix);
442 1.1 glass } else {
443 1.1 glass prefix[0] = 0;
444 1.1 glass }
445 1.1 glass f_print(fout, "typedef ");
446 1.1 glass switch (rel) {
447 1.1 glass case REL_ARRAY:
448 1.1 glass f_print(fout, "struct {\n");
449 1.1 glass f_print(fout, "\tu_int %s_len;\n", name);
450 1.1 glass f_print(fout, "\t%s%s *%s_val;\n", prefix, old, name);
451 1.1 glass f_print(fout, "} %s", name);
452 1.1 glass break;
453 1.1 glass case REL_POINTER:
454 1.1 glass f_print(fout, "%s%s *%s", prefix, old, name);
455 1.1 glass break;
456 1.1 glass case REL_VECTOR:
457 1.1 glass f_print(fout, "%s%s %s[%s]", prefix, old, name,
458 1.7 lukem def->def.ty.array_max);
459 1.1 glass break;
460 1.1 glass case REL_ALIAS:
461 1.4 pk f_print(fout, "%s%s %s", prefix, old, name);
462 1.1 glass break;
463 1.1 glass }
464 1.1 glass f_print(fout, ";\n");
465 1.1 glass }
466 1.1 glass }
467 1.1 glass
468 1.6 christos void
469 1.21 dholland pdeclaration(const char *name, declaration *dec, int tab,
470 1.21 dholland const char *separator)
471 1.1 glass {
472 1.7 lukem char buf[8]; /* enough to hold "struct ", include NUL */
473 1.21 dholland const char *prefix;
474 1.21 dholland const char *type;
475 1.1 glass
476 1.1 glass if (streq(dec->type, "void")) {
477 1.1 glass return;
478 1.1 glass }
479 1.1 glass tabify(fout, tab);
480 1.1 glass if (streq(dec->type, name) && !dec->prefix) {
481 1.1 glass f_print(fout, "struct ");
482 1.1 glass }
483 1.1 glass if (streq(dec->type, "string")) {
484 1.1 glass f_print(fout, "char *%s", dec->name);
485 1.1 glass } else {
486 1.1 glass prefix = "";
487 1.1 glass if (streq(dec->type, "bool")) {
488 1.1 glass type = "bool_t";
489 1.7 lukem } else
490 1.7 lukem if (streq(dec->type, "opaque")) {
491 1.7 lukem type = "char";
492 1.7 lukem } else {
493 1.7 lukem if (dec->prefix) {
494 1.7 lukem s_print(buf, "%s ", dec->prefix);
495 1.7 lukem prefix = buf;
496 1.7 lukem }
497 1.7 lukem type = dec->type;
498 1.1 glass }
499 1.1 glass switch (dec->rel) {
500 1.1 glass case REL_ALIAS:
501 1.1 glass f_print(fout, "%s%s %s", prefix, type, dec->name);
502 1.1 glass break;
503 1.1 glass case REL_VECTOR:
504 1.1 glass f_print(fout, "%s%s %s[%s]", prefix, type, dec->name,
505 1.7 lukem dec->array_max);
506 1.1 glass break;
507 1.1 glass case REL_POINTER:
508 1.1 glass f_print(fout, "%s%s *%s", prefix, type, dec->name);
509 1.1 glass break;
510 1.1 glass case REL_ARRAY:
511 1.1 glass f_print(fout, "struct {\n");
512 1.1 glass tabify(fout, tab);
513 1.1 glass f_print(fout, "\tu_int %s_len;\n", dec->name);
514 1.1 glass tabify(fout, tab);
515 1.1 glass f_print(fout, "\t%s%s *%s_val;\n", prefix, type, dec->name);
516 1.1 glass tabify(fout, tab);
517 1.1 glass f_print(fout, "} %s", dec->name);
518 1.1 glass break;
519 1.1 glass }
520 1.1 glass }
521 1.14 is f_print(fout, "%s", separator);
522 1.1 glass }
523 1.1 glass
524 1.6 christos static int
525 1.21 dholland undefined2(const char *type, const char *stop)
526 1.1 glass {
527 1.7 lukem list *l;
528 1.1 glass definition *def;
529 1.1 glass
530 1.1 glass for (l = defined; l != NULL; l = l->next) {
531 1.1 glass def = (definition *) l->val;
532 1.1 glass if (def->def_kind != DEF_PROGRAM) {
533 1.1 glass if (streq(def->def_name, stop)) {
534 1.1 glass return (1);
535 1.7 lukem } else
536 1.7 lukem if (streq(def->def_name, type)) {
537 1.7 lukem return (0);
538 1.7 lukem }
539 1.1 glass }
540 1.1 glass }
541 1.1 glass return (1);
542 1.1 glass }
543