| 1 | #!/bin/sh |
| 2 | # generates automech.h and automech.c |
| 3 | |
| 4 | # Copyright (C) 2000 Ian Jackson |
| 5 | # |
| 6 | # This is free software; you can redistribute it and/or modify it |
| 7 | # under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation; either version 2 of the License, or |
| 9 | # (at your option) any later version. |
| 10 | # |
| 11 | # This program is distributed in the hope that it will be useful, but |
| 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | # General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with userv-utils; if not, write to the Free Software |
| 18 | # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | |
| 20 | exec >automech.c.new |
| 21 | exec 3>automech.h.new |
| 22 | |
| 23 | cat <<END |
| 24 | #include "forwarder.h" |
| 25 | const struct mechanism *const mechanismlists[]= { |
| 26 | END |
| 27 | |
| 28 | cat >&3 <<END |
| 29 | #ifndef AUTOMECH_H |
| 30 | #define AUTOMECH_H |
| 31 | END |
| 32 | |
| 33 | for m in "$@"; do |
| 34 | echo " mechlist_$m," |
| 35 | echo "extern const struct mechanism mechlist_$m[];" >&3 |
| 36 | done |
| 37 | |
| 38 | cat <<END |
| 39 | 0 |
| 40 | }; |
| 41 | END |
| 42 | |
| 43 | cat >&3 <<END |
| 44 | #endif |
| 45 | END |
| 46 | |
| 47 | for e in c h; do mv -f automech.$e.new automech.$e; done |