From f90cfe8003cce52886c33077ba7579d8baeacb05 Mon Sep 17 00:00:00 2001 From: fred Date: Mon, 4 Aug 1997 22:05:08 +0000 Subject: [PATCH] lilypond-0.1.1 --- bin/mudela-book.in | 47 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/bin/mudela-book.in b/bin/mudela-book.in index 2481b37f16..11f27a40aa 100644 --- a/bin/mudela-book.in +++ b/bin/mudela-book.in @@ -1,8 +1,8 @@ -#!@PERL@ -w +#!@PERL@ -w +# -*-Perl-*- my $mudcount = 0; my $mudela_b = 0; -my $outdir = ""; -my $outname = ""; +my $outname = "-"; use Getopt::Long; sub gen_mufile @@ -19,7 +19,7 @@ sub close_mudela { $mudela_b = 0; if ($fragment_b) { - print MUDELA "}\n \\paper { linewidth = -1.0\\cm; } }\n"; + print MUDELA "}\n \\paper { linewidth = -1.0\\cm; castingalgorithm = \\Wordwrap; } }\n"; $fragment_b =0; } if ( $verbatim_b) { @@ -80,14 +80,42 @@ sub parse_mudela_opts $fragment_b = 1 if ($s =~ /fragment/ ); } +sub help +{ + print "usage: convert-mudela [options] [file] +options: +--help +--outdir=DIRECTORY write all files in directory DIRECTORY +--outname=NAME use NAME as base for the output +"; + exit; +} + sub main { - GetOptions( 'outdir=s', 'outname=s'); - $outdir = $opt_outdir; - $outname = $opt_outname if (defined ($opt_outname) && $opt_outname); - open INFILE, $ARGV[0]; + GetOptions( 'outdir=s', 'outname=s', 'help'); + help if ( $opt_help ) ; + + if (defined ($opt_outdir)) { + $outdir = $opt_outdir . "/"; + } else { + $outdir = ""; + } + + if (defined ($ARGV[0])) { + $infile = $ARGV[0] ; + } else { + $infile = "-"; + } + if (defined ($opt_outname)) { + $outname = $opt_outname ; + } else { + die "Need to have an output name, use --outname" if ( $infile == "-"); + $outname = "$infile.tex"; + } - open BOOK, ">$outdir/$outname"; + open INFILE, "<$infile"; + open BOOK, ">$outdir$outname"; while () { if ($mudela_b) { if (end_b "mudela") { @@ -117,4 +145,5 @@ sub main close BOOK; } + main; -- 2.39.5