summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <rsc>2006-09-08 14:40:59 +0000
committerrsc <rsc>2006-09-08 14:40:59 +0000
commitfb6ddf3ea2ae8b1bbd15cb029147e3782cce3921 (patch)
tree9c81e5e5ecf45ad51cb9e96bc8b873348d1cac53
parent66d46d691def24c1d76b43efd911dcab641fbe7c (diff)
downloadxv6-labs-fb6ddf3ea2ae8b1bbd15cb029147e3782cce3921.tar.gz
xv6-labs-fb6ddf3ea2ae8b1bbd15cb029147e3782cce3921.tar.bz2
xv6-labs-fb6ddf3ea2ae8b1bbd15cb029147e3782cce3921.zip
tweaks
-rwxr-xr-xrunoff2
-rwxr-xr-xrunoff113
2 files changed, 12 insertions, 3 deletions
diff --git a/runoff b/runoff
index 6ee8225..46c63d1 100755
--- a/runoff
+++ b/runoff
@@ -10,7 +10,7 @@ pad()
# create formatted (numbered) files
mkdir -p fmt
-rm fmt/*
+rm -f fmt/*
cp README fmt
files=`grep -v '^#' runoff.list | awk '{print $1}'`
n=99
diff --git a/runoff1 b/runoff1
index ed29ea5..68e4565 100755
--- a/runoff1
+++ b/runoff1
@@ -1,6 +1,11 @@
#!/usr/bin/perl
$n = 0;
+$v = 0;
+if($ARGV[0] eq "-v") {
+ $v = 1;
+ shift @ARGV;
+}
if($ARGV[0] eq "-n") {
$n = $ARGV[1];
shift @ARGV;
@@ -38,12 +43,13 @@ for($i=0; $i<@lines; ){
$breaksize = 15; # 15 lines to get to function
for($j=$i; $j<$i+50 && $j < @lines; $j++){
if($lines[$j] =~ /PAGEBREAK:\s*([0-9]+)/){
- $breaksize = int($2);
+ $breaksize = $1;
$breakbefore = $j;
$lines[$j] = "";
}
if($lines[$j] =~ /^};?$/){
$breakbefore = $j+1;
+ $breaksize = 15;
}
if($lines[$j] =~ /^{$/){
$sawbrace = 1;
@@ -59,9 +65,12 @@ for($i=0; $i<@lines; ){
if($j<@lines && $lines[$j] =~ /^$/){
$lastblank = $j;
}
-
+
# If we are not putting enough on a page, try a blank line.
if($breakbefore - $i < 50 - $breaksize && $lastblank > $breakbefore && $lastblank >= $i+50 - 5){
+ if($v){
+ print STDERR "breakbefore $breakbefore i $i breaksize $breaksize\n";
+ }
$breakbefore = $lastblank;
$breaksize = 5; # only 5 lines to get to blank line
}