merge from 1.8 branch
[bpt/guile.git] / guile-tools.in
index aaa5309..a4db08f 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-#      Copyright (C) 2001 Free Software Foundation, Inc.
+#      Copyright (C) 2001, 2003, 2006 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
@@ -14,8 +14,8 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this software; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-# Boston, MA 02111-1307 USA
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
 
 # Usage: See `help' func below.
 #
@@ -36,6 +36,7 @@ If PROGRAM is "list" or omitted, display contents of scripts dir, otherwise
 PROGRAM is run w/ ARGS.  Options (only one of which may be used at a time):
  --scriptsdir DIR    -- Look in DIR for scripts
  --guileversion VERS -- Look in $pkgdatadir/VERS/scripts for scripts
+ --source            -- Display PROGRAM source (ignore ARGS) to stdout
 
 Default scripts dir: $default_scriptsdir
 EOF
@@ -43,7 +44,7 @@ EOF
 
 prefix="@prefix@"
 pkgdatadir="@datadir@/@PACKAGE@"
-guileversion="@GUILE_VERSION@"
+guileversion="@GUILE_EFFECTIVE_VERSION@"
 default_scriptsdir=$pkgdatadir/$guileversion/scripts
 
 # pre-install invocation frob
@@ -89,6 +90,17 @@ if [ x"$1" = x -o x"$1" = xlist ] ; then
     exit 0
 fi
 
+if [ x"$1" = x--source ] ; then
+    if [ x"$2" = x ] ; then echo $0: need to specify program ; exit 1 ; fi
+    if [ -x $scriptsdir/$2 ] ; then
+        cat $scriptsdir/$2
+        exit 0
+    else
+        echo $0: no such program: $2
+        exit 1
+    fi
+fi
+
 program=$scriptsdir/$1
 shift