summaryrefslogtreecommitdiff
path: root/programs/_include
diff options
context:
space:
mode:
Diffstat (limited to 'programs/_include')
-rw-r--r--programs/_include/.cvsignore1
-rw-r--r--programs/_include/Makefile43
-rw-r--r--programs/_include/_include.835
-rwxr-xr-xprograms/_include/_include.in102
4 files changed, 181 insertions, 0 deletions
diff --git a/programs/_include/.cvsignore b/programs/_include/.cvsignore
new file mode 100644
index 000000000..ab6204115
--- /dev/null
+++ b/programs/_include/.cvsignore
@@ -0,0 +1 @@
+_include
diff --git a/programs/_include/Makefile b/programs/_include/Makefile
new file mode 100644
index 000000000..6b5f11682
--- /dev/null
+++ b/programs/_include/Makefile
@@ -0,0 +1,43 @@
+# Makefile for miscelaneous programs
+# Copyright (C) 2002 Michael Richardson <mcr@freeswan.org>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# RCSID $Id: Makefile,v 1.1 2004/03/15 20:35:27 as Exp $
+
+FREESWANSRCDIR=../..
+include ${FREESWANSRCDIR}/Makefile.inc
+
+PROGRAM=_include
+PROGRAMDIR=${LIBDIR}
+
+include ../Makefile.program
+
+#
+# $Log: Makefile,v $
+# Revision 1.1 2004/03/15 20:35:27 as
+# added files from freeswan-2.04-x509-1.5.3
+#
+# Revision 1.3 2002/08/02 16:01:11 mcr
+# moved user visible programs to $PREFIX/libexec, while moving
+# private files to $PREFIX/lib.
+#
+# Revision 1.2 2002/06/02 22:02:14 mcr
+# changed TOPDIR->FREESWANSRCDIR in all Makefiles.
+# (note that linux/net/ipsec/Makefile uses TOPDIR because this is the
+# kernel sense.)
+#
+# Revision 1.1 2002/04/24 07:55:32 mcr
+# #include patches and Makefiles for post-reorg compilation.
+#
+#
+#
+
diff --git a/programs/_include/_include.8 b/programs/_include/_include.8
new file mode 100644
index 000000000..56ffa0723
--- /dev/null
+++ b/programs/_include/_include.8
@@ -0,0 +1,35 @@
+.TH _INCLUDE 8 "25 Apr 2002"
+.\"
+.\" RCSID $Id: _include.8,v 1.1 2004/03/15 20:35:27 as Exp $
+.\"
+.SH NAME
+ipsec _include \- internal script to process config files
+.SH DESCRIPTION
+.I _include
+is used by
+.I _confread
+to process
+.B include
+directives in /etc/ipsec.conf.
+.SH "SEE ALSO"
+ipsec(8), ipsec__confread(8)
+.SH HISTORY
+Man page written for the Linux FreeS/WAN project <http://www.freeswan.org/>
+by Michael Richardson. Program written by Henry Spencer.
+.\"
+.\" $Log: _include.8,v $
+.\" Revision 1.1 2004/03/15 20:35:27 as
+.\" added files from freeswan-2.04-x509-1.5.3
+.\"
+.\" Revision 1.2 2002/04/29 22:39:31 mcr
+.\" added basic man page for all internal commands.
+.\"
+.\" Revision 1.1 2002/04/26 01:21:43 mcr
+.\" while tracking down a missing (not installed) /etc/ipsec.conf,
+.\" MCR has decided that it is not okay for each program subdir to have
+.\" some subset (determined with -f) of possible files.
+.\" Each subdir that defines $PROGRAM, MUST have a PROGRAM.8 file as well as a PROGRAM file.
+.\" Optional PROGRAM.5 files have been added to the makefiles.
+.\"
+.\"
+.\"
diff --git a/programs/_include/_include.in b/programs/_include/_include.in
new file mode 100755
index 000000000..10a8a49e4
--- /dev/null
+++ b/programs/_include/_include.in
@@ -0,0 +1,102 @@
+#! /bin/sh
+# implements nested file inclusion for control files, including wildcarding
+# Copyright (C) 1998, 1999 Henry Spencer.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# RCSID $Id: _include.in,v 1.2 2004/03/15 21:03:06 as Exp $
+#
+# Output includes marker lines for file changes:
+# "#< filename lineno" signals entry into that file
+# "#> filename lineno" signals return to that file
+# The lineno is the line number of the *next* line.
+#
+# Errors are reported with a "#:message" line rather than on stderr.
+#
+# Lines which look like marker and report lines are never passed through.
+
+IPSEC_NAME="strongSwan"
+
+usage="Usage: $0 file ..."
+me="ipsec _include"
+
+for dummy
+do
+ case "$1" in
+ --inband) ;; # back compatibility
+ --help) echo "$usage" ; exit 0 ;;
+ --version) echo "$me $IPSEC_VERSION" ; exit 0 ;;
+ --) shift ; break ;;
+ -*) echo "$0: unknown option \`$1'" >&2 ; exit 2 ;;
+ *) break ;;
+ esac
+ shift
+done
+
+case $# in
+0) echo "$usage" >&2 ; exit 2 ;;
+esac
+
+for f
+do
+ if test ! -r "$f"
+ then
+ if test ! "$f" = "/etc/ipsec.conf"
+ then
+ echo "#:cannot open configuration file \'$f\'"
+ if test "$f" = "/etc/ipsec.secrets"
+ then
+ echo "#:Your secrets file will be created when you start $IPSEC_NAME for the first time."
+ fi
+ exit 1
+ else
+ exit 1
+ fi
+ fi
+done
+
+awk 'BEGIN {
+ wasfile = ""
+}
+FNR == 1 {
+ print ""
+ print "#<", FILENAME, 1
+ lineno = 0
+ wasfile = FILENAME
+}
+{
+ lineno++
+ # lineno is now the number of this line
+}
+/^#[<>:]/ {
+ next
+}
+/^include[ \t]+/ {
+ orig = $0
+ sub(/[ \t]+#.*$/, "")
+ if (NF != 2) {
+ msg = "(" FILENAME ", line " lineno ")"
+ msg = msg " include syntax error in \"" orig "\""
+ print "#:" msg
+ exit 1
+ }
+ newfile = $2
+ if (newfile !~ /^\// && FILENAME ~ /\//) {
+ prefix = FILENAME
+ sub("[^/]+$", "", prefix)
+ newfile = prefix newfile
+ }
+ system("ipsec _include " newfile)
+ print ""
+ print "#>", FILENAME, lineno + 1
+ next
+}
+{ print }' $*