feisty meow concerns codebase  2.140
makedep.cpp
Go to the documentation of this file.
1 /* $XConsortium: main.c,v 1.84 94/11/30 16:10:44 kaleb Exp $ */
2 /* $XFree86: xc/config/makedepend/main.c,v 3.3 1995/01/28 15:41:03 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 #ifdef __WIN32__
31  #pragma warning(disable : 4996)
32 #endif
33 
34 #include "def.h"
35 
36 //#ifdef _MSC_VER
37 //#include <io.h>
38 //#else
39 #include <unistd.h>
40 //#endif
41 #include <stdio.h>
42 #include <string.h>
43 
44 #ifdef hpux
45 #define sigvec sigvector
46 #endif /* hpux */
47 
48 #ifdef X_POSIX_C_SOURCE
49 #define _POSIX_C_SOURCE X_POSIX_C_SOURCE
50 #include <signal.h>
51 #undef _POSIX_C_SOURCE
52 #else
53 #if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE)
54 #include <signal.h>
55 #else
56 #define _POSIX_SOURCE
57 #include <signal.h>
58 #undef _POSIX_SOURCE
59 #endif
60 #endif
61 
62 #if NeedVarargsPrototypes
63 #include <stdarg.h>
64 #endif
65 
66 #ifdef MINIX
67 #define USE_CHMOD 1
68 #endif
69 
70 #ifdef DEBUG
71 int _debugmask;
72 #endif
73 
75 
76 const char *directives[] = {
77  "if",
78  "ifdef",
79  "ifndef",
80  "else",
81  "endif",
82  "define",
83  "undef",
84  "include",
85  "line",
86  "pragma",
87  "error",
88  "ident",
89  "sccs",
90  "elif",
91  "eject",
92  "import",
93  NULL
94 };
95 
96 #define MAKEDEPEND
97 #include "imakemdep.h" /* from config sources */
98 #undef MAKEDEPEND
99 
101 
103 char *includedirs[ MAXDIRS + 1 ];
104 char *excludedirs[ MAXDIRS + 1 ];
106 char *objprefix = (char *)"";
107 char *objsuffix = (char *)".obj"; /* OBJSUFFIX; */
108 char *startat = (char *)"# DO NOT DELETE";
109 int width = 78;
110 bool append = false;
111 bool printed = false;
112 bool verbose = false;
113 bool show_where_not = false;
114 bool warn_multiple = false; /* Warn on multiple includes of same file */
115 
116 static
117 #ifdef SIGNALRETURNSINT
118 int
119 #else
120 void
121 #endif
122 c_catch(int sig)
123 {
124  fflush (stdout);
125  fatalerr ((char *)"got signal %d\n", sig);
126 }
127 
128 #if defined(USG) || (defined(i386) && defined(SYSV)) || defined(WIN32) || defined(__EMX__) || defined(__OS2__)
129 #define USGISH
130 #endif
131 
132 #ifndef USGISH
133 #ifndef _POSIX_SOURCE
134 #define sigaction sigvec
135 #define sa_handler sv_handler
136 #define sa_mask sv_mask
137 #define sa_flags sv_flags
138 #endif
139 struct sigaction sig_act;
140 #endif /* USGISH */
141 
142 // turns the cygwin name format into a usable windos filename.
143 char *translate_cygwin(char *fname)
144 {
145  if (!strncmp(fname, "/cygdrive/", 10)) {
146  int oldlen = strlen(fname);
147  char *newprefix = (char *)malloc(oldlen); // at least long enough.
148  newprefix[0] = fname[10];
149  newprefix[1] = ':';
150  newprefix[2] = '\0';
151  strncat(newprefix, fname + 11, oldlen - 11 + 1); // one extra for null char.
152 printf("translate cygwin: new filename is %s\n", newprefix);
153  return newprefix; // ignoring mem leak here. cannot be helped for quicky fix.
154  } else return fname;
155 }
156 
157 /* fatty boombalatty, and wrong idea here.
158 
159 // adds any subdirectories under dirname into the list of
160 // include directories, so we can get a whole hierarchies set of
161 // include files.
162 void add_subdirs(char *dirname, char ** &incp)
163 {
164  directory dir(dirname);
165  string_array subdirs = dir.directories();
166  for (int i = 0; i < subdirs.length(); i++) {
167  istring curr = istring(dirname) + "/" + subdirs[i];
168  // add the current subdirectory.
169  if (incp >= includedirs + MAXDIRS)
170  fatalerr("Too many -I flags.\n");
171  *incp++ = strdup(curr.s());
172 printf((istring("added ") + curr + "\n").s());
173  add_subdirs(curr.s(), incp);
174  }
175 }
176 */
177 
178 int main(int argc, char **argv)
179 {
180  register char **fp = filelist;
181  register char **incp = includedirs;
182  register char **excp = excludedirs;
183  register char *p;
184  register struct inclist *ip;
185  char *makefile = NULL;
186  struct filepointer *filecontent;
187  struct symtab *psymp = predefs;
188  char *endmarker = NULL;
189  char *defincdir = NULL;
190 
191  ProgramName = argv[0];
192 
193  while (psymp->s_name)
194  {
195  define2(psymp->s_name, psymp->s_value, &maininclist);
196  psymp++;
197  }
198  if (argc == 2 && argv[1][0] == '@') {
199  struct stat ast;
200  int afd;
201  char *args;
202  char **nargv;
203  int nargc;
204  char quotechar = '\0';
205 
206  nargc = 1;
207  if ((afd = open(translate_cygwin(argv[1]+1), O_RDONLY)) < 0)
208  fatalerr("cannot open \"%s\"\n", translate_cygwin(argv[1]+1));
209  fstat(afd, &ast);
210  args = (char *)malloc(ast.st_size + 2);
211  if ((ast.st_size = read(afd, args, ast.st_size)) < 0)
212  fatalerr("failed to read %s\n", argv[1]+1);
213  args[ast.st_size] = '\n';
214  args[ast.st_size + 1] = '\0';
215  close(afd);
216  for (p = args; *p; p++) {
217  if (quotechar) {
218  if (quotechar == '\\' ||
219  (*p == quotechar && p[-1] != '\\'))
220  quotechar = '\0';
221  continue;
222  }
223  switch (*p) {
224  case '\\':
225  case '"':
226  case '\'':
227  quotechar = *p;
228  break;
229  case ' ':
230  case '\n':
231  *p = '\0';
232  if (p > args && p[-1])
233  nargc++;
234  break;
235  }
236  }
237  if (p[-1])
238  nargc++;
239  nargv = (char **)malloc(nargc * sizeof(char *));
240  nargv[0] = argv[0];
241  argc = 1;
242  for (p = args; argc < nargc; p += strlen(p) + 1)
243  if (*p) nargv[argc++] = p;
244  argv = nargv;
245  }
246  for(argc--, argv++; argc; argc--, argv++) {
247  /* if looking for endmarker then check before parsing */
248  if (endmarker && strcmp (endmarker, *argv) == 0) {
249  endmarker = NULL;
250  continue;
251  }
252  if (**argv != '-') {
253  /* treat +thing as an option for C++ */
254  if (endmarker && **argv == '+')
255  continue;
256  *fp++ = argv[0];
257  continue;
258  }
259  switch(argv[0][1]) {
260  case '-':
261  endmarker = &argv[0][2];
262  if (endmarker[0] == '\0') endmarker = (char *)"--";
263  break;
264  case 'D':
265  if (argv[0][2] == '\0') {
266  argv++;
267  argc--;
268  }
269  for (p=argv[0] + 2; *p ; p++)
270  if (*p == '=') {
271  *p = ' ';
272  break;
273  }
274  define(argv[0] + 2, &maininclist);
275  break;
276  case 'i':
277  {
278  char* delim;
279  char* envinclude;
280  char* prevdir;
281  if (endmarker) break;
282  if (argv[0][2] == '\0') {
283  argv++;
284  argc--;
285  envinclude = getenv(argv[0]);
286  } else envinclude = getenv(argv[0]+2);
287  if (!envinclude) break;
288  prevdir = envinclude;
289  delim = (char*)strchr(envinclude, ';');
290  while(delim)
291  {
292  if (incp >= includedirs + MAXDIRS) fatalerr("Too many Include directories.\n");
293  *delim = '\0';
294  delim++;
295  *incp++ = prevdir;
296  prevdir = delim;
297  delim = (char*)strchr(delim, ';');
298  }
299  }
300  break;
301  case 'X':
302 //fprintf(stderr, "adding Xclude %s\n", argv[0]+2);
303  // add a directory to the exclusions list.
304  if (excp >= excludedirs + MAXDIRS)
305  fatalerr("Too many -X flags.\n");
306  *excp++ = argv[0]+2;
307  if (**(excp-1) == '\0') {
308  // fix the prior entry, but don't incremement yet; we'll do that
309  // on the include list instead.
310  *(excp-1) = *(argv + 1);
311  }
312  if (incp >= includedirs + MAXDIRS)
313  fatalerr("Too many -I flags via -X.\n");
314  *incp++ = argv[0]+2;
315  if (**(incp-1) == '\0') {
316  *(incp-1) = *(++argv);
317  argc--;
318  }
319  break;
320  case 'I':
321  if (incp >= includedirs + MAXDIRS)
322  fatalerr("Too many -I flags.\n");
323  *incp++ = argv[0]+2;
324  if (**(incp-1) == '\0') {
325  *(incp-1) = *(++argv);
326  argc--;
327  }
329  break;
330  case 'Y':
331  defincdir = argv[0]+2;
332  break;
333  /* do not use if endmarker processing */
334  case 'a':
335  if (endmarker) break;
336  append = true;
337  break;
338  case 'w':
339  if (endmarker) break;
340  if (argv[0][2] == '\0') {
341  argv++;
342  argc--;
343  width = atoi(argv[0]);
344  } else
345  width = atoi(argv[0]+2);
346  break;
347  case 'o':
348  if (endmarker) break;
349  if (argv[0][2] == '\0') {
350  argv++;
351  argc--;
352  objsuffix = argv[0];
353  } else
354  objsuffix = argv[0]+2;
355  break;
356  case 'p':
357  if (endmarker) break;
358  if (argv[0][2] == '\0') {
359  argv++;
360  argc--;
361  objprefix = argv[0];
362  } else
363  objprefix = argv[0]+2;
365  break;
366  case 'v':
367  if (endmarker) break;
368  verbose = true;
369 #ifdef DEBUG
370  if (argv[0][2])
371  _debugmask = atoi(argv[0]+2);
372 #endif
373  break;
374  case 's':
375  if (endmarker) break;
376  startat = argv[0]+2;
377  if (*startat == '\0') {
378  startat = *(++argv);
379  argc--;
380  }
381  if (*startat != '#')
382  fatalerr("-s flag's value should start %s\n",
383  "with '#'.");
384  break;
385  case 'f':
386  if (endmarker) break;
387  makefile = argv[0]+2;
388  if (*makefile == '\0') {
389  makefile = *(++argv);
390  argc--;
391  }
392  break;
393  case 'm':
394  warn_multiple = true;
395  break;
396 
397  /* Ignore -O, -g so we can just pass ${CFLAGS} to
398  makedepend
399  */
400  case 'O':
401  case 'g':
402  break;
403  default:
404  if (endmarker) break;
405  /* fatalerr("unknown opt = %s\n", argv[0]); */
406  warning("ignoring option %s\n", argv[0]);
407  break;
408  }
409  }
410 
411  if (!defincdir) {
412 #ifdef PREINCDIR
413  if (incp >= includedirs + MAXDIRS)
414  fatalerr("Too many -I flags.\n");
415  *incp++ = PREINCDIR;
416 #endif
417 #ifdef INCLUDEDIR
418  if (incp >= includedirs + MAXDIRS)
419  fatalerr("Too many -I flags.\n");
420  *incp++ = INCLUDEDIR;
421 #endif
422 #ifdef POSTINCDIR
423  if (incp >= includedirs + MAXDIRS)
424  fatalerr("Too many -I flags.\n");
425  *incp++ = POSTINCDIR;
426 #endif
427  } else if (*defincdir) {
428  if (incp >= includedirs + MAXDIRS)
429  fatalerr("Too many -I flags.\n");
430  *incp++ = defincdir;
431  }
432 
433  redirect(startat, makefile);
434 
435  /*
436  * c_catch signals.
437  */
438 #ifdef USGISH
439 /* should really reset SIGINT to SIG_IGN if it was. */
440 #ifdef SIGHUP
441  signal (SIGHUP, c_catch);
442 #endif
443  signal (SIGINT, c_catch);
444 #ifdef SIGQUIT
445  signal (SIGQUIT, c_catch);
446 #endif
447  signal (SIGILL, c_catch);
448 #ifdef SIGBUS
449  signal (SIGBUS, c_catch);
450 #endif
451  signal (SIGSEGV, c_catch);
452 #ifdef SIGSYS
453  signal (SIGSYS, c_catch);
454 #endif
455 #else
456  sig_act.sa_handler = c_catch;
457 #ifdef _POSIX_SOURCE
458  sigemptyset(&sig_act.sa_mask);
459  sigaddset(&sig_act.sa_mask, SIGINT);
460  sigaddset(&sig_act.sa_mask, SIGQUIT);
461 #ifdef SIGBUS
462  sigaddset(&sig_act.sa_mask, SIGBUS);
463 #endif
464  sigaddset(&sig_act.sa_mask, SIGILL);
465  sigaddset(&sig_act.sa_mask, SIGSEGV);
466  sigaddset(&sig_act.sa_mask, SIGHUP);
467  sigaddset(&sig_act.sa_mask, SIGPIPE);
468 #ifdef SIGSYS
469  sigaddset(&sig_act.sa_mask, SIGSYS);
470 #endif
471 #else
472  sig_act.sa_mask = ((1<<(SIGINT -1))
473  |(1<<(SIGQUIT-1))
474 #ifdef SIGBUS
475  |(1<<(SIGBUS-1))
476 #endif
477  |(1<<(SIGILL-1))
478  |(1<<(SIGSEGV-1))
479  |(1<<(SIGHUP-1))
480  |(1<<(SIGPIPE-1))
481 #ifdef SIGSYS
482  |(1<<(SIGSYS-1))
483 #endif
484  );
485 #endif /* _POSIX_SOURCE */
486  sig_act.sa_flags = 0;
487  sigaction(SIGHUP, &sig_act, (struct sigaction *)0);
488  sigaction(SIGINT, &sig_act, (struct sigaction *)0);
489  sigaction(SIGQUIT, &sig_act, (struct sigaction *)0);
490  sigaction(SIGILL, &sig_act, (struct sigaction *)0);
491 #ifdef SIGBUS
492  sigaction(SIGBUS, &sig_act, (struct sigaction *)0);
493 #endif
494  sigaction(SIGSEGV, &sig_act, (struct sigaction *)0);
495 #ifdef SIGSYS
496  sigaction(SIGSYS, &sig_act, (struct sigaction *)0);
497 #endif
498 #endif /* USGISH */
499 
500  /*
501  * now peruse through the list of files.
502  */
503  for(fp=filelist; *fp; fp++) {
504  filecontent = getfile(*fp);
505  ip = newinclude(*fp, (char *)NULL);
506 
507  find_includes(filecontent, ip, ip, 0, false);
508  freefile(filecontent);
509  recursive_pr_include(ip, ip->i_file, base_name(*fp));
510  inc_clean();
511  }
512  if (printed)
513  printf("\n");
514 
515  return 0;
516 }
517 
518 struct filepointer *getfile(char *file)
519 {
520  register int fd;
521  struct filepointer *content;
522  struct stat st;
523 
524  content = (struct filepointer *)malloc(sizeof(struct filepointer));
525  content->f_name = strdup(translate_cygwin(file));
526  if ((fd = open(file, O_RDONLY)) < 0) {
527  warning("cannot open \"%s\"\n", translate_cygwin(file));
528  content->f_p = content->f_base = content->f_end = (char *)malloc(1);
529  *content->f_p = '\0';
530  return(content);
531  }
532  fstat(fd, &st);
533  content->f_base = (char *)malloc(st.st_size+1);
534  if (content->f_base == NULL)
535  fatalerr("cannot allocate mem\n");
536  if ((st.st_size = read(fd, content->f_base, st.st_size)) < 0)
537  fatalerr("failed to read %s\n", translate_cygwin(file));
538  close(fd);
539  content->f_len = st.st_size+1;
540  content->f_p = content->f_base;
541  content->f_end = content->f_base + st.st_size;
542  *content->f_end = '\0';
543  content->f_line = 0;
544  return(content);
545 }
546 
547 void freefile(struct filepointer *fp)
548 {
549  free(fp->f_name);
550  free(fp->f_base);
551  free(fp);
552 }
553 
554 char *copy(register char *str)
555 {
556  register char *p = (char *)malloc(strlen(str) + 1);
557 
558  strcpy(p, str);
559  return(p);
560 }
561 
562 int match(register const char *str, register const char **list)
563 {
564  register int i;
565 
566  for (i=0; *list; i++, list++)
567  if (strcmp(str, *list) == 0)
568  return i;
569  return -1;
570 }
571 
572 /*
573  * Get the next line. We only return lines beginning with '#' since that
574  * is all this program is ever interested in.
575  */
576 char *getline(register struct filepointer *filep)
577 {
578  register char *p, /* walking pointer */
579  *eof, /* end of file pointer */
580  *bol; /* beginning of line pointer */
581  register int lineno; /* line number */
582 
583  eof = filep->f_end;
585  lineno = filep->f_line;
586  bol = filep->f_p;
587 
588  // p is always pointing at the "beginning of a line" when we start this loop.
589  // this means that we must start considering the stuff on that line as
590  // being a useful thing to look at.
591  for (p = filep->f_p; p < eof; p++) {
592 if (bol > p) fatalerr("somehow bol got ahead of p.");
593  if (*p == '/' && *(p+1) == '*') {
594  /* consume C-style comments */
595  *p++ = ' '; *p++ = ' '; // skip the two we've already seen.
596  while (p < eof) {
597  if (*p == '*' && *(p+1) == '/') {
598  *p++ = ' '; *p = ' ';
599  // skip one of these last two, let the loop skip the next.
600  break;
601  } else if (*p == '\n') lineno++;
602  p++; // skip the current character.
603  }
604  continue;
605  } else if (*p == '/' && *(p+1) == '/') {
606  /* consume C++-style comments */
607  *p++ = ' '; *p++ = ' '; // skip the comment characters.
608  while (p < eof && (*p != '\n') ) *p++ = ' ';
609  // we scan until we get to the end of line.
611  p--; // skip back to just before \n.
612  continue; // let the loop skip past the eol that we saw.
613  } else if (*p == '\\') {
614  // handle an escape character.
615  if (*(p+1) == '\n') {
616  // we modify the stream so we consider the line correctly.
617  *p = ' ';
618  *(p+1) = ' ';
619  lineno++;
620  }
621  } else if (*p == '\n') {
622  // we've finally reached the end of the line.
623  lineno++;
624  *p = '\0'; // set the end of line to be a end of string now.
625  if (bol < p) {
626  // it's not at the same position as the end of line, so it's worth
627  // considering.
628  while ( (bol < p) && ((*bol == ' ') || (*bol == '\t')) ) bol++;
631  if (*bol == '#') {
632  register char *cp;
633  /* punt lines with just # (yacc generated) */
634  for (cp = bol+1; *cp && (*cp == ' ' || *cp == '\t'); cp++) {}
635  if (*cp) { p++; goto done; }
636  }
637  }
638  // this is a failure now. we reset the beginning of line.
639  bol = p+1;
640  }
641  }
642  if (*bol != '#') bol = NULL;
643 done:
644  filep->f_p = p;
645  filep->f_line = lineno;
646  return bol;
647 }
648 
649 /*
650  * Strip the file name down to what we want to see in the Makefile.
651  * It will have objprefix and objsuffix around it.
652  */
653 char *base_name(register char *file)
654 {
655  register char *p;
656 
657  file = copy(file);
658  for(p=file+strlen(file); p>file && *p != '.'; p--) ;
659 
660  if (*p == '.')
661  *p = '\0';
662  return(file);
663 }
664 
665 #if defined(USG) && !defined(CRAY) && !defined(SVR4) && !defined(__EMX__)
666 int rename(char *from, char *to)
667 {
668  (void) unlink (to);
669  if (link (from, to) == 0) {
670  unlink (from);
671  return 0;
672  } else {
673  return -1;
674  }
675 }
676 #endif /* USGISH */
677 
678 void redirect(char *line, char *makefile)
679 {
680  struct stat st;
681  FILE *fdin, *fdout;
682  char backup[ BUFSIZ ],
683  buf[ BUFSIZ ];
684  bool found = false;
685  int len;
686 
687  /*
688  * if makefile is "-" then let it pour onto stdout.
689  */
690  if (makefile && *makefile == '-' && *(makefile+1) == '\0')
691  return;
692 
693  /*
694  * use a default makefile is not specified.
695  */
696  if (!makefile) {
697  if (stat("Makefile", &st) == 0)
698  makefile = (char *)"Makefile";
699  else if (stat("makefile", &st) == 0)
700  makefile = (char *)"makefile";
701  else
702  fatalerr("[mM]akefile is not present\n");
703  }
704  else
705  stat(makefile, &st);
706  if ((fdin = fopen(translate_cygwin(makefile), "r")) == NULL)
707  fatalerr("cannot open \"%s\"\n", translate_cygwin(makefile));
708  sprintf(backup, "%s.bak", makefile);
709  unlink(backup);
710 #if defined(WIN32) || defined(__EMX__) || defined(__OS2__)
711  fclose(fdin);
712 #endif
713  if (rename(translate_cygwin(makefile), translate_cygwin(backup)) < 0)
714  fatalerr("cannot rename %s to %s\n", translate_cygwin(makefile), translate_cygwin(backup));
715 #if defined(WIN32) || defined(__EMX__) || defined(__OS2__)
716  if ((fdin = fopen(translate_cygwin(backup), "r")) == NULL)
717  fatalerr("cannot open \"%s\"\n", translate_cygwin(backup));
718 #endif
719  if ((fdout = freopen(translate_cygwin(makefile), "w", stdout)) == NULL)
720  fatalerr("cannot open \"%s\"\n", translate_cygwin(backup));
721  len = int(strlen(line));
722  while (!found && fgets(buf, BUFSIZ, fdin)) {
723  if (*buf == '#' && strncmp(line, buf, len) == 0)
724  found = true;
725  fputs(buf, fdout);
726  }
727  if (!found) {
728  if (verbose)
729  warning("Adding new delimiting line \"%s\" and dependencies...\n",
730  line);
731  puts(line); /* same as fputs(fdout); but with newline */
732  } else if (append) {
733  while (fgets(buf, BUFSIZ, fdin)) {
734  fputs(buf, fdout);
735  }
736  }
737  fflush(fdout);
738 #if defined(USGISH) || defined(_SEQUENT_) || defined(USE_CHMOD)
739  chmod(makefile, st.st_mode);
740 #else
741  fchmod(fileno(fdout), st.st_mode);
742 #endif /* USGISH */
743 }
744 
745 #if NeedVarargsPrototypes
746 void fatalerr(const char *msg, ...)
747 #else
748 /*VARARGS*/
749 void fatalerr(char *msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
750 #endif
751 {
752 #if NeedVarargsPrototypes
753  va_list args;
754 #endif
755  fprintf(stderr, "%s: error: ", 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  exit (1);
764 }
765 
766 #if NeedVarargsPrototypes
767 void warning(const char *msg, ...)
768 #else
769 /*VARARGS0*/
770 void warning(const char *msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
771 #endif
772 {
773 #if NeedVarargsPrototypes
774  va_list args;
775 #endif
776  fprintf(stderr, "%s: warning: ", ProgramName);
777 #if NeedVarargsPrototypes
778  va_start(args, msg);
779  vfprintf(stderr, msg, args);
780  va_end(args);
781 #else
782  fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
783 #endif
784 }
785 
786 #if NeedVarargsPrototypes
787 void warning1(const char *msg, ...)
788 #else
789 /*VARARGS0*/
790 void warning1(const char *msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
791 #endif
792 {
793 #if NeedVarargsPrototypes
794  va_list args;
795  va_start(args, msg);
796  vfprintf(stderr, msg, args);
797  va_end(args);
798 #else
799  fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
800 #endif
801 }
802 
#define stat
Definition: Xos2defs.h:41
#define unlink
Definition: Xos2defs.h:45
#define fileno
Definition: Xos2defs.h:27
#define chmod
Definition: Xos2defs.h:12
#define read
Definition: Xos2defs.h:38
#define open
Definition: Xos2defs.h:36
#define close
Definition: Xos2defs.h:13
#define fstat
Definition: Xos2defs.h:28
#define O_RDONLY
Definition: Xw32defs.h:48
void recursive_pr_include(register inclist *head, register char *file, register char *base)
int find_includes(filepointer *filep, inclist *file, inclist *file_red, int recursion, bool failOK)
Definition: parse.cpp:40
void define2(char *name, char *val, inclist *file)
Definition: parse.cpp:434
inclist * newinclude(register char *newfile, register char *incstring)
Definition: include.cpp:276
#define MAXFILES
Definition: def.h:49
void inc_clean()
Definition: include.cpp:340
void define(char *def, inclist *file)
Definition: parse.cpp:416
#define MAXDIRS
Definition: def.h:50
char * startat
Definition: makedep.cpp:108
char * translate_cygwin(char *fname)
Definition: makedep.cpp:143
char * ProgramName
Definition: makedep.cpp:74
int width
Definition: makedep.cpp:109
bool show_where_not
Definition: makedep.cpp:113
void freefile(struct filepointer *fp)
Definition: makedep.cpp:547
void warning1(const char *msg, x1, x2, x3, x4, x5, x6, x7, x8, x9)
Definition: makedep.cpp:790
const char * directives[]
Definition: makedep.cpp:76
int main(int argc, char **argv)
Definition: makedep.cpp:178
struct filepointer * getfile(char *file)
Definition: makedep.cpp:518
struct sigaction sig_act
Definition: makedep.cpp:139
char * notdotdot[MAXDIRS]
Definition: makedep.cpp:105
struct inclist maininclist
Definition: makedep.cpp:100
struct inclist inc_list[MAXFILES]
Definition: makedep.cpp:100
void fatalerr(char *msg, x1, x2, x3, x4, x5, x6, x7, x8, x9)
Definition: makedep.cpp:749
char * filelist[MAXFILES]
Definition: makedep.cpp:102
char * getline(register struct filepointer *filep)
Definition: makedep.cpp:576
char * excludedirs[MAXDIRS+1]
Definition: makedep.cpp:104
char * base_name(register char *file)
Definition: makedep.cpp:653
int match(register const char *str, register const char **list)
Definition: makedep.cpp:562
void redirect(char *line, char *makefile)
Definition: makedep.cpp:678
char * includedirs[MAXDIRS+1]
Definition: makedep.cpp:103
bool warn_multiple
Definition: makedep.cpp:114
void warning(const char *msg, x1, x2, x3, x4, x5, x6, x7, x8, x9)
Definition: makedep.cpp:770
struct inclist * inclistp
Definition: makedep.cpp:100
bool verbose
Definition: makedep.cpp:112
bool append
Definition: makedep.cpp:110
char * copy(register char *str)
Definition: makedep.cpp:554
char * objprefix
Definition: makedep.cpp:106
bool printed
Definition: makedep.cpp:111
char * objsuffix
Definition: makedep.cpp:107
long f_line
Definition: def.h:122
char * f_base
Definition: def.h:119
char * f_p
Definition: def.h:118
char * f_name
Definition: def.h:123
char * f_end
Definition: def.h:120
long f_len
Definition: def.h:121
Definition: def.h:101
char * i_file
Definition: def.h:103
Definition: def.h:96
char * s_value
Definition: def.h:98
char * s_name
Definition: def.h:97