1function except() {
2echo "
3%exception $1 {
4  \$action
5  if (result < 0) {
6     PyErr_SetFromErrno(PyExc_OSError);
7     SWIG_fail;
8  }
9}
10"
11}
12if ! ${CC:-gcc} -x c -c -I../include -o temp.o - -aux-info temp.aux < ../include/semanage/semanage.h
13then
14    # clang does not support -aux-info so fall back to gcc
15    gcc -x c -c -I../include -o temp.o - -aux-info temp.aux < ../include/semanage/semanage.h
16fi
17for i in `awk '/extern int/ { print $6 }' temp.aux`; do except $i ; done
18rm -f -- temp.aux temp.o
19