Use a shell script, rather than perl script, to make flags.xsl
authorIan Lynagh <igloo@earth.li>
Thu, 31 Dec 2009 15:50:04 +0000 (15:50 +0000)
committerIan Lynagh <igloo@earth.li>
Thu, 31 Dec 2009 15:50:04 +0000 (15:50 +0000)
docs/man/gen_flags.xsl.sh [moved from docs/man/gen_flags.xsl.pl with 94% similarity]
docs/man/ghc.mk

similarity index 94%
rename from docs/man/gen_flags.xsl.pl
rename to docs/man/gen_flags.xsl.sh
index a331792..28627ea 100644 (file)
@@ -1,15 +1,15 @@
-#!/usr/bin/perl -w
+#!/bin/sh
 
-use strict;
+if [ "$#" -ne 2 ]
+then
+    echo "Usage: $0 <ghc commands> <libdir>"
+    exit 1
+fi
 
-if ($#ARGV ne 1) {
-    die "Usage: $0 <ghc commands> <libdir>\n"
-}
+GHC_COMMANDS="$1"
+LIBDIR="$2"
 
-my @ghc_commands = split / /, $ARGV[0];
-my $libdir = $ARGV[1];
-
-print <<'EOF';
+cat <<'EOF'
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!DOCTYPE xsl:stylesheet [
 ]>
@@ -31,18 +31,22 @@ GHC \- the Glasgow Haskell Compiler
 .SH SYNOPSIS
 EOF
 
-my $started = 0;
-
-for my $ghc_command (@ghc_commands) {
-    print ".br\n" if $started;
-    $started = 1;
-    print <<"EOF";
-.B $ghc_command
+STARTED=0
+
+for GHC_COMMAND in $GHC_COMMANDS
+do
+    if [ "$STARTED" -ne 0 ]
+    then
+        echo ".br"
+    fi
+    STARTED=1
+    cat <<EOF
+.B $GHC_COMMAND
 .RI [ option | filename ]...
 EOF
-}
+done
 
-print <<'EOF';
+cat <<'EOF'
 
 .SH DESCRIPTION
 This manual page documents briefly the
@@ -107,8 +111,9 @@ interface files
 
 .SH FILES
 EOF
-print ".I $libdir";
-print <<'EOF';
+
+echo ".I $LIBDIR"
+cat <<'EOF'
 
 .SH COPYRIGHT
 
index 65ec327..c6eca08 100644 (file)
@@ -24,8 +24,8 @@ $(MAN_PATH): docs/man/flags.xsl docs/man/flags.xml
 endif
 
 # Insert the commands and the library directory into the man page
-docs/man/flags.xsl: docs/man/gen_flags.xsl.pl
-       $(PERL) $< "$(MAN_GHC_COMMANDS)" "$(libdir)" > $@
+docs/man/flags.xsl: docs/man/gen_flags.xsl.sh
+       $(SHELL) $< "$(MAN_GHC_COMMANDS)" "$(libdir)" > $@
 
 # Re-use the flags documentation from the user's guide by injecting some
 # entities after the XML declaration to make it a stand-alone document.