Update.
[glibc.git] / sysdeps / unix / snarf-ioctls
blobba4411a6737feeb735a0f4cc0b4a52d5973bef04
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 modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # 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
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU Library General Public
16 # License along with the GNU C Library; see the file COPYING.LIB. If not,
17 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 # Boston, MA 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