LINUX: afs_create infinite fetchStatus loop
[pkg-k5-afs_openafs.git] / src / libuafs / make_h_tree
blob2b8997312355577f973c8f0c52cb74e6e532eab1
1 #!/bin/sh -e
3 # make_h_tree
4 # Generate an h tree that includes the appropriate sys headers
6 # Usage: make_h_tree ${SRC} ...
8 # The source files in the specified directories will be scanned for include
9 # directives. The h directory will be created under the current directory and
10 # populated with stubs that include the actual header file for every header
11 # included by any source file in the ${SRC} directories. Since this script is
12 # for userspace only, this effectively just makes a file called h/foo.h that
13 # contains:
14 # #include <sys/foo.h>
15 # For every include directive that is found that looks like #include <h/foo.h>
16 # This is an ugly hack to work around the naming of header files using h
17 # instead of their proper names elsewhere in the code.
19 mkdir h
21 for dir in "$@" ; do
22 for hsrc in `cat "$dir"/*.c | \
23 sed -n -e 's|^[ ]*#[ ]*include[ ]*[<"]h/\([^>"/]*\)[>"].*$|\1|p' | \
24 sort | uniq` ; do
26 echo "#include <sys/$hsrc>" > h/"$hsrc"
27 done
28 done