util.c revision 1.17 1 1.17 uebayasi /* $NetBSD: util.c,v 1.17 2014/10/09 06:45:31 uebayasi Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*
4 1.1 thorpej * Copyright (c) 1992, 1993
5 1.1 thorpej * The Regents of the University of California. All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * This software was developed by the Computer Systems Engineering group
8 1.1 thorpej * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9 1.1 thorpej * contributed to Berkeley.
10 1.1 thorpej *
11 1.1 thorpej * All advertising materials mentioning features or use of this software
12 1.1 thorpej * must display the following acknowledgement:
13 1.1 thorpej * This product includes software developed by the University of
14 1.1 thorpej * California, Lawrence Berkeley Laboratories.
15 1.1 thorpej *
16 1.1 thorpej * Redistribution and use in source and binary forms, with or without
17 1.1 thorpej * modification, are permitted provided that the following conditions
18 1.1 thorpej * are met:
19 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
20 1.1 thorpej * notice, this list of conditions and the following disclaimer.
21 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
22 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
23 1.1 thorpej * documentation and/or other materials provided with the distribution.
24 1.1 thorpej * 3. Neither the name of the University nor the names of its contributors
25 1.1 thorpej * may be used to endorse or promote products derived from this software
26 1.1 thorpej * without specific prior written permission.
27 1.1 thorpej *
28 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 1.1 thorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 1.1 thorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 1.1 thorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 1.1 thorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 1.1 thorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 1.1 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 1.1 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 1.1 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 1.1 thorpej * SUCH DAMAGE.
39 1.1 thorpej *
40 1.1 thorpej * from: @(#)util.c 8.1 (Berkeley) 6/6/93
41 1.1 thorpej */
42 1.1 thorpej
43 1.1 thorpej #if HAVE_NBTOOL_CONFIG_H
44 1.1 thorpej #include "nbtool_config.h"
45 1.1 thorpej #endif
46 1.1 thorpej
47 1.3 christos #include <sys/types.h>
48 1.10 dholland #include <assert.h>
49 1.1 thorpej #include <ctype.h>
50 1.1 thorpej #include <stdio.h>
51 1.1 thorpej #include <stdlib.h>
52 1.1 thorpej #include <string.h>
53 1.1 thorpej #include <stdarg.h>
54 1.3 christos #include <util.h>
55 1.6 christos #include <err.h>
56 1.1 thorpej #include "defs.h"
57 1.1 thorpej
58 1.6 christos static void cfgvxerror(const char *, int, const char *, va_list)
59 1.9 dholland __printflike(3, 0);
60 1.17 uebayasi #ifndef MAKE_BOOTSTRAP
61 1.17 uebayasi static void cfgvxdbg(const char *, int, const char *, va_list)
62 1.17 uebayasi __printflike(3, 0);
63 1.17 uebayasi #endif
64 1.6 christos static void cfgvxwarn(const char *, int, const char *, va_list)
65 1.9 dholland __printflike(3, 0);
66 1.6 christos static void cfgvxmsg(const char *, int, const char *, const char *, va_list)
67 1.9 dholland __printflike(4, 0);
68 1.1 thorpej
69 1.12 dholland /************************************************************/
70 1.12 dholland
71 1.12 dholland /*
72 1.12 dholland * Prefix stack
73 1.12 dholland */
74 1.12 dholland
75 1.1 thorpej /*
76 1.1 thorpej * Push a prefix onto the prefix stack.
77 1.1 thorpej */
78 1.1 thorpej void
79 1.1 thorpej prefix_push(const char *path)
80 1.1 thorpej {
81 1.1 thorpej struct prefix *pf;
82 1.1 thorpej char *cp;
83 1.1 thorpej
84 1.1 thorpej pf = ecalloc(1, sizeof(struct prefix));
85 1.1 thorpej
86 1.1 thorpej if (! SLIST_EMPTY(&prefixes) && *path != '/') {
87 1.1 thorpej cp = emalloc(strlen(SLIST_FIRST(&prefixes)->pf_prefix) + 1 +
88 1.1 thorpej strlen(path) + 1);
89 1.1 thorpej (void) sprintf(cp, "%s/%s",
90 1.1 thorpej SLIST_FIRST(&prefixes)->pf_prefix, path);
91 1.1 thorpej pf->pf_prefix = intern(cp);
92 1.1 thorpej free(cp);
93 1.1 thorpej } else
94 1.1 thorpej pf->pf_prefix = intern(path);
95 1.1 thorpej
96 1.1 thorpej SLIST_INSERT_HEAD(&prefixes, pf, pf_next);
97 1.1 thorpej }
98 1.1 thorpej
99 1.1 thorpej /*
100 1.1 thorpej * Pop a prefix off the prefix stack.
101 1.1 thorpej */
102 1.1 thorpej void
103 1.1 thorpej prefix_pop(void)
104 1.1 thorpej {
105 1.1 thorpej struct prefix *pf;
106 1.1 thorpej
107 1.1 thorpej if ((pf = SLIST_FIRST(&prefixes)) == NULL) {
108 1.6 christos cfgerror("no prefixes on the stack to pop");
109 1.1 thorpej return;
110 1.1 thorpej }
111 1.1 thorpej
112 1.1 thorpej SLIST_REMOVE_HEAD(&prefixes, pf_next);
113 1.1 thorpej /* Remember this prefix for emitting -I... directives later. */
114 1.1 thorpej SLIST_INSERT_HEAD(&allprefixes, pf, pf_next);
115 1.1 thorpej }
116 1.1 thorpej
117 1.1 thorpej /*
118 1.1 thorpej * Prepend the source path to a file name.
119 1.1 thorpej */
120 1.1 thorpej char *
121 1.1 thorpej sourcepath(const char *file)
122 1.1 thorpej {
123 1.1 thorpej size_t len;
124 1.1 thorpej char *cp;
125 1.1 thorpej struct prefix *pf;
126 1.1 thorpej
127 1.1 thorpej pf = SLIST_EMPTY(&prefixes) ? NULL : SLIST_FIRST(&prefixes);
128 1.1 thorpej if (pf != NULL && *pf->pf_prefix == '/')
129 1.1 thorpej len = strlen(pf->pf_prefix) + 1 + strlen(file) + 1;
130 1.1 thorpej else {
131 1.1 thorpej len = strlen(srcdir) + 1 + strlen(file) + 1;
132 1.1 thorpej if (pf != NULL)
133 1.1 thorpej len += strlen(pf->pf_prefix) + 1;
134 1.1 thorpej }
135 1.1 thorpej
136 1.1 thorpej cp = emalloc(len);
137 1.1 thorpej
138 1.1 thorpej if (pf != NULL) {
139 1.1 thorpej if (*pf->pf_prefix == '/')
140 1.1 thorpej (void) sprintf(cp, "%s/%s", pf->pf_prefix, file);
141 1.1 thorpej else
142 1.1 thorpej (void) sprintf(cp, "%s/%s/%s", srcdir,
143 1.1 thorpej pf->pf_prefix, file);
144 1.1 thorpej } else
145 1.1 thorpej (void) sprintf(cp, "%s/%s", srcdir, file);
146 1.1 thorpej return (cp);
147 1.1 thorpej }
148 1.1 thorpej
149 1.12 dholland /************************************************************/
150 1.12 dholland
151 1.12 dholland /*
152 1.12 dholland * Data structures
153 1.12 dholland */
154 1.12 dholland
155 1.12 dholland /*
156 1.12 dholland * nvlist
157 1.12 dholland */
158 1.12 dholland
159 1.1 thorpej struct nvlist *
160 1.8 christos newnv(const char *name, const char *str, void *ptr, long long i, struct nvlist *next)
161 1.1 thorpej {
162 1.1 thorpej struct nvlist *nv;
163 1.1 thorpej
164 1.4 dsl nv = ecalloc(1, sizeof(*nv));
165 1.1 thorpej nv->nv_next = next;
166 1.1 thorpej nv->nv_name = name;
167 1.4 dsl nv->nv_str = str;
168 1.4 dsl nv->nv_ptr = ptr;
169 1.8 christos nv->nv_num = i;
170 1.4 dsl return nv;
171 1.1 thorpej }
172 1.1 thorpej
173 1.1 thorpej /*
174 1.1 thorpej * Free an nvlist structure (just one).
175 1.1 thorpej */
176 1.1 thorpej void
177 1.1 thorpej nvfree(struct nvlist *nv)
178 1.1 thorpej {
179 1.1 thorpej
180 1.4 dsl free(nv);
181 1.1 thorpej }
182 1.1 thorpej
183 1.1 thorpej /*
184 1.1 thorpej * Free an nvlist (the whole list).
185 1.1 thorpej */
186 1.1 thorpej void
187 1.1 thorpej nvfreel(struct nvlist *nv)
188 1.1 thorpej {
189 1.1 thorpej struct nvlist *next;
190 1.1 thorpej
191 1.1 thorpej for (; nv != NULL; nv = next) {
192 1.1 thorpej next = nv->nv_next;
193 1.4 dsl free(nv);
194 1.1 thorpej }
195 1.1 thorpej }
196 1.1 thorpej
197 1.5 cube struct nvlist *
198 1.5 cube nvcat(struct nvlist *nv1, struct nvlist *nv2)
199 1.5 cube {
200 1.5 cube struct nvlist *nv;
201 1.5 cube
202 1.5 cube if (nv1 == NULL)
203 1.5 cube return nv2;
204 1.5 cube
205 1.5 cube for (nv = nv1; nv->nv_next != NULL; nv = nv->nv_next);
206 1.5 cube
207 1.5 cube nv->nv_next = nv2;
208 1.5 cube return nv1;
209 1.5 cube }
210 1.5 cube
211 1.12 dholland /*
212 1.14 dholland * Option definition lists
213 1.14 dholland */
214 1.14 dholland
215 1.14 dholland struct defoptlist *
216 1.14 dholland defoptlist_create(const char *name, const char *val, const char *lintval)
217 1.14 dholland {
218 1.14 dholland struct defoptlist *dl;
219 1.14 dholland
220 1.14 dholland dl = emalloc(sizeof(*dl));
221 1.14 dholland dl->dl_next = NULL;
222 1.14 dholland dl->dl_name = name;
223 1.14 dholland dl->dl_value = val;
224 1.14 dholland dl->dl_lintvalue = lintval;
225 1.14 dholland dl->dl_obsolete = 0;
226 1.14 dholland dl->dl_depends = NULL;
227 1.14 dholland return dl;
228 1.14 dholland }
229 1.14 dholland
230 1.14 dholland void
231 1.14 dholland defoptlist_destroy(struct defoptlist *dl)
232 1.14 dholland {
233 1.14 dholland struct defoptlist *next;
234 1.14 dholland
235 1.14 dholland while (dl != NULL) {
236 1.14 dholland next = dl->dl_next;
237 1.14 dholland dl->dl_next = NULL;
238 1.14 dholland
239 1.14 dholland // XXX should we assert that dl->dl_deps is null to
240 1.14 dholland // be sure the deps have already been destroyed?
241 1.14 dholland free(dl);
242 1.14 dholland
243 1.14 dholland dl = next;
244 1.14 dholland }
245 1.14 dholland }
246 1.14 dholland
247 1.14 dholland struct defoptlist *
248 1.14 dholland defoptlist_append(struct defoptlist *dla, struct defoptlist *dlb)
249 1.14 dholland {
250 1.14 dholland struct defoptlist *dl;
251 1.14 dholland
252 1.14 dholland if (dla == NULL)
253 1.14 dholland return dlb;
254 1.14 dholland
255 1.14 dholland for (dl = dla; dl->dl_next != NULL; dl = dl->dl_next)
256 1.14 dholland ;
257 1.14 dholland
258 1.14 dholland dl->dl_next = dlb;
259 1.14 dholland return dla;
260 1.14 dholland }
261 1.14 dholland
262 1.14 dholland /*
263 1.13 dholland * Locator lists
264 1.13 dholland */
265 1.13 dholland
266 1.13 dholland struct loclist *
267 1.13 dholland loclist_create(const char *name, const char *string, long long num)
268 1.13 dholland {
269 1.13 dholland struct loclist *ll;
270 1.13 dholland
271 1.13 dholland ll = emalloc(sizeof(*ll));
272 1.13 dholland ll->ll_name = name;
273 1.13 dholland ll->ll_string = string;
274 1.13 dholland ll->ll_num = num;
275 1.13 dholland ll->ll_next = NULL;
276 1.13 dholland return ll;
277 1.13 dholland }
278 1.13 dholland
279 1.13 dholland void
280 1.13 dholland loclist_destroy(struct loclist *ll)
281 1.13 dholland {
282 1.13 dholland struct loclist *next;
283 1.13 dholland
284 1.13 dholland while (ll != NULL) {
285 1.13 dholland next = ll->ll_next;
286 1.13 dholland ll->ll_next = NULL;
287 1.13 dholland free(ll);
288 1.13 dholland ll = next;
289 1.13 dholland }
290 1.13 dholland }
291 1.13 dholland
292 1.13 dholland /*
293 1.12 dholland * Attribute lists
294 1.12 dholland */
295 1.12 dholland
296 1.10 dholland struct attrlist *
297 1.10 dholland attrlist_create(void)
298 1.10 dholland {
299 1.10 dholland struct attrlist *al;
300 1.10 dholland
301 1.10 dholland al = emalloc(sizeof(*al));
302 1.10 dholland al->al_next = NULL;
303 1.10 dholland al->al_this = NULL;
304 1.10 dholland return al;
305 1.10 dholland }
306 1.10 dholland
307 1.10 dholland struct attrlist *
308 1.10 dholland attrlist_cons(struct attrlist *next, struct attr *a)
309 1.10 dholland {
310 1.10 dholland struct attrlist *al;
311 1.10 dholland
312 1.10 dholland al = attrlist_create();
313 1.10 dholland al->al_next = next;
314 1.10 dholland al->al_this = a;
315 1.10 dholland return al;
316 1.10 dholland }
317 1.10 dholland
318 1.10 dholland void
319 1.10 dholland attrlist_destroy(struct attrlist *al)
320 1.10 dholland {
321 1.10 dholland assert(al->al_next == NULL);
322 1.10 dholland assert(al->al_this == NULL);
323 1.10 dholland free(al);
324 1.10 dholland }
325 1.10 dholland
326 1.10 dholland void
327 1.10 dholland attrlist_destroyall(struct attrlist *al)
328 1.10 dholland {
329 1.10 dholland struct attrlist *next;
330 1.10 dholland
331 1.10 dholland while (al != NULL) {
332 1.10 dholland next = al->al_next;
333 1.10 dholland al->al_next = NULL;
334 1.10 dholland /* XXX should we make the caller guarantee this? */
335 1.10 dholland al->al_this = NULL;
336 1.10 dholland attrlist_destroy(al);
337 1.10 dholland al = next;
338 1.10 dholland }
339 1.10 dholland }
340 1.10 dholland
341 1.11 dholland /*
342 1.12 dholland * Condition expressions
343 1.12 dholland */
344 1.12 dholland
345 1.12 dholland /*
346 1.11 dholland * Create an expression node.
347 1.11 dholland */
348 1.11 dholland struct condexpr *
349 1.11 dholland condexpr_create(enum condexpr_types type)
350 1.11 dholland {
351 1.11 dholland struct condexpr *cx;
352 1.11 dholland
353 1.11 dholland cx = emalloc(sizeof(*cx));
354 1.11 dholland cx->cx_type = type;
355 1.11 dholland switch (type) {
356 1.11 dholland
357 1.11 dholland case CX_ATOM:
358 1.11 dholland cx->cx_atom = NULL;
359 1.11 dholland break;
360 1.11 dholland
361 1.11 dholland case CX_NOT:
362 1.11 dholland cx->cx_not = NULL;
363 1.11 dholland break;
364 1.11 dholland
365 1.11 dholland case CX_AND:
366 1.11 dholland cx->cx_and.left = NULL;
367 1.11 dholland cx->cx_and.right = NULL;
368 1.11 dholland break;
369 1.11 dholland
370 1.11 dholland case CX_OR:
371 1.11 dholland cx->cx_or.left = NULL;
372 1.11 dholland cx->cx_or.right = NULL;
373 1.11 dholland break;
374 1.11 dholland
375 1.11 dholland default:
376 1.11 dholland panic("condexpr_create: invalid expr type %d", (int)type);
377 1.11 dholland }
378 1.11 dholland return cx;
379 1.11 dholland }
380 1.11 dholland
381 1.11 dholland /*
382 1.11 dholland * Free an expression tree.
383 1.11 dholland */
384 1.11 dholland void
385 1.11 dholland condexpr_destroy(struct condexpr *expr)
386 1.11 dholland {
387 1.11 dholland switch (expr->cx_type) {
388 1.11 dholland
389 1.11 dholland case CX_ATOM:
390 1.11 dholland /* nothing */
391 1.11 dholland break;
392 1.11 dholland
393 1.11 dholland case CX_NOT:
394 1.11 dholland condexpr_destroy(expr->cx_not);
395 1.11 dholland break;
396 1.11 dholland
397 1.11 dholland case CX_AND:
398 1.11 dholland condexpr_destroy(expr->cx_and.left);
399 1.11 dholland condexpr_destroy(expr->cx_and.right);
400 1.11 dholland break;
401 1.11 dholland
402 1.11 dholland case CX_OR:
403 1.11 dholland condexpr_destroy(expr->cx_or.left);
404 1.11 dholland condexpr_destroy(expr->cx_or.right);
405 1.11 dholland break;
406 1.11 dholland
407 1.11 dholland default:
408 1.11 dholland panic("condexpr_destroy: invalid expr type %d",
409 1.11 dholland (int)expr->cx_type);
410 1.11 dholland }
411 1.11 dholland free(expr);
412 1.11 dholland }
413 1.11 dholland
414 1.12 dholland /************************************************************/
415 1.12 dholland
416 1.12 dholland /*
417 1.12 dholland * Diagnostic messages
418 1.12 dholland */
419 1.12 dholland
420 1.17 uebayasi #ifndef MAKE_BOOTSTRAP
421 1.17 uebayasi void
422 1.17 uebayasi cfgdbg(const char *fmt, ...)
423 1.17 uebayasi {
424 1.17 uebayasi va_list ap;
425 1.17 uebayasi extern const char *yyfile;
426 1.17 uebayasi
427 1.17 uebayasi va_start(ap, fmt);
428 1.17 uebayasi cfgvxdbg(yyfile, currentline(), fmt, ap);
429 1.17 uebayasi va_end(ap);
430 1.17 uebayasi }
431 1.17 uebayasi #endif
432 1.17 uebayasi
433 1.1 thorpej void
434 1.6 christos cfgwarn(const char *fmt, ...)
435 1.1 thorpej {
436 1.1 thorpej va_list ap;
437 1.1 thorpej extern const char *yyfile;
438 1.1 thorpej
439 1.1 thorpej va_start(ap, fmt);
440 1.6 christos cfgvxwarn(yyfile, currentline(), fmt, ap);
441 1.1 thorpej va_end(ap);
442 1.1 thorpej }
443 1.1 thorpej
444 1.2 cube void
445 1.6 christos cfgxwarn(const char *file, int line, const char *fmt, ...)
446 1.2 cube {
447 1.2 cube va_list ap;
448 1.2 cube
449 1.2 cube va_start(ap, fmt);
450 1.6 christos cfgvxwarn(file, line, fmt, ap);
451 1.2 cube va_end(ap);
452 1.2 cube }
453 1.1 thorpej
454 1.17 uebayasi #ifndef MAKE_BOOTSTRAP
455 1.17 uebayasi static void
456 1.17 uebayasi cfgvxdbg(const char *file, int line, const char *fmt, va_list ap)
457 1.17 uebayasi {
458 1.17 uebayasi cfgvxmsg(file, line, "debug: ", fmt, ap);
459 1.17 uebayasi }
460 1.17 uebayasi #endif
461 1.17 uebayasi
462 1.1 thorpej static void
463 1.6 christos cfgvxwarn(const char *file, int line, const char *fmt, va_list ap)
464 1.1 thorpej {
465 1.6 christos cfgvxmsg(file, line, "warning: ", fmt, ap);
466 1.1 thorpej }
467 1.1 thorpej
468 1.1 thorpej /*
469 1.1 thorpej * External (config file) error. Complain, using current file
470 1.1 thorpej * and line number.
471 1.1 thorpej */
472 1.1 thorpej void
473 1.6 christos cfgerror(const char *fmt, ...)
474 1.1 thorpej {
475 1.1 thorpej va_list ap;
476 1.1 thorpej extern const char *yyfile;
477 1.1 thorpej
478 1.1 thorpej va_start(ap, fmt);
479 1.6 christos cfgvxerror(yyfile, currentline(), fmt, ap);
480 1.1 thorpej va_end(ap);
481 1.1 thorpej }
482 1.1 thorpej
483 1.1 thorpej /*
484 1.1 thorpej * Delayed config file error (i.e., something was wrong but we could not
485 1.1 thorpej * find out about it until later).
486 1.1 thorpej */
487 1.1 thorpej void
488 1.6 christos cfgxerror(const char *file, int line, const char *fmt, ...)
489 1.1 thorpej {
490 1.1 thorpej va_list ap;
491 1.1 thorpej
492 1.1 thorpej va_start(ap, fmt);
493 1.6 christos cfgvxerror(file, line, fmt, ap);
494 1.1 thorpej va_end(ap);
495 1.1 thorpej }
496 1.1 thorpej
497 1.1 thorpej /*
498 1.1 thorpej * Internal form of error() and xerror().
499 1.1 thorpej */
500 1.1 thorpej static void
501 1.6 christos cfgvxerror(const char *file, int line, const char *fmt, va_list ap)
502 1.1 thorpej {
503 1.6 christos cfgvxmsg(file, line, "", fmt, ap);
504 1.1 thorpej errors++;
505 1.1 thorpej }
506 1.1 thorpej
507 1.1 thorpej
508 1.1 thorpej /*
509 1.1 thorpej * Internal error, abort.
510 1.1 thorpej */
511 1.1 thorpej __dead void
512 1.1 thorpej panic(const char *fmt, ...)
513 1.1 thorpej {
514 1.1 thorpej va_list ap;
515 1.1 thorpej
516 1.1 thorpej va_start(ap, fmt);
517 1.6 christos (void)fprintf(stderr, "%s: panic: ", getprogname());
518 1.1 thorpej (void)vfprintf(stderr, fmt, ap);
519 1.1 thorpej (void)putc('\n', stderr);
520 1.1 thorpej va_end(ap);
521 1.1 thorpej exit(2);
522 1.1 thorpej }
523 1.1 thorpej
524 1.1 thorpej /*
525 1.1 thorpej * Internal form of error() and xerror().
526 1.1 thorpej */
527 1.1 thorpej static void
528 1.6 christos cfgvxmsg(const char *file, int line, const char *msgclass, const char *fmt,
529 1.1 thorpej va_list ap)
530 1.1 thorpej {
531 1.1 thorpej
532 1.16 christos (void)fprintf(stderr, "%s:%d: %s", file, line, msgclass);
533 1.1 thorpej (void)vfprintf(stderr, fmt, ap);
534 1.1 thorpej (void)putc('\n', stderr);
535 1.1 thorpej }
536 1.7 lukem
537 1.7 lukem void
538 1.7 lukem autogen_comment(FILE *fp, const char *targetfile)
539 1.7 lukem {
540 1.7 lukem
541 1.7 lukem (void)fprintf(fp,
542 1.7 lukem "/*\n"
543 1.7 lukem " * MACHINE GENERATED: DO NOT EDIT\n"
544 1.7 lukem " *\n"
545 1.7 lukem " * %s, from \"%s\"\n"
546 1.7 lukem " */\n\n",
547 1.7 lukem targetfile, conffile);
548 1.7 lukem }
549