aboutsummaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-07-23 14:36:05 +0000
committerrsc <devnull@localhost>2006-07-23 14:36:05 +0000
commit32a580f43cdd51e6b9bbeda91d905cecf3bd68ec (patch)
tree80c3135ed6f76f12c89f73e005e78e82a1b708f0 /dist
parent604b5fcda415436a4a8e42fcf764c24ae2ca9ed5 (diff)
downloadplan9port-32a580f43cdd51e6b9bbeda91d905cecf3bd68ec.tar.gz
plan9port-32a580f43cdd51e6b9bbeda91d905cecf3bd68ec.tar.bz2
plan9port-32a580f43cdd51e6b9bbeda91d905cecf3bd68ec.zip
show current directory
Diffstat (limited to 'dist')
-rw-r--r--dist/isum.awk51
1 files changed, 51 insertions, 0 deletions
diff --git a/dist/isum.awk b/dist/isum.awk
index fbb2cb92..cb29eb31 100644
--- a/dist/isum.awk
+++ b/dist/isum.awk
@@ -5,7 +5,29 @@ BEGIN {
# print verbose
cd = ""
out = "/dev/stdout"
+ statuslen = 0
debug = 0
+ updates = "/dev/stderr"
+}
+
+function clearstatus( i)
+{
+ if(!updates)
+ return
+ for(i=0; i<statuslen; i++)
+ printf("\b \b") >updates
+ statuslen = 0
+ fflush(updates)
+}
+
+function status(s)
+{
+ if(!updates)
+ return
+ clearstatus()
+ printf(" %s ", s) >updates
+ statuslen = length(s)+5
+ fflush(updates)
}
debug!=0 { print "# " $0 }
@@ -16,9 +38,14 @@ debug!=0 { print "# " $0 }
/^\+\+ pwd/ { next }
/^\* /{
+ clearstatus()
if(debug) print "% mark"
print >out
fflush(out)
+ if(copy){
+ print >copy
+ fflush(copy)
+ }
cmd = ""
printtabs = 1 # print indented lines immediately following
errors = 0
@@ -26,8 +53,13 @@ debug!=0 { print "# " $0 }
}
/^ / && printtabs!=0 {
+ clearstatus()
print >out
fflush(out)
+ if(copy){
+ print >copy
+ fflush(copy)
+ }
next
}
@@ -49,6 +81,15 @@ debug!=0 { print "# " $0 }
if(verbose){
print >out
fflush(out)
+ if(copy){
+ print >copy
+ fflush(copy)
+ }
+ }
+ else{
+ dir = $2
+ sub(/;$/, "", dir)
+ status(dir)
}
cd = $0 "\n"
cmd = ""
@@ -60,9 +101,14 @@ debug!=0 { print "# " $0 }
}
errors != 0 {
+ clearstatus()
if(debug) print "% errors"
printf "%s", cmd >out
fflush(out)
+ if(copy){
+ printf "%s", cmd >copy
+ fflush(copy)
+ }
cmd = ""
next
}
@@ -87,10 +133,15 @@ errors != 0 {
{
# unexpected line
+ clearstatus()
if(debug) print "% errors1"
errors = 1
printf ">>> %s", cmd >out
fflush(out)
+ if(copy){
+ printf ">>> %s", cmd >copy
+ fflush(copy)
+ }
cmd = ""
}