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