1function except() {
2case $1 in
3    selinux_file_context_cmp) # ignore
4    ;;
5    *)
6echo "
7%exception $1 {
8  \$action 
9  if (result < 0) {
10     PyErr_SetFromErrno(PyExc_OSError);
11     return NULL;
12  }
13}
14"
15;;
16esac
17}
18gcc -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h
19for i in `awk '/<stdin>.*extern int/ { print $6 }' temp.aux`; do except $i ; done 
20rm -f -- temp.aux -.o
21