2 * $XConsortium: pr.c,v 1.6 88/09/30 08:55:13 jim Exp $
6 extern struct inclist inclist[ MAXFILES ],
10 extern boolean printed;
11 extern boolean verbose;
12 extern boolean show_where_not;
14 add_include(file, file_red, include, dot)
15 struct inclist *file, *file_red;
19 register struct inclist *newfile;
20 register struct filepointer *content;
23 * First decide what the pathname of this include file really is.
25 newfile = inc_path(file->i_file, include, dot);
26 if (newfile == NULL) {
28 log("%s (reading %s): ",
29 file_red->i_file, file->i_file);
31 log("%s: ", file->i_file);
32 log("cannot find include file \"%s\"\n", include);
33 show_where_not = TRUE;
34 newfile = inc_path(file->i_file, include, dot);
35 show_where_not = FALSE;
38 included_by(file, newfile);
39 if (!newfile->i_searched) {
40 newfile->i_searched = TRUE;
41 content = getfile(newfile->i_file);
42 find_includes(content, newfile, file_red, 0);
47 recursive_pr_include(head, file, base)
48 register struct inclist *head;
49 register char *file, *base;
55 head->i_marked = TRUE;
56 if (head->i_file != file)
58 for (i=0; i<head->i_listlen; i++)
59 recursive_pr_include(head->i_list[ i ], file, base);
63 register struct inclist *ip;
66 static char *lastfile;
67 static int current_len;
72 len = strlen(ip->i_file)+1;
73 if (current_len + len > width || file != lastfile) {
75 sprintf(buf, "\n%s%s: %s", base, objfile, ip->i_file);
76 len = current_len = strlen(buf);
80 strcpy(buf+1, ip->i_file);
83 fwrite(buf, len, 1, stdout);
86 * If verbose is set, then print out what this file includes.
88 if (! verbose || ip->i_list == NULL || ip->i_notified)
90 ip->i_notified = TRUE;
92 printf("\n# %s includes:", ip->i_file);
93 for (i=0; i<ip->i_listlen; i++)
94 printf("\n#\t%s", ip->i_list[ i ]->i_incstring);
97 #if defined (mips) && defined (SYSTYPE_SYSV)
101 log_fatal("got signal\n");
103 #else /* not (mips && SYSTYPE_SYSV) */
110 log_fatal("got signal %d\n", n);
112 #endif /* mips && SYSTYPE_SYSV */