debian/: Fix userv-ucgi docs rename
[userv-utils] / ipif / automechgen.sh
CommitLineData
1fb3cba0 1#!/bin/sh
f0e54a99 2# generates automech.h and automech.c
3
c07be359 4# This file is part of ipif, part of userv-utils
f0e54a99 5#
9028e234
IJ
6# Copyright 1996-2013 Ian Jackson <ijackson@chiark.greenend.org.uk>
7# Copyright 1998 David Damerell <damerell@chiark.greenend.org.uk>
8# Copyright 1999,2003
9# Chancellor Masters and Scholars of the University of Cambridge
10# Copyright 2010 Tony Finch <fanf@dotat.at>
11#
f0e54a99 12# This is free software; you can redistribute it and/or modify it
13# under the terms of the GNU General Public License as published by
9028e234 14# the Free Software Foundation; either version 3 of the License, or
f0e54a99 15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
9028e234 23# along with userv-utils; if not, see http://www.gnu.org/licenses/.
f0e54a99 24
1fb3cba0 25exec >automech.c.new
26exec 3>automech.h.new
27
28cat <<END
f9e59051 29#include "forwarder.h"
1fb3cba0 30const struct mechanism *const mechanismlists[]= {
31END
32
33cat >&3 <<END
34#ifndef AUTOMECH_H
35#define AUTOMECH_H
36END
37
38for m in "$@"; do
39 echo " mechlist_$m,"
40 echo "extern const struct mechanism mechlist_$m[];" >&3
41done
42
43cat <<END
44 0
45};
46END
47
48cat >&3 <<END
49#endif
50END
51
52for e in c h; do mv -f automech.$e.new automech.$e; done