/[MITgcm]/MITgcm/tools/cyrus-imapd-makedepend/main.c
ViewVC logotype

Contents of /MITgcm/tools/cyrus-imapd-makedepend/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Fri Feb 25 16:19:32 2005 UTC (19 years, 1 month ago) by edhill
Branch: MAIN
CVS Tags: checkpoint58l_post, checkpoint57t_post, checkpoint57o_post, checkpoint58e_post, mitgcm_mapl_00, checkpoint58u_post, checkpoint58w_post, checkpoint57m_post, checkpoint57s_post, checkpoint57k_post, checkpoint57g_post, checkpoint60, checkpoint61, checkpoint58r_post, checkpoint57i_post, checkpoint57y_post, checkpoint57e_post, checkpoint58n_post, checkpoint58x_post, checkpoint57g_pre, checkpoint58t_post, checkpoint58h_post, checkpoint57y_pre, checkpoint57f_pre, checkpoint58q_post, checkpoint57v_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint58j_post, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint59j, checkpoint57r_post, checkpoint59, checkpoint58, eckpoint57e_pre, checkpoint57h_done, checkpoint58f_post, checkpoint57x_post, checkpoint57n_post, checkpoint58d_post, checkpoint58c_post, checkpoint57w_post, checkpoint57p_post, checkpint57u_post, checkpoint57f_post, checkpoint58a_post, checkpoint58i_post, checkpoint57q_post, checkpoint58g_post, checkpoint58o_post, checkpoint57z_post, checkpoint58y_post, checkpoint58k_post, checkpoint58v_post, checkpoint58s_post, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint58p_post, checkpoint61a, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint57j_post, checkpoint58b_post, checkpoint57h_pre, checkpoint58m_post, checkpoint57l_post, checkpoint57h_post
Changes since 1.1: +4 -0 lines
File MIME type: text/plain
 o fix for SPARC systems

1 /* $XConsortium: main.c,v 1.83 94/04/17 20:10:36 gildea Exp $ */
2 /*
3 * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. The name "Carnegie Mellon University" must not be used to
18 * endorse or promote products derived from this software without
19 * prior written permission. For permission or any other legal
20 * details, please contact
21 * Office of Technology Transfer
22 * Carnegie Mellon University
23 * 5000 Forbes Avenue
24 * Pittsburgh, PA 15213-3890
25 * (412) 268-4387, fax: (412) 268-7395
26 * tech-transfer@andrew.cmu.edu
27 *
28 * 4. Redistributions of any form whatsoever must retain the following
29 * acknowledgment:
30 * "This product includes software developed by Computing Services
31 * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
32 *
33 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
34 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
35 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
36 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
37 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
38 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
39 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
40 *
41 */
42
43 /*
44
45 Copyright (c) 1993, 1994 X Consortium
46
47 Permission is hereby granted, free of charge, to any person obtaining a copy
48 of this software and associated documentation files (the "Software"), to deal
49 in the Software without restriction, including without limitation the rights
50 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
51 copies of the Software, and to permit persons to whom the Software is
52 furnished to do so, subject to the following conditions:
53
54 The above copyright notice and this permission notice shall be included in
55 all copies or substantial portions of the Software.
56
57 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
61 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
62 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
63
64 Except as contained in this notice, the name of the X Consortium shall not be
65 used in advertising or otherwise to promote the sale, use or other dealings
66 in this Software without prior written authorization from the X Consortium.
67
68 */
69
70 #include "def.h"
71 #ifdef hpux
72 #define sigvec sigvector
73 #endif /* hpux */
74
75 #include <signal.h>
76
77 #ifdef HAVE_STDARG_H /* NeedVarargsPrototypes */
78 #include <stdarg.h>
79 #endif
80
81 #ifdef DEBUG
82 int _debugmask;
83 #endif
84
85 char *ProgramName;
86
87 char *directives[] = {
88 "if",
89 "ifdef",
90 "ifndef",
91 "else",
92 "endif",
93 "define",
94 "undef",
95 "include",
96 "line",
97 "pragma",
98 "error",
99 "ident",
100 "sccs",
101 "elif",
102 "eject",
103 NULL
104 };
105
106 struct symtab predefs[] = {
107 #ifdef apollo
108 {"apollo", "1"},
109 #endif
110 #ifdef ibm032
111 {"ibm032", "1"},
112 #endif
113 #ifdef sun
114 {"sun", "1"},
115 #ifdef sparc
116 {"sparc", "1"},
117 #endif
118 #endif
119 #ifdef solaris20
120 {"solaris20", "1"},
121 #endif
122 #ifdef __i386
123 {"__i386", "1"},
124 #endif
125 #ifdef hpux
126 {"hpux", "1"},
127 #endif
128 #ifdef vax
129 {"vax", "1"},
130 #endif
131 #ifdef VMS
132 {"VMS", "1"},
133 #endif
134 #ifdef ultrix
135 {"ultrix", "1"},
136 #endif
137 #ifdef mips
138 {"mips", "1"},
139 #endif
140 #ifdef __SCO__
141 {"__SCO__", "1"},
142 #endif
143 #ifdef __DGUX
144 {"__DGUX", "1"},
145 #endif
146 #ifdef __DGUX__
147 {"__DGUX__", "1"},
148 #endif
149 #ifdef __m88k__
150 {"__m88k__", "1"},
151 #endif
152 {NULL, NULL}
153 };
154 #define OBJSUFFIX ".o"
155 #define INCLUDEDIR "/usr/include"
156
157 struct inclist inclist[ MAXFILES ],
158 *inclistp = inclist,
159 maininclist;
160
161 char *filelist[ MAXFILES ];
162 char *includedirs[ MAXDIRS + 1 ];
163 char *notdotdot[ MAXDIRS ];
164 char *objprefix = "";
165 char *objsuffix = OBJSUFFIX;
166 char *startat = "# DO NOT DELETE";
167 int width = 78;
168 boolean append = FALSE;
169 boolean printed = FALSE;
170 boolean verbose = FALSE;
171 boolean show_where_not = FALSE;
172 boolean warn_multiple = FALSE; /* Warn on multiple includes of same file */
173
174 static
175 #ifdef SIGNALRETURNSINT
176 int
177 #else
178 void
179 #endif
180 catch (sig)
181 int sig;
182 {
183 fflush (stdout);
184 fatalerr ("got signal %d\n", sig);
185 }
186
187 #if defined(USG) || (defined(SYSV386) && defined(SYSV)) || defined(WIN32) || defined(__i386)
188 #define USGISH
189 #endif
190
191 #ifdef sparc
192 #define USGISH
193 #endif
194
195 #ifndef USGISH
196 #ifndef _POSIX_SOURCE
197 #define sigaction sigvec
198 #define sa_handler sv_handler
199 #define sa_mask sv_mask
200 #define sa_flags sv_flags
201 #endif
202 struct sigaction sig_act;
203 #endif /* USGISH */
204
205 main(argc, argv)
206 int argc;
207 char **argv;
208 {
209 register char **fp = filelist;
210 register char **incp = includedirs;
211 register char *p;
212 register struct inclist *ip;
213 char *makefile = NULL;
214 struct filepointer *filecontent;
215 struct symtab *psymp = predefs;
216 char *endmarker = NULL;
217 char *defincdir = NULL;
218
219 ProgramName = argv[0];
220
221 while (psymp->s_name)
222 {
223 define2(psymp->s_name, psymp->s_value, &maininclist);
224 psymp++;
225 }
226 if (argc == 2 && argv[1][0] == '@') {
227 struct stat ast;
228 int afd;
229 char *args;
230 char **nargv;
231 int nargc;
232 char quotechar = '\0';
233
234 nargc = 1;
235 if ((afd = open(argv[1]+1, O_RDONLY)) < 0)
236 fatalerr("cannot open \"%s\"\n", argv[1]+1);
237 fstat(afd, &ast);
238 args = (char *)malloc(ast.st_size + 1);
239 if ((ast.st_size = read(afd, args, ast.st_size)) < 0)
240 fatalerr("failed to read %s\n", argv[1]+1);
241 args[ast.st_size] = '\0';
242 close(afd);
243 for (p = args; *p; p++) {
244 if (quotechar) {
245 if (quotechar == '\\' ||
246 (*p == quotechar && p[-1] != '\\'))
247 quotechar = '\0';
248 continue;
249 }
250 switch (*p) {
251 case '\\':
252 case '"':
253 case '\'':
254 quotechar = *p;
255 break;
256 case ' ':
257 case '\n':
258 *p = '\0';
259 if (p > args && p[-1])
260 nargc++;
261 break;
262 }
263 }
264 if (p[-1])
265 nargc++;
266 nargv = (char **)malloc(nargc * sizeof(char *));
267 nargv[0] = argv[0];
268 argc = 1;
269 for (p = args; argc < nargc; p += strlen(p) + 1)
270 if (*p) nargv[argc++] = p;
271 argv = nargv;
272 }
273 for(argc--, argv++; argc; argc--, argv++) {
274 /* if looking for endmarker then check before parsing */
275 if (endmarker && strcmp (endmarker, *argv) == 0) {
276 endmarker = NULL;
277 continue;
278 }
279 if (**argv != '-') {
280 /* treat +thing as an option for C++ */
281 if (endmarker && **argv == '+')
282 continue;
283 *fp++ = argv[0];
284 continue;
285 }
286 switch(argv[0][1]) {
287 case '-':
288 endmarker = &argv[0][2];
289 if (endmarker[0] == '\0') endmarker = "--";
290 break;
291 case 'D':
292 if (argv[0][2] == '\0') {
293 argv++;
294 argc--;
295 }
296 for (p=argv[0] + 2; *p ; p++)
297 if (*p == '=') {
298 *p = ' ';
299 break;
300 }
301 define(argv[0] + 2, &maininclist);
302 break;
303 case 'I':
304 if (incp >= includedirs + MAXDIRS)
305 fatalerr("Too many -I flags.\n");
306 *incp++ = argv[0]+2;
307 if (**(incp-1) == '\0') {
308 *(incp-1) = *(++argv);
309 argc--;
310 }
311 break;
312 case 'Y':
313 defincdir = argv[0]+2;
314 break;
315 /* do not use if endmarker processing */
316 case 'a':
317 if (endmarker) break;
318 append = TRUE;
319 break;
320 case 'w':
321 if (endmarker) break;
322 if (argv[0][2] == '\0') {
323 argv++;
324 argc--;
325 width = atoi(argv[0]);
326 } else
327 width = atoi(argv[0]+2);
328 break;
329 case 'o':
330 if (endmarker) break;
331 if (argv[0][2] == '\0') {
332 argv++;
333 argc--;
334 objsuffix = argv[0];
335 } else
336 objsuffix = argv[0]+2;
337 break;
338 case 'p':
339 if (endmarker) break;
340 if (argv[0][2] == '\0') {
341 argv++;
342 argc--;
343 objprefix = argv[0];
344 } else
345 objprefix = argv[0]+2;
346 break;
347 case 'v':
348 if (endmarker) break;
349 verbose = TRUE;
350 #ifdef DEBUG
351 if (argv[0][2])
352 _debugmask = atoi(argv[0]+2);
353 #endif
354 break;
355 case 's':
356 if (endmarker) break;
357 startat = argv[0]+2;
358 if (*startat == '\0') {
359 startat = *(++argv);
360 argc--;
361 }
362 if (*startat != '#')
363 fatalerr("-s flag's value should start %s\n",
364 "with '#'.");
365 break;
366 case 'f':
367 if (endmarker) break;
368 makefile = argv[0]+2;
369 if (*makefile == '\0') {
370 makefile = *(++argv);
371 argc--;
372 }
373 break;
374
375 case 'm':
376 warn_multiple = TRUE;
377 break;
378
379 /* Ignore -O, -g so we can just pass ${CFLAGS} to
380 makedepend
381 */
382 case 'O':
383 case 'g':
384 break;
385 default:
386 if (endmarker) break;
387 /* fatalerr("unknown opt = %s\n", argv[0]); */
388 warning("ignoring option %s\n", argv[0]);
389 }
390 }
391 if (!defincdir) {
392 #ifdef PREINCDIR
393 if (incp >= includedirs + MAXDIRS)
394 fatalerr("Too many -I flags.\n");
395 *incp++ = PREINCDIR;
396 #endif
397 if (incp >= includedirs + MAXDIRS)
398 fatalerr("Too many -I flags.\n");
399 *incp++ = INCLUDEDIR;
400 #ifdef POSTINCDIR
401 if (incp >= includedirs + MAXDIRS)
402 fatalerr("Too many -I flags.\n");
403 *incp++ = POSTINCDIR;
404 #endif
405 } else if (*defincdir) {
406 if (incp >= includedirs + MAXDIRS)
407 fatalerr("Too many -I flags.\n");
408 *incp++ = defincdir;
409 }
410
411 redirect(startat, makefile);
412
413 /*
414 * catch signals.
415 */
416 #ifdef USGISH
417 /* should really reset SIGINT to SIG_IGN if it was. */
418 #ifdef SIGHUP
419 signal (SIGHUP, catch);
420 #endif
421 signal (SIGINT, catch);
422 #ifdef SIGQUIT
423 signal (SIGQUIT, catch);
424 #endif
425 signal (SIGILL, catch);
426 #ifdef SIGBUS
427 signal (SIGBUS, catch);
428 #endif
429 signal (SIGSEGV, catch);
430 #ifdef SIGSYS
431 signal (SIGSYS, catch);
432 #endif
433 #else
434 sig_act.sa_handler = catch;
435 #ifdef _POSIX_SOURCE
436 sigemptyset(&sig_act.sa_mask);
437 sigaddset(&sig_act.sa_mask, SIGINT);
438 sigaddset(&sig_act.sa_mask, SIGQUIT);
439 #ifdef SIGBUS
440 sigaddset(&sig_act.sa_mask, SIGBUS);
441 #endif
442 sigaddset(&sig_act.sa_mask, SIGILL);
443 sigaddset(&sig_act.sa_mask, SIGSEGV);
444 sigaddset(&sig_act.sa_mask, SIGHUP);
445 sigaddset(&sig_act.sa_mask, SIGPIPE);
446 #ifdef SIGSYS
447 sigaddset(&sig_act.sa_mask, SIGSYS);
448 #endif
449 #else
450 sig_act.sa_mask = ((1<<(SIGINT -1))
451 |(1<<(SIGQUIT-1))
452 #ifdef SIGBUS
453 |(1<<(SIGBUS-1))
454 #endif
455 |(1<<(SIGILL-1))
456 |(1<<(SIGSEGV-1))
457 |(1<<(SIGHUP-1))
458 |(1<<(SIGPIPE-1))
459 #ifdef SIGSYS
460 |(1<<(SIGSYS-1))
461 #endif
462 );
463 #endif /* _POSIX_SOURCE */
464 sig_act.sa_flags = 0;
465 sigaction(SIGHUP, &sig_act, (struct sigaction *)0);
466 sigaction(SIGINT, &sig_act, (struct sigaction *)0);
467 sigaction(SIGQUIT, &sig_act, (struct sigaction *)0);
468 sigaction(SIGILL, &sig_act, (struct sigaction *)0);
469 #ifdef SIGBUS
470 sigaction(SIGBUS, &sig_act, (struct sigaction *)0);
471 #endif
472 sigaction(SIGSEGV, &sig_act, (struct sigaction *)0);
473 #ifdef SIGSYS
474 sigaction(SIGSYS, &sig_act, (struct sigaction *)0);
475 #endif
476 #endif /* USGISH */
477
478 /*
479 * now peruse through the list of files.
480 */
481 for(fp=filelist; *fp; fp++) {
482 filecontent = getfile(*fp);
483 ip = newinclude(*fp, (char *)NULL);
484
485 find_includes(filecontent, ip, ip, 0, FALSE);
486 freefile(filecontent);
487 recursive_pr_include(ip, ip->i_file, base_name(*fp));
488 inc_clean();
489 }
490 if (printed)
491 printf("\n");
492 exit(0);
493 }
494
495 struct filepointer *getfile(file)
496 char *file;
497 {
498 register int fd;
499 struct filepointer *content;
500 struct stat st;
501
502 content = (struct filepointer *)malloc(sizeof(struct filepointer));
503 if ((fd = open(file, O_RDONLY)) < 0) {
504 warning("cannot open \"%s\"\n", file);
505 content->f_p = content->f_base = content->f_end = (char *)malloc(1);
506 *content->f_p = '\0';
507 return(content);
508 }
509 fstat(fd, &st);
510 content->f_base = (char *)malloc(st.st_size+1);
511 if (content->f_base == NULL)
512 fatalerr("cannot allocate mem\n");
513 if ((st.st_size = read(fd, content->f_base, st.st_size)) < 0)
514 fatalerr("failed to read %s\n", file);
515 close(fd);
516 content->f_len = st.st_size+1;
517 content->f_p = content->f_base;
518 content->f_end = content->f_base + st.st_size;
519 *content->f_end = '\0';
520 content->f_line = 0;
521 return(content);
522 }
523
524 freefile(fp)
525 struct filepointer *fp;
526 {
527 free(fp->f_base);
528 free(fp);
529 }
530
531 char *copy(str)
532 register char *str;
533 {
534 register char *p = (char *)malloc(strlen(str) + 1);
535
536 strcpy(p, str);
537 return(p);
538 }
539
540 match(str, list)
541 register char *str, **list;
542 {
543 register int i;
544
545 for (i=0; *list; i++, list++)
546 if (strcmp(str, *list) == 0)
547 return(i);
548 return(-1);
549 }
550
551 /*
552 * Get the next line. We only return lines beginning with '#' since that
553 * is all this program is ever interested in.
554 */
555 char *getline(filep)
556 register struct filepointer *filep;
557 {
558 register char *p, /* walking pointer */
559 *eof, /* end of file pointer */
560 *bol; /* beginning of line pointer */
561 register lineno; /* line number */
562
563 p = filep->f_p;
564 eof = filep->f_end;
565 if (p >= eof)
566 return((char *)NULL);
567 lineno = filep->f_line;
568
569 for(bol = p--; ++p < eof; ) {
570 if (*p == '/' && *(p+1) == '*') { /* consume comments */
571 *p++ = ' ', *p++ = ' ';
572 while (*p) {
573 if (*p == '*' && *(p+1) == '/') {
574 *p++ = ' ', *p = ' ';
575 break;
576 }
577 else if (*p == '\n')
578 lineno++;
579 *p++ = ' ';
580 }
581 continue;
582 }
583 #ifdef WIN32
584 else if (*p == '/' && *(p+1) == '/') { /* consume comments */
585 *p++ = ' ', *p++ = ' ';
586 while (*p && *p != '\n')
587 *p++ = ' ';
588 lineno++;
589 continue;
590 }
591 #endif
592 else if (*p == '\\') {
593 if (*(p+1) == '\n') {
594 *p = ' ';
595 *(p+1) = ' ';
596 lineno++;
597 }
598 }
599 else if (*p == '\n') {
600 lineno++;
601 if (*bol == '#') {
602 register char *cp;
603
604 *p++ = '\0';
605 /* punt lines with just # (yacc generated) */
606 for (cp = bol+1;
607 *cp && (*cp == ' ' || *cp == '\t'); cp++);
608 if (*cp) goto done;
609 }
610 bol = p+1;
611 }
612 }
613 if (*bol != '#')
614 bol = NULL;
615 done:
616 filep->f_p = p;
617 filep->f_line = lineno;
618 return(bol);
619 }
620
621 /*
622 * Strip the file name down to what we want to see in the Makefile.
623 * It will have objprefix and objsuffix around it.
624 */
625 char *base_name(file)
626 register char *file;
627 {
628 register char *p;
629
630 file = copy(file);
631 for(p=file+strlen(file); p>file && *p != '.'; p--) ;
632
633 if (*p == '.')
634 *p = '\0';
635 return(file);
636 }
637
638 #if defined(USG) && !defined(CRAY) && !defined(SVR4)
639 int rename (from, to)
640 char *from, *to;
641 {
642 (void) unlink (to);
643 if (link (from, to) == 0) {
644 unlink (from);
645 return 0;
646 } else {
647 return -1;
648 }
649 }
650 #endif /* USGISH */
651
652 redirect(line, makefile)
653 char *line,
654 *makefile;
655 {
656 struct stat st;
657 FILE *fdin, *fdout;
658 char backup[ BUFSIZ ],
659 buf[ BUFSIZ ];
660 boolean found = FALSE;
661 int len;
662
663 /*
664 * if makefile is "-" then let it pour onto stdout.
665 */
666 if (makefile && *makefile == '-' && *(makefile+1) == '\0')
667 return;
668
669 /*
670 * use a default makefile is not specified.
671 */
672 if (!makefile) {
673 if (stat("Makefile", &st) == 0)
674 makefile = "Makefile";
675 else if (stat("makefile", &st) == 0)
676 makefile = "makefile";
677 else
678 fatalerr("[mM]akefile is not present\n");
679 }
680 else
681 stat(makefile, &st);
682 if ((fdin = fopen(makefile, "r")) == NULL)
683 fatalerr("cannot open \"%s\"\n", makefile);
684 sprintf(backup, "%s.bak", makefile);
685 unlink(backup);
686 #ifdef WIN32
687 fclose(fdin);
688 #endif
689 if (rename(makefile, backup) < 0)
690 fatalerr("cannot rename %s to %s\n", makefile, backup);
691 #ifdef WIN32
692 if ((fdin = fopen(backup, "r")) == NULL)
693 fatalerr("cannot open \"%s\"\n", backup);
694 #endif
695 if ((fdout = freopen(makefile, "w", stdout)) == NULL)
696 fatalerr("cannot open \"%s\"\n", backup);
697 len = strlen(line);
698 while (!found && fgets(buf, BUFSIZ, fdin)) {
699 if (*buf == '#' && strncmp(line, buf, len) == 0)
700 found = TRUE;
701 fputs(buf, fdout);
702 }
703 if (!found) {
704 if (verbose)
705 warning("Adding new delimiting line \"%s\" and dependencies...\n",
706 line);
707 puts(line); /* same as fputs(fdout); but with newline */
708 } else if (append) {
709 while (fgets(buf, BUFSIZ, fdin)) {
710 fputs(buf, fdout);
711 }
712 }
713 fflush(fdout);
714 #if defined(USGISH) || defined(_SEQUENT_)
715 chmod(makefile, st.st_mode);
716 #else
717 fchmod(fileno(fdout), st.st_mode);
718 #endif /* USGISH */
719 }
720
721 #ifdef HAVE_STDARG_H /* NeedVarargsPrototypes */
722 fatalerr(char *msg, ...)
723 #else
724 /*VARARGS*/
725 fatalerr(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
726 char *msg;
727 #endif
728 {
729 #ifdef HAVE_STDARG_H /* NeedVarargsPrototypes */
730 va_list args;
731 #endif
732 fprintf(stderr, "%s: error: ", ProgramName);
733 #ifdef HAVE_STDARG_H /* NeedVarargsPrototypes */
734 va_start(args, msg);
735 vfprintf(stderr, msg, args);
736 va_end(args);
737 #else
738 fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
739 #endif
740 exit (1);
741 }
742
743 #ifdef HAVE_STDARG_H /* NeedVarargsPrototypes */
744 warning(char *msg, ...)
745 #else
746 /*VARARGS0*/
747 warning(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
748 char *msg;
749 #endif
750 {
751 #ifdef HAVE_STDARG_H /* NeedVarargsPrototypes */
752 va_list args;
753 #endif
754 fprintf(stderr, "%s: warning: ", ProgramName);
755 #ifdef HAVE_STDARG_H /* NeedVarargsPrototypes */
756 va_start(args, msg);
757 vfprintf(stderr, msg, args);
758 va_end(args);
759 #else
760 fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
761 #endif
762 }
763
764 #ifdef HAVE_STDARG_H /* NeedVarargsPrototypes */
765 warning1(char *msg, ...)
766 #else
767 /*VARARGS0*/
768 warning1(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
769 char *msg;
770 #endif
771 {
772 #ifdef HAVE_STDARG_H /* NeedVarargsPrototypes */
773 va_list args;
774 va_start(args, msg);
775 vfprintf(stderr, msg, args);
776 va_end(args);
777 #else
778 fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
779 #endif
780 }

  ViewVC Help
Powered by ViewVC 1.1.22