2022-08-08 16:56:11 +00:00
|
|
|
#!/bin/rc
|
|
|
|
rfork e
|
|
|
|
|
|
|
|
nl='
|
|
|
|
'
|
|
|
|
|
|
|
|
fn prfile {
|
|
|
|
echo -n `{date $flagu -f 'MMM DD hh:mm:ss ZZZ YYYY' `{walk -e m $1}}
|
2022-11-15 21:58:00 +00:00
|
|
|
walk -e psM $1 | awk '{$NF="["$NF"]"; print " "$0}'
|
2022-08-08 16:56:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn diffflags {
|
|
|
|
t=()
|
|
|
|
for(f in a b c e m n w) {
|
|
|
|
flagname=flag$f
|
|
|
|
if(~ $$flagname 1)
|
|
|
|
t=(-$f $t)
|
|
|
|
}
|
|
|
|
echo $t
|
|
|
|
}
|
|
|
|
|
|
|
|
fn ysearch {
|
|
|
|
if(~ $1 /*)
|
|
|
|
file=$1
|
|
|
|
if not
|
|
|
|
file=`{pwd}^/$1
|
|
|
|
|
|
|
|
if(test -f $file)
|
|
|
|
prfile $file
|
|
|
|
if not
|
|
|
|
echo history: warning: $file does not exist >[1=2]
|
|
|
|
|
|
|
|
old=()
|
2024-07-18 16:49:31 +00:00
|
|
|
list $file |
|
2022-08-08 16:56:11 +00:00
|
|
|
sed 's/\(([^ ]*) *([^ ]*) *([^ ]*)\)/\1\2\3/p' |
|
|
|
|
awk '"/n/'$dump/$since'" <= $2 {next}
|
|
|
|
$1 != qid {
|
|
|
|
qid=$1
|
2022-11-15 21:58:00 +00:00
|
|
|
gsub($1"[ \t]+", "")
|
2022-08-08 16:56:11 +00:00
|
|
|
print}' |
|
|
|
|
while(new=`$nl{read}){
|
|
|
|
prfile $new
|
|
|
|
if (~ $flagD 1 && ~ $#old 1)
|
|
|
|
diff `{diffflags} $new $old
|
|
|
|
old=$new
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-18 16:49:31 +00:00
|
|
|
flagfmt='D,a,b,f,c,e,m,n,w,u,t:tag tag,d:dump,s since'
|
2022-08-08 16:56:11 +00:00
|
|
|
args='[ -Dabcemnw ] [ -uf ] [ -d dumpfilesystem ] [ -s yyyymmdd ] files ...'
|
|
|
|
if(! ifs=() eval `{aux/getflags $*} ||
|
|
|
|
~ $#* 0 ||
|
|
|
|
! ~ $#dump 0 && ! ~ $#dump 1 ||
|
|
|
|
! ~ $#flags 0 && ! ~ $#flags 1) {
|
|
|
|
aux/usage
|
|
|
|
exit usage
|
|
|
|
}
|
|
|
|
|
|
|
|
if(~ $#dump 0)
|
|
|
|
dump=dump
|
2024-07-18 16:49:31 +00:00
|
|
|
if(~ $#tag 0)
|
|
|
|
tag=main
|
2022-08-08 16:56:11 +00:00
|
|
|
if(~ $#flags 0)
|
|
|
|
flags=`{date -f 'YYYYMMDD'}
|
|
|
|
|
|
|
|
if(~ $#flagu 1)
|
|
|
|
flagu=-u
|
|
|
|
|
2024-07-18 16:49:31 +00:00
|
|
|
# probably gefs
|
|
|
|
if(test -e /n/$dump/adm){
|
|
|
|
fn list { ls -Qqr /n/$dump/$tag@day.*/$1 >[2] /dev/null }
|
|
|
|
since=`{date -f '[main@day.]YYYY.MM.DD[_]hh:mm:ss' `{seconds -f 'YYYYMMDD' $flags}}
|
|
|
|
}
|
|
|
|
if not {
|
|
|
|
fn list { ls -Qqr /n/$dump/*/*/$1 >[2] /dev/null }
|
|
|
|
since=`{date -f 'YYYY\/MMDD' `{seconds -f 'YYYYMMDD' $flags}}
|
|
|
|
}
|
2022-08-08 16:56:11 +00:00
|
|
|
|
|
|
|
9fs $dump
|
|
|
|
|
|
|
|
for(arg in $*)
|
|
|
|
ysearch $arg
|