2.9
[glibc/nacl-glibc.git] / sysdeps / unix / snarf-ioctls
blobe6352bea75f9e6a6c87c582febdb6f03ded26cd7
1 #!/bin/sh
2 # Copyright (C) 1991, 1992, 1995, 1997 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # The GNU C Library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, write to the Free
17 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 # 02111-1307 USA.
20 sysincludedir=${sysincludedir-/usr/include}
22 if [ ! "$snarfexclude" ]; then
23 # Filter out some headers which cause trouble.
24 # Reportedly a bug in sunos4.1.2's sed makes this lose if
25 # the two cmds are in a single sed invocation.
26 snarfexclude="`echo !${sysincludedir}/sys/param.h! \
27 !${sysincludedir}/sys/time.h! \
28 !${sysincludedir}/sys/types.h! \
29 | sed 's,/,\\\\/,g' \
30 | sed 's,!\\([^!]*\\)!,-e /\\1/d,g'`"
33 for file in $*; do
34 sed -n 's/^#define[ ]*\([A-Z][A-Z0-9_]*\)[ ][ ]*[^ ].*$/\1/p' \
35 < $file
37 snarfexclude="$snarfexclude \
38 `echo $file | sed -e 's,/,\\\\/,g' -e 's,^.*$,-e /&/d,'`"
39 export snarfexclude
41 included="`sed -n < $file \
42 -e 's,^#include[ ]*<\(.*\)>.*$,'${sysincludedir}'/\1,p'\
43 | sed $snarfexclude`"
44 if [ "$included" ]; then
45 $0 $included
47 done
49 exit 0