1function except() {
2echo "
3%exception $1 {
4  \$action
5  if (result < 0) {
6     PyErr_SetFromErrno(PyExc_OSError);
7     return NULL;
8  }
9}
10"
11}
12gcc -x c -c -I../include - -aux-info temp.aux < ../include/semanage/semanage.h
13for i in `awk '/extern int/ { print $6 }' temp.aux`; do except $i ; done
14rm -f -- temp.aux -.o
15