view src/find-defun-files.sh @ 13791:4cf7356a99d0

find-defun-files.sh: allow sed command to work with OpenBSD sed * find-defun-files.sh: Avoid extended regexp in sed command.
author John W. Eaton <jwe@octave.org>
date Wed, 02 Nov 2011 12:40:29 -0400
parents 3275dda012f7
children e753177cde93
line wrap: on
line source

#! /bin/sh

set -e
SED=${SED:-sed}
EGREP=${EGREP:-egrep}

# Some stupid egreps don't like empty elements in alternation patterns,
# so we have to repeat ourselves because some stupid egreps don't like
# empty elements in alternation patterns.

DEFUN_PATTERN="^[ \t]*DEF(CONSTFUN|CMD|UN|UN_DLD|UNX_DLD|UN_TEXT)[ \t]*\\("

srcdir="$1"
shift

for arg
do
  if [ -f "$arg" ]; then
    file="$arg"
  else
    file="$srcdir/$arg"
  fi
  if [ "`$EGREP -l "$DEFUN_PATTERN" $file`" ]; then
    echo "$file" | $SED 's,.*/,,; s/\.cc$/.df/; s/\.ll$/.df/; s/\.yy$/.df/';
  fi
done