Related articles |
---|
script to unravel nested C header files? hsu@alumni.EECS.Berkeley.EDU (1995-02-15) |
Re: script to unravel nested C header files? jpowers@ti.com (1995-02-16) |
Re: script to unravel nested C header files? beorn@swindle.Berkeley.EDU (1995-02-17) |
Re: script to unravel nested C header files? wjm@metronet.com (Bill Middleton) (1995-02-17) |
Newsgroups: | comp.lang.perl,comp.compilers |
From: | beorn@swindle.Berkeley.EDU (Beorn Johnson) |
Keywords: | C, tools |
Organization: | UC Berkeley Experimental Computing Facility (XCF) |
References: | 95-02-121 |
Date: | Fri, 17 Feb 1995 07:48:45 GMT |
Jeffrey Hsu <hsu@alumni.EECS.Berkeley.EDU>
- I recall someone once posted a very handy script (in perl I believe)
- to print out which header files were included by a C file, with
- the proper level of indentation for nested includes.
Something like (for my sample input, addrs.c):
/lib/cpp addrs.c | awk '/^# / {if ($2 == 1) { print substr(" ",
0, depth * 2) $3; lvl[$3] = ++depth; } else depth = lvl[$3]; }' | sed 's/"//g'
(join the lines), results in (for example):
addrs.c
/usr/include/sys/param.h
/usr/include/ansi_compat.h
/usr/include/machine/param.h
/usr/include/signal.h
/usr/include/ansi_compat.h
/usr/include/sys/types.h
/usr/include/ansi_compat.h
/usr/include/sys/smp_lock.h
/usr/include/ansi_compat.h
/usr/include/stdio.h
/usr/include/ansi_compat.h
/usr/include/ctype.h
/usr/include/strings.h
./misc.h
./structs.h
./headers.h
Sorry, no perl. Good for giggles with kernel source or most anything X11.
Beorn Johnson
(beorn@eecs.berkeley.edu)
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.