1
/* $Xorg: pr.c,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */
4
Copyright (c) 1993, 1994, 1998 The Open Group
6
Permission to use, copy, modify, distribute, and sell this software and its
7
documentation for any purpose is hereby granted without fee, provided that
8
the above copyright notice appear in all copies and that both that
9
copyright notice and this permission notice appear in supporting
12
The above copyright notice and this permission notice shall be included in
13
all copies or substantial portions of the Software.
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
Except as contained in this notice, the name of The Open Group shall not be
23
used in advertising or otherwise to promote the sale, use or other dealings
24
in this Software without prior written authorization from The Open Group.
27
/* $XFree86: xc/config/makedepend/pr.c,v 1.5 2001/12/14 19:53:21 dawes Exp $ */
31
extern struct inclist inclist[ MAXFILES ],
33
extern char *objprefix;
34
extern char *objsuffix;
36
extern boolean printed;
37
extern boolean verbose;
38
extern boolean show_where_not;
41
add_include(struct filepointer *filep, struct inclist *file,
42
struct inclist *file_red, char *include, int type,
45
register struct inclist *newfile;
46
register struct filepointer *content;
49
* First decide what the pathname of this include file really is.
51
newfile = inc_path(file->i_file, include, type);
52
if (newfile == NULL) {
56
warning("%s (reading %s, line %d): ",
57
file_red->i_file, file->i_file, filep->f_line);
59
warning("%s, line %d: ", file->i_file, filep->f_line);
60
warning1("cannot find include file \"%s\"\n", include);
61
show_where_not = TRUE;
62
newfile = inc_path(file->i_file, include, type);
63
show_where_not = FALSE;
67
included_by(file, newfile);
68
if (!(newfile->i_flags & SEARCHED)) {
69
newfile->i_flags |= SEARCHED;
70
content = getfile(newfile->i_file);
71
find_includes(content, newfile, file_red, 0, failOK);
78
pr(struct inclist *ip, char *file, char *base)
80
static char *lastfile;
81
static int current_len;
86
len = strlen(ip->i_file)+1;
87
if (current_len + len > width || file != lastfile) {
89
sprintf(buf, "\n%s%s%s: %s", objprefix, base, objsuffix,
91
len = current_len = strlen(buf);
95
strcpy(buf+1, ip->i_file);
98
fwrite(buf, len, 1, stdout);
101
* If verbose is set, then print out what this file includes.
103
if (! verbose || ip->i_list == NULL || ip->i_flags & NOTIFIED)
105
ip->i_flags |= NOTIFIED;
107
printf("\n# %s includes:", ip->i_file);
108
for (i=0; i<ip->i_listlen; i++)
109
printf("\n#\t%s", ip->i_list[ i ]->i_incstring);
113
recursive_pr_include(struct inclist *head, char *file, char *base)
117
if (head->i_flags & MARKED)
119
head->i_flags |= MARKED;
120
if (head->i_file != file)
121
pr(head, file, base);
122
for (i=0; i<head->i_listlen; i++)
123
recursive_pr_include(head->i_list[ i ], file, base);