version 1.1, 2006/12/01 23:41:33
|
version 1.2, 2006/12/04 18:12:22
|
Line 1
|
Line 1
|
#!/usr/bin/perl |
#!/usr/bin/perl |
|
use strict; |
|
|
if ($#ARGV != 0) { |
if ($#ARGV != 0) { |
print "Correct command usage: \n"; |
print("Correct command usage: \n"); |
print " perl buildTexxml.pl all\n"; |
print(" perl buildTexxml.pl all\n"); |
print "Or \n"; |
print("Or \n"); |
print " perl buildTexxml.pl section\n"; |
print(" perl buildTexxml.pl section\n"); |
} |
} |
|
|
$option = $ARGV[0]; |
my $option = $ARGV[0]; |
|
|
@section = `cat section_order.txt`; |
my @section = `cat section_order.txt`; |
chomp @section; |
chomp(@section); |
|
|
if($option eq 'all') { |
if ($option eq 'all') { |
foreach $section (@section) { |
my $section_list; |
$section='sections/'.$section; |
foreach my $section (@section) { |
$section_list=$section_list.$section.' '; |
$section_list .= 'sections/'.$section.' '; |
} |
} |
`cat sections/start.texxml $section_list sections/end.texxml > course.manual.texxml`; |
system("cat sections/start.texxml $section_list sections/end.texxml > course.manual.texxml"); |
} |
} |
|
|
if($option eq 'section') { |
if ($option eq 'section') { |
print "Choose from the following manual sections:\n"; |
print("Choose from the following manual sections:\n"); |
$num=0; |
my $num=0; |
foreach $section (@section) { |
foreach my $section (@section) { |
print "$num - $section\n"; |
print("$num - $section\n"); |
$num++; |
$num++; |
} |
} |
print "Enter a number 0 - $num for the section you want to print: "; |
$num--; |
$selection=<STDIN>; |
|
print "builing section...\n"; |
print("Enter a number 0 - $num for the section you want to print: "); |
`cat sections/start.texxml sections/$section[$selection] sections/end.texxml > section.manual.texxml`; |
my $selection=<STDIN>; |
|
chomp($selection); |
|
|
|
if ($selection < 0 || $selection > $#section) { |
|
print("Invalid selection ($selection)\n"); |
|
exit(1); |
|
} |
|
print("builing section $section[$selection]\n"); |
|
system("cat sections/start.texxml sections/$section[$selection] sections/end.texxml > section.manual.texxml"); |
} |
} |
|
|