view build-aux/find-defun-files.sh @ 22095:6119019d42f6

move find-defun-files.sh and mkbuiltins to build-aux directory * build-aux/mk-builtins.sh: Rename from libinterp/mkbuiltins. Update option processing. Exit immediately on any error. * build-aux/find-defun-files.sh: Rename from libinterp/find-defun-files.sh. * Makefile.am (EXTRA_DIST): Add new files to the list. * libinterp/module.mk: Update.
author John W. Eaton <jwe@octave.org>
date Tue, 12 Jul 2016 09:12:55 -0400
parents libinterp/find-defun-files.sh@112b20240c87
children 592fa741e0aa
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|UN|UN_DLD|UNX|UNX_DLD)[ \t]*\\("

srcdir="$1"
if [ "$1" ]; then
  shift
fi

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