chiark / gitweb /
@@ -1,6 +1,7 @@
[userv-utils.git] / ipif / automechgen.sh
1 #!/bin/sh
2 exec >automech.c.new
3 exec 3>automech.h.new
4
5 cat <<END
6 #include "mech.h"
7 const struct mechanism *const mechanismlists[]= {
8 END
9
10 cat >&3 <<END
11 #ifndef AUTOMECH_H
12 #define AUTOMECH_H
13 END
14
15 for m in "$@"; do
16         echo "  mechlist_$m,"
17         echo "extern const struct mechanism mechlist_$m[];" >&3
18 done
19
20 cat <<END
21   0
22 };
23 END
24
25 cat >&3 <<END
26 #endif
27 END
28
29 for e in c h; do mv -f automech.$e.new automech.$e; done