More experimentation with the dependency logging features of cpp and xsltproc.
[mgear/mgear.git] / experiments / dep-logging / sip
CommitLineData
00804b7c
MM
1#!/bin/bash
2# Simple include processor as an example of a dependency-logging command.
3# sip input output depoutput
4# Follows `include foo' at the beginning of a line.
5
6exec 3>"$3"
7exec >"$2"
8
9function do_read {
10 echo "$1" >&3
cc1730d1 11 [ -r "$1" ] || exit 1
00804b7c
MM
12 while IFS='' read line; do
13 if [[ "$line" == "include "* ]]; then
14 do_read "${line#include }"
15 else
16 echo "$line"
17 fi
18 done <"$1"
19}
20
21do_read "$1"