[public] / psiconv / formats / index_html.sh Repository:
ViewVC logotype

View of /psiconv/formats/index_html.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Thu Apr 29 21:43:28 2004 UTC (6 years, 4 months ago) by frodo
Branch: MAIN
CVS Tags: rel-0-9-8, rel-0-9-7, HEAD
Changes since 1.2: +6 -7 lines
(Frodo) Solaris /bin/sh compatibility updates

/bin/sh on Solaris is just braindead, if you are used to bash (or even
Sun's ksh)

#! /bin/sh

make_targets_file()
{
#  local file line line_nr error targets_file files
  targets_file="$1"
  shift
  files="$@"
  printf "" > "$targets_file"

  for file in $files; do
    (
      line_nr=1
      while read line; do
        error=0
        while [ $error -eq 0 ] && echo $line | grep '\[' >/dev/null ; do
          if echo $line | grep '\[.*\]' >/dev/null; then
            printf "%s %s " "$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
        if [ $error -eq 0 ] && echo $line | grep '\]' >/dev/null ; then
          echo "In \`$file\' line $line_nr: target brackets inbalance" >&2
          error=1
        fi
	line_nr=`echo "$line_nr + 1" | bc`
      done
    ) < $file
  done
}


make_targets_file "$@"

CVS Admin
ViewVC Help
Powered by ViewVC 1.0.5