Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
[linux/fpc-iii.git] / arch / x86 / syscalls / syscallhdr.sh
blob31fd5f1f38f7618d733a162a4828d8ade9de069f
1 #!/bin/sh
3 in="$1"
4 out="$2"
5 my_abis=`echo "($3)" | tr ',' '|'`
6 prefix="$4"
7 offset="$5"
9 fileguard=_ASM_X86_`basename "$out" | sed \
10 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
11 -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
12 grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
13 echo "#ifndef ${fileguard}"
14 echo "#define ${fileguard} 1"
15 echo ""
17 while read nr abi name entry ; do
18 if [ -z "$offset" ]; then
19 echo "#define __NR_${prefix}${name} $nr"
20 else
21 echo "#define __NR_${prefix}${name} ($offset + $nr)"
23 done
25 echo ""
26 echo "#endif /* ${fileguard} */"
27 ) > "$out"