From 856e63f63eb829a53ae5f6f6957d93717a561f86 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 16 Feb 2009 14:14:21 +0100 Subject: [PATCH] Add m4.sh to process files with m4. The syntax is `m4.sh filename args-to-m4` which processes filename.m4 and writes it to filename. Additional arguments are passed to m4. This script differs from just calling m4 that it writes the header "Do not edit this file" to the generated file to prevent accidental changes. --- m4.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 m4.sh diff --git a/m4.sh b/m4.sh new file mode 100755 index 0000000..760ff0e --- /dev/null +++ b/m4.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# m4 wrapper script which uses $1.m4 as template file, feeds it to m4 and +# writes it to m4 with a warning at the beginning to not edit the generated +# file. +# +# All arguments to this script (except the first which is the filename) are +# passed to m4. + + +# First argument is file name. +file=$1 +shift + +# Write a warning to the generated file. +echo "###################################" > $file +echo "# WARNING! DO NOT EDIT THIS FILE! #" >> $file +echo "###################################" >> $file +echo >> $file +echo "# It was generated from $file.m4 on `date`." >> $file +echo >> $file + +# Process $1.m4 with m4 using the given options. +m4 $* $file.m4 >> $file -- 2.45.2