--- psiconv/trunk/formats/index_html.sh 1999/10/03 21:10:47 2 +++ psiconv/trunk/formats/index_html.sh 2002/05/10 16:15:10 149 @@ -1,9 +1,8 @@ -#!/bin/sh +#! /bin/sh -function make_targets_file +make_targets_file() { - local file line line_nr error targets_file files - +# local file line line_nr error targets_file files targets_file="$1" shift files="$@" @@ -15,13 +14,14 @@ while read line; do error=0 while [ $error -eq 0 ] && echo $line | grep -q '\[' ; do - if ! echo $line | grep -q '\[.*\]'; then - echo "In \`$file\' line $line_nr: target brackets inbalance" >&2 - error=1 - else + if echo $line | grep -q '\[.*\]'; then +# The use of ! is not portable. echo -n "$file $line_nr " >> "$targets_file" echo $line | sed -e 's,^[^\[]*\[,,' -e 's,\].*$,,' \ >> "$targets_file" + else + echo "In \`$file\' line $line_nr: target brackets inbalance" >&2 + error=1 fi line=`echo $line | sed -e 's,^[^]]*\],,'` done