#!/bin/sh
#
# Columbia University Center for Computing Activities, 1987, 1988.
# Copyright (C) 1987, 1988, Trustees of Columbia University in the City
# of New York.  Permission is granted to any individual or institution
# to use, copy, or redistribute this software so long as it is not sold
# for profit, provided this copyright notice is retained.
#
#
# $Header: mmversion,v 1.3 88/08/08 17:32:47 melissa Exp $
#
# A hack to get rcs-id's and version info for mm.  A better way probably,
# exists.  Feel free to let us know.
#
# If no arguments are given, version information is given all of ./mm's 
# modules.
# If one argument is given, version information for all modules of specified
# executable or object file is displayed.
# If two or more arguments are specified, the first argument is a regular
# expression, and the remainder are executables or object files.
#

if [ $# = 1 ] && [ "$1" = "-h" ]; then
  echo "usage: $0 [ [ regexp ] executable ]"
  echo "       $0 regexp executable ..."
  exit 0
fi
if [ $# = 0 ]; then
  module=ALL
  prog=mm
elif [ $# = 1 ]; then
  module="ALL"
  prog=$1
else
  module=$1
  shift
  prog=$@
fi

if [ "$module" = "ALL" ]; then
  /usr/ucb/strings $prog | egrep '^Columbia|^Compiled|\$Header' |\
    sed -e 's/^\$Header\: //' -e 's/Exp \$$//' | sort 
else
  /usr/ucb/strings $prog | egrep '^Columbia|^Compiled|\$Header' |\
    sed -e 's/^\$Header\: //' -e 's/Exp \$$//' | sort |\
    egrep "^Columbia|^Compiled|$module"
fi

