@@ -4,6 +4,7 @@
[userv-utils] / ipif / automechgen.sh
CommitLineData
1fb3cba0 1#!/bin/sh
f0e54a99 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
1fb3cba0 20exec >automech.c.new
21exec 3>automech.h.new
22
23cat <<END
f9e59051 24#include "forwarder.h"
1fb3cba0 25const struct mechanism *const mechanismlists[]= {
26END
27
28cat >&3 <<END
29#ifndef AUTOMECH_H
30#define AUTOMECH_H
31END
32
33for m in "$@"; do
34 echo " mechlist_$m,"
35 echo "extern const struct mechanism mechlist_$m[];" >&3
36done
37
38cat <<END
39 0
40};
41END
42
43cat >&3 <<END
44#endif
45END
46
47for e in c h; do mv -f automech.$e.new automech.$e; done