home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / config / mkdepend / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  15.8 KB  |  711 lines

  1. /* $XConsortium: main.c,v 1.84 94/11/30 16:10:44 kaleb Exp $ */
  2. /* $XFree86: xc/config/makedepend/main.c,v 3.4 1995/07/15 14:53:49 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.     NULL
  80. };
  81.  
  82. #define MAKEDEPEND
  83. #include "imakemdep.h"    /* from config sources */
  84. #undef MAKEDEPEND
  85.  
  86. struct    inclist inclist[ MAXFILES ],
  87.         *inclistp = inclist,
  88.         maininclist;
  89.  
  90. char    *filelist[ MAXFILES ];
  91. char    *includedirs[ MAXDIRS + 1 ];
  92. char    *notdotdot[ MAXDIRS ];
  93. char    *objprefix = "";
  94. char    *objsuffix = OBJSUFFIX;
  95. char    *startat = "# DO NOT DELETE";
  96. int    width = 78;
  97. boolean    append = FALSE;
  98. boolean    printed = FALSE;
  99. boolean    verbose = FALSE;
  100. boolean    show_where_not = FALSE;
  101. boolean warn_multiple = FALSE;    /* Warn on multiple includes of same file */
  102.  
  103. static
  104. #ifdef SIGNALRETURNSINT
  105. int
  106. #else
  107. void
  108. #endif
  109. catch (sig)
  110.     int sig;
  111. {
  112.     fflush (stdout);
  113.     fatalerr ("got signal %d\n", sig);
  114. }
  115.  
  116. #if defined(USG) || (defined(i386) && defined(SYSV)) || defined(WIN32) || defined(__EMX__) || defined(Lynx_22)
  117. #define USGISH
  118. #endif
  119.  
  120. #ifndef USGISH
  121. #ifndef _POSIX_SOURCE
  122. #define sigaction sigvec
  123. #define sa_handler sv_handler
  124. #define sa_mask sv_mask
  125. #define sa_flags sv_flags
  126. #endif
  127. struct sigaction sig_act;
  128. #endif /* USGISH */
  129.  
  130. main(argc, argv)
  131.     int    argc;
  132.     char    **argv;
  133. {
  134.     register char    **fp = filelist;
  135.     register char    **incp = includedirs;
  136.     register char    *p;
  137.     register struct inclist    *ip;
  138.     char    *makefile = NULL;
  139.     struct filepointer    *filecontent;
  140.     struct symtab *psymp = predefs;
  141.     char *endmarker = NULL;
  142.     char *defincdir = NULL;
  143.  
  144.     ProgramName = argv[0];
  145.  
  146.     while (psymp->s_name)
  147.     {
  148.         define2(psymp->s_name, psymp->s_value, &maininclist);
  149.         psymp++;
  150.     }
  151.     if (argc == 2 && argv[1][0] == '@') {
  152.         struct stat ast;
  153.         int afd;
  154.         char *args;
  155.         char **nargv;
  156.         int nargc;
  157.         char quotechar = '\0';
  158.  
  159.         nargc = 1;
  160.         if ((afd = open(argv[1]+1, O_RDONLY)) < 0)
  161.         fatalerr("cannot open \"%s\"\n", argv[1]+1);
  162.         fstat(afd, &ast);
  163.         args = (char *)malloc(ast.st_size + 1);
  164.         if ((ast.st_size = read(afd, args, ast.st_size)) < 0)
  165.         fatalerr("failed to read %s\n", argv[1]+1);
  166.         args[ast.st_size] = '\0';
  167.         close(afd);
  168.         for (p = args; *p; p++) {
  169.         if (quotechar) {
  170.             if (quotechar == '\\' ||
  171.             (*p == quotechar && p[-1] != '\\'))
  172.             quotechar = '\0';
  173.             continue;
  174.         }
  175.         switch (*p) {
  176.         case '\\':
  177.         case '"':
  178.         case '\'':
  179.             quotechar = *p;
  180.             break;
  181.         case ' ':
  182.         case '\n':
  183.             *p = '\0';
  184.             if (p > args && p[-1])
  185.             nargc++;
  186.             break;
  187.         }
  188.         }
  189.         if (p[-1])
  190.         nargc++;
  191.         nargv = (char **)malloc(nargc * sizeof(char *));
  192.         nargv[0] = argv[0];
  193.         argc = 1;
  194.         for (p = args; argc < nargc; p += strlen(p) + 1)
  195.         if (*p) nargv[argc++] = p;
  196.         argv = nargv;
  197.     }
  198.     for(argc--, argv++; argc; argc--, argv++) {
  199.             /* if looking for endmarker then check before parsing */
  200.         if (endmarker && strcmp (endmarker, *argv) == 0) {
  201.             endmarker = NULL;
  202.             continue;
  203.         }
  204.         if (**argv != '-') {
  205.             /* treat +thing as an option for C++ */
  206.             if (endmarker && **argv == '+')
  207.                 continue;
  208.             *fp++ = argv[0];
  209.             continue;
  210.         }
  211.         switch(argv[0][1]) {
  212.         case '-':
  213.             endmarker = &argv[0][2];
  214.             if (endmarker[0] == '\0') endmarker = "--";
  215.             break;
  216.         case 'D':
  217.             if (argv[0][2] == '\0') {
  218.                 argv++;
  219.                 argc--;
  220.             }
  221.             for (p=argv[0] + 2; *p ; p++)
  222.                 if (*p == '=') {
  223.                     *p = ' ';
  224.                     break;
  225.                 }
  226.             define(argv[0] + 2, &maininclist);
  227.             break;
  228.         case 'I':
  229.             if (incp >= includedirs + MAXDIRS)
  230.                 fatalerr("Too many -I flags.\n");
  231.             *incp++ = argv[0]+2;
  232.             if (**(incp-1) == '\0') {
  233.                 *(incp-1) = *(++argv);
  234.                 argc--;
  235.             }
  236.             break;
  237.         case 'Y':
  238.             defincdir = argv[0]+2;
  239.             break;
  240.         /* do not use if endmarker processing */
  241.         case 'a':
  242.             if (endmarker) break;
  243.             append = TRUE;
  244.             break;
  245.         case 'w':
  246.             if (endmarker) break;
  247.             if (argv[0][2] == '\0') {
  248.                 argv++;
  249.                 argc--;
  250.                 width = atoi(argv[0]);
  251.             } else
  252.                 width = atoi(argv[0]+2);
  253.             break;
  254.         case 'o':
  255.             if (endmarker) break;
  256.             if (argv[0][2] == '\0') {
  257.                 argv++;
  258.                 argc--;
  259.                 objsuffix = argv[0];
  260.             } else
  261.                 objsuffix = argv[0]+2;
  262.             break;
  263.         case 'p':
  264.             if (endmarker) break;
  265.             if (argv[0][2] == '\0') {
  266.                 argv++;
  267.                 argc--;
  268.                 objprefix = argv[0];
  269.             } else
  270.                 objprefix = argv[0]+2;
  271.             break;
  272.         case 'v':
  273.             if (endmarker) break;
  274.             verbose = TRUE;
  275. #ifdef DEBUG
  276.             if (argv[0][2])
  277.                 _debugmask = atoi(argv[0]+2);
  278. #endif
  279.             break;
  280.         case 's':
  281.             if (endmarker) break;
  282.             startat = argv[0]+2;
  283.             if (*startat == '\0') {
  284.                 startat = *(++argv);
  285.                 argc--;
  286.             }
  287.             if (*startat != '#')
  288.                 fatalerr("-s flag's value should start %s\n",
  289.                     "with '#'.");
  290.             break;
  291.         case 'f':
  292.             if (endmarker) break;
  293.             makefile = argv[0]+2;
  294.             if (*makefile == '\0') {
  295.                 makefile = *(++argv);
  296.                 argc--;
  297.             }
  298.             break;
  299.  
  300.         case 'm':
  301.             warn_multiple = TRUE;
  302.             break;
  303.             
  304.         /* Ignore -O, -g so we can just pass ${CFLAGS} to
  305.            makedepend
  306.          */
  307.         case 'O':
  308.         case 'g':
  309.             break;
  310.         default:
  311.             if (endmarker) break;
  312.     /*        fatalerr("unknown opt = %s\n", argv[0]); */
  313.             warning("ignoring option %s\n", argv[0]);
  314.         }
  315.     }
  316.     if (!defincdir) {
  317. #ifdef PREINCDIR
  318.         if (incp >= includedirs + MAXDIRS)
  319.         fatalerr("Too many -I flags.\n");
  320.         *incp++ = PREINCDIR;
  321. #endif
  322.         if (incp >= includedirs + MAXDIRS)
  323.         fatalerr("Too many -I flags.\n");
  324.         *incp++ = INCLUDEDIR;
  325. #ifdef POSTINCDIR
  326.         if (incp >= includedirs + MAXDIRS)
  327.         fatalerr("Too many -I flags.\n");
  328.         *incp++ = POSTINCDIR;
  329. #endif
  330.     } else if (*defincdir) {
  331.         if (incp >= includedirs + MAXDIRS)
  332.         fatalerr("Too many -I flags.\n");
  333.         *incp++ = defincdir;
  334.     }
  335.  
  336.     redirect(startat, makefile);
  337.  
  338.     /*
  339.      * catch signals.
  340.      */
  341. #ifdef USGISH
  342. /*  should really reset SIGINT to SIG_IGN if it was.  */
  343. #ifdef SIGHUP
  344.     signal (SIGHUP, catch);
  345. #endif
  346.     signal (SIGINT, catch);
  347. #ifdef SIGQUIT
  348.     signal (SIGQUIT, catch);
  349. #endif
  350.     signal (SIGILL, catch);
  351. #ifdef SIGBUS
  352.     signal (SIGBUS, catch);
  353. #endif
  354.     signal (SIGSEGV, catch);
  355. #ifdef SIGSYS
  356.     signal (SIGSYS, catch);
  357. #endif
  358.     signal (SIGFPE, catch);
  359. #else
  360.     sig_act.sa_handler = catch;
  361. #ifdef _POSIX_SOURCE
  362.     sigemptyset(&sig_act.sa_mask);
  363.     sigaddset(&sig_act.sa_mask, SIGINT);
  364.     sigaddset(&sig_act.sa_mask, SIGQUIT);
  365. #ifdef SIGBUS
  366.     sigaddset(&sig_act.sa_mask, SIGBUS);
  367. #endif
  368.     sigaddset(&sig_act.sa_mask, SIGILL);
  369.     sigaddset(&sig_act.sa_mask, SIGSEGV);
  370.     sigaddset(&sig_act.sa_mask, SIGHUP);
  371.     sigaddset(&sig_act.sa_mask, SIGPIPE);
  372. #ifdef SIGSYS
  373.     sigaddset(&sig_act.sa_mask, SIGSYS);
  374. #endif
  375. #else
  376.     sig_act.sa_mask = ((1<<(SIGINT -1))
  377.                |(1<<(SIGQUIT-1))
  378. #ifdef SIGBUS
  379.                |(1<<(SIGBUS-1))
  380. #endif
  381.                |(1<<(SIGILL-1))
  382.                |(1<<(SIGSEGV-1))
  383.                |(1<<(SIGHUP-1))
  384.                |(1<<(SIGPIPE-1))
  385. #ifdef SIGSYS
  386.                |(1<<(SIGSYS-1))
  387. #endif
  388.                );
  389. #endif /* _POSIX_SOURCE */
  390.     sig_act.sa_flags = 0;
  391.     sigaction(SIGHUP, &sig_act, (struct sigaction *)0);
  392.     sigaction(SIGINT, &sig_act, (struct sigaction *)0);
  393.     sigaction(SIGQUIT, &sig_act, (struct sigaction *)0);
  394.     sigaction(SIGILL, &sig_act, (struct sigaction *)0);
  395. #ifdef SIGBUS
  396.     sigaction(SIGBUS, &sig_act, (struct sigaction *)0);
  397. #endif
  398.     sigaction(SIGSEGV, &sig_act, (struct sigaction *)0);
  399. #ifdef SIGSYS
  400.     sigaction(SIGSYS, &sig_act, (struct sigaction *)0);
  401. #endif
  402. #endif /* USGISH */
  403.  
  404.     /*
  405.      * now peruse through the list of files.
  406.      */
  407.     for(fp=filelist; *fp; fp++) {
  408.         filecontent = getfile(*fp);
  409.         ip = newinclude(*fp, (char *)NULL);
  410.  
  411.         find_includes(filecontent, ip, ip, 0, FALSE);
  412.         freefile(filecontent);
  413.         recursive_pr_include(ip, ip->i_file, base_name(*fp));
  414.         inc_clean();
  415.     }
  416.     if (printed)
  417.         printf("\n");
  418.     exit(0);
  419. }
  420.  
  421. struct filepointer *getfile(file)
  422.     char    *file;
  423. {
  424.     register int    fd;
  425.     struct filepointer    *content;
  426.     struct stat    st;
  427.  
  428.     content = (struct filepointer *)malloc(sizeof(struct filepointer));
  429.     if ((fd = open(file, O_RDONLY)) < 0) {
  430.         warning("cannot open \"%s\"\n", file);
  431.         content->f_p = content->f_base = content->f_end = (char *)malloc(1);
  432.         *content->f_p = '\0';
  433.         return(content);
  434.     }
  435.     fstat(fd, &st);
  436.     content->f_base = (char *)malloc(st.st_size+1);
  437.     if (content->f_base == NULL)
  438.         fatalerr("cannot allocate mem\n");
  439.     if ((st.st_size = read(fd, content->f_base, st.st_size)) < 0)
  440.         fatalerr("failed to read %s\n", file);
  441.     close(fd);
  442.     content->f_len = st.st_size+1;
  443.     content->f_p = content->f_base;
  444.     content->f_end = content->f_base + st.st_size;
  445.     *content->f_end = '\0';
  446.     content->f_line = 0;
  447.     return(content);
  448. }
  449.  
  450. freefile(fp)
  451.     struct filepointer    *fp;
  452. {
  453.     free(fp->f_base);
  454.     free(fp);
  455. }
  456.  
  457. char *copy(str)
  458.     register char    *str;
  459. {
  460.     register char    *p = (char *)malloc(strlen(str) + 1);
  461.  
  462.     strcpy(p, str);
  463.     return(p);
  464. }
  465.  
  466. match(str, list)
  467.     register char    *str, **list;
  468. {
  469.     register int    i;
  470.  
  471.     for (i=0; *list; i++, list++)
  472.         if (strcmp(str, *list) == 0)
  473.             return(i);
  474.     return(-1);
  475. }
  476.  
  477. /*
  478.  * Get the next line.  We only return lines beginning with '#' since that
  479.  * is all this program is ever interested in.
  480.  */
  481. char *getline(filep)
  482.     register struct filepointer    *filep;
  483. {
  484.     register char    *p,    /* walking pointer */
  485.             *eof,    /* end of file pointer */
  486.             *bol;    /* beginning of line pointer */
  487.     register    lineno;    /* line number */
  488.  
  489.     p = filep->f_p;
  490.     eof = filep->f_end;
  491.     if (p >= eof)
  492.         return((char *)NULL);
  493.     lineno = filep->f_line;
  494.  
  495.     for(bol = p--; ++p < eof; ) {
  496.         if (*p == '/' && *(p+1) == '*') { /* consume comments */
  497.             *p++ = ' ', *p++ = ' ';
  498.             while (*p) {
  499.                 if (*p == '*' && *(p+1) == '/') {
  500.                     *p++ = ' ', *p = ' ';
  501.                     break;
  502.                 }
  503.                 else if (*p == '\n')
  504.                     lineno++;
  505.                 *p++ = ' ';
  506.             }
  507.             continue;
  508.         }
  509. #ifdef WIN32
  510.         else if (*p == '/' && *(p+1) == '/') { /* consume comments */
  511.             *p++ = ' ', *p++ = ' ';
  512.             while (*p && *p != '\n')
  513.                 *p++ = ' ';
  514.             lineno++;
  515.             continue;
  516.         }
  517. #endif
  518.         else if (*p == '\\') {
  519.             if (*(p+1) == '\n') {
  520.                 *p = ' ';
  521.                 *(p+1) = ' ';
  522.                 lineno++;
  523.             }
  524.         }
  525.         else if (*p == '\n') {
  526.             lineno++;
  527.             if (*bol == '#') {
  528.                 register char *cp;
  529.  
  530.                 *p++ = '\0';
  531.                 /* punt lines with just # (yacc generated) */
  532.                 for (cp = bol+1; 
  533.                      *cp && (*cp == ' ' || *cp == '\t'); cp++);
  534.                 if (*cp) goto done;
  535.             }
  536.             bol = p+1;
  537.         }
  538.     }
  539.     if (*bol != '#')
  540.         bol = NULL;
  541. done:
  542.     filep->f_p = p;
  543.     filep->f_line = lineno;
  544.     return(bol);
  545. }
  546.  
  547. /*
  548.  * Strip the file name down to what we want to see in the Makefile.
  549.  * It will have objprefix and objsuffix around it.
  550.  */
  551. char *base_name(file)
  552.     register char    *file;
  553. {
  554.     register char    *p;
  555.  
  556.     file = copy(file);
  557.     for(p=file+strlen(file); p>file && *p != '.'; p--) ;
  558.  
  559.     if (*p == '.')
  560.         *p = '\0';
  561.     return(file);
  562. }
  563.  
  564. #if defined(USG) && !defined(CRAY) && !defined(SVR4) && !defined(__EMX__)
  565. int rename (from, to)
  566.     char *from, *to;
  567. {
  568.     (void) unlink (to);
  569.     if (link (from, to) == 0) {
  570.     unlink (from);
  571.     return 0;
  572.     } else {
  573.     return -1;
  574.     }
  575. }
  576. #endif /* USGISH */
  577.  
  578. redirect(line, makefile)
  579.     char    *line,
  580.         *makefile;
  581. {
  582.     struct stat    st;
  583.     FILE    *fdin, *fdout;
  584.     char    backup[ BUFSIZ ],
  585.         buf[ BUFSIZ ];
  586.     boolean    found = FALSE;
  587.     int    len;
  588.  
  589.     /*
  590.      * if makefile is "-" then let it pour onto stdout.
  591.      */
  592.     if (makefile && *makefile == '-' && *(makefile+1) == '\0')
  593.         return;
  594.  
  595.     /*
  596.      * use a default makefile is not specified.
  597.      */
  598.     if (!makefile) {
  599.         if (stat("Makefile", &st) == 0)
  600.             makefile = "Makefile";
  601.         else if (stat("makefile", &st) == 0)
  602.             makefile = "makefile";
  603.         else
  604.             fatalerr("[mM]akefile is not present\n");
  605.     }
  606.     else
  607.         stat(makefile, &st);
  608.     if ((fdin = fopen(makefile, "r")) == NULL)
  609.         fatalerr("cannot open \"%s\"\n", makefile);
  610.     sprintf(backup, "%s.bak", makefile);
  611.     unlink(backup);
  612. #if defined(WIN32) || defined(__EMX__)
  613.     fclose(fdin);
  614. #endif
  615.     if (rename(makefile, backup) < 0)
  616.         fatalerr("cannot rename %s to %s\n", makefile, backup);
  617. #if defined(WIN32) || defined(__EMX__)
  618.     if ((fdin = fopen(backup, "r")) == NULL)
  619.         fatalerr("cannot open \"%s\"\n", backup);
  620. #endif
  621.     if ((fdout = freopen(makefile, "w", stdout)) == NULL)
  622.         fatalerr("cannot open \"%s\"\n", backup);
  623.     len = strlen(line);
  624.     while (!found && fgets(buf, BUFSIZ, fdin)) {
  625.         if (*buf == '#' && strncmp(line, buf, len) == 0)
  626.             found = TRUE;
  627.         fputs(buf, fdout);
  628.     }
  629.     if (!found) {
  630.         if (verbose)
  631.         warning("Adding new delimiting line \"%s\" and dependencies...\n",
  632.             line);
  633.         puts(line); /* same as fputs(fdout); but with newline */
  634.     } else if (append) {
  635.         while (fgets(buf, BUFSIZ, fdin)) {
  636.         fputs(buf, fdout);
  637.         }
  638.     }
  639.     fflush(fdout);
  640. #if defined(USGISH) || defined(_SEQUENT_) || defined(USE_CHMOD)
  641.     chmod(makefile, st.st_mode);
  642. #else
  643.         fchmod(fileno(fdout), st.st_mode);
  644. #endif /* USGISH */
  645. }
  646.  
  647. #if NeedVarargsPrototypes
  648. fatalerr(char *msg, ...)
  649. #else
  650. /*VARARGS*/
  651. fatalerr(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
  652.     char *msg;
  653. #endif
  654. {
  655. #if NeedVarargsPrototypes
  656.     va_list args;
  657. #endif
  658.     fprintf(stderr, "%s: error:  ", ProgramName);
  659. #if NeedVarargsPrototypes
  660.     va_start(args, msg);
  661.     vfprintf(stderr, msg, args);
  662.     va_end(args);
  663. #else
  664.     fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
  665. #endif
  666.     exit (1);
  667. }
  668.  
  669. #if NeedVarargsPrototypes
  670. warning(char *msg, ...)
  671. #else
  672. /*VARARGS0*/
  673. warning(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
  674.     char *msg;
  675. #endif
  676. {
  677. #ifdef DEBUG_MKDEPEND
  678. #if NeedVarargsPrototypes
  679.     va_list args;
  680. #endif
  681.     fprintf(stderr, "%s: warning:  ", ProgramName);
  682. #if NeedVarargsPrototypes
  683.     va_start(args, msg);
  684.     vfprintf(stderr, msg, args);
  685.     va_end(args);
  686. #else
  687.     fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
  688. #endif
  689. #endif /* DEBUG_MKDEPEND */
  690. }
  691.  
  692. #if NeedVarargsPrototypes
  693. warning1(char *msg, ...)
  694. #else
  695. /*VARARGS0*/
  696. warning1(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
  697.     char *msg;
  698. #endif
  699. {
  700. #ifdef DEBUG_MKDEPEND
  701. #if NeedVarargsPrototypes
  702.     va_list args;
  703.     va_start(args, msg);
  704.     vfprintf(stderr, msg, args);
  705.     va_end(args);
  706. #else
  707.     fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
  708. #endif
  709. #endif /* DEBUG_MKDEPEND */
  710. }
  711.