1 /* $Id: mkdep.c,v 0.10 1994/06/24 10:16:42 ceriel Exp $ */
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 /* make dependencies; Date: jan 07, 1986; Author: Erik Baalbergen */
8 [Thu Oct 6 09:56:30 MET 1988; erikb]
9 Added option '-d' which suppresses "file.c :" be printed
17 int dflag = 0; /* suppress "file.c :" */
20 struct namelist *next;
24 struct namelist *freelist;
25 struct namelist *new_namelist();
26 struct namelist *nl = 0;
33 if ((sp = malloc(u)) == 0) {
34 fprintf(stderr, "%s: out of space\n");
43 register struct namelist *nlp = freelist;
50 return (struct namelist *) Malloc(sizeof(struct namelist));
57 free_namelist(nlp->next);
66 struct namelist *nlp = nl, *lnlp = 0, *nnlp;
70 register i = strcmp(nm, nlp->name);
73 if (i == 0) /* already present */
79 (nnlp = new_namelist())->name = strcpy(Malloc((unsigned)strlen(nm) + 1), nm);
82 nnlp->next = lnlp->next;
91 print_namelist(nm, nlp)
98 printf("%s\n", nlp->name);
110 if (*argv && **argv == '-') {
111 char *opt = &(*argv++)[1];
113 if (*opt++ != 'd' || *opt) {
114 fprintf(stderr, "use: %s [-d] [file ...]\n", prog);
123 if (dofile(*argv) == 0)
125 print_namelist(*argv++, nl);
135 if (*s++ == '/') return 1;
139 extern char *fgets();
146 char *nm, *include_line();
148 if ((fp = fopen(fn, "r")) == 0) {
149 fprintf(stderr, "%s: cannot read %s\n", prog, fn);
153 if (contains_slash(fn)) {
154 fprintf(stderr, "%s: (warning) %s not in current directory; not checked\n", prog, fn);
159 while (fgets(buf, BSIZ, fp) != NULL)
160 if (nm = include_line(buf)) {
173 while ((*s == '\t') || (*s == ' '))
177 while ((*s == '\t') || (*s == ' '))
188 while ((*s == '\t') || (*s == ' '))
193 while (*s != 0 && *s != '"')