]> andersk Git - moira.git/blame - util/makedepend/pr.c
RSAREF (for new reg_svr)
[moira.git] / util / makedepend / pr.c
CommitLineData
d1b2a10e 1/*
2 * $XConsortium: pr.c,v 1.6 88/09/30 08:55:13 jim Exp $
3 */
4#include "def.h"
5
6extern struct inclist inclist[ MAXFILES ],
7 *inclistp;
8extern char *objfile;
9extern int width;
10extern boolean printed;
11extern boolean verbose;
12extern boolean show_where_not;
13
14add_include(file, file_red, include, dot)
15 struct inclist *file, *file_red;
16 char *include;
17 boolean dot;
18{
19 register struct inclist *newfile;
20 register struct filepointer *content;
21
22 /*
23 * First decide what the pathname of this include file really is.
24 */
25 newfile = inc_path(file->i_file, include, dot);
26 if (newfile == NULL) {
27 if (file != file_red)
28 log("%s (reading %s): ",
29 file_red->i_file, file->i_file);
30 else
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;
36 }
37
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);
43 freefile(content);
44 }
45}
46
47recursive_pr_include(head, file, base)
48 register struct inclist *head;
49 register char *file, *base;
50{
51 register int i;
52
53 if (head->i_marked)
54 return;
55 head->i_marked = TRUE;
56 if (head->i_file != file)
57 pr(head, file, base);
58 for (i=0; i<head->i_listlen; i++)
59 recursive_pr_include(head->i_list[ i ], file, base);
60}
61
62pr(ip, file, base)
63 register struct inclist *ip;
64 char *file, *base;
65{
66 static char *lastfile;
67 static int current_len;
68 register int len, i;
69 char buf[ BUFSIZ ];
70
71 printed = TRUE;
72 len = strlen(ip->i_file)+1;
73 if (current_len + len > width || file != lastfile) {
74 lastfile = file;
75 sprintf(buf, "\n%s%s: %s", base, objfile, ip->i_file);
76 len = current_len = strlen(buf);
77 }
78 else {
79 buf[0] = ' ';
80 strcpy(buf+1, ip->i_file);
81 current_len += len;
82 }
83 fwrite(buf, len, 1, stdout);
84
85 /*
86 * If verbose is set, then print out what this file includes.
87 */
88 if (! verbose || ip->i_list == NULL || ip->i_notified)
89 return;
90 ip->i_notified = TRUE;
91 lastfile = NULL;
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);
95}
96
97#if defined (mips) && defined (SYSTYPE_SYSV)
98void catch()
99{
100 fflush(stdout);
101 log_fatal("got signal\n");
102}
103#else /* not (mips && SYSTYPE_SYSV) */
104#ifdef ultrix
105void
106#endif
107catch(n)
108{
109 fflush(stdout);
110 log_fatal("got signal %d\n", n);
111}
112#endif /* mips && SYSTYPE_SYSV */
113
This page took 0.065882 seconds and 5 git commands to generate.