From f53ac639c697ac22aa1ae99dfe9a1b276ba159e5 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Sun, 26 Feb 2006 10:44:57 +0000 Subject: [PATCH] Break out deltree in its' own command procedure. --- test/testca.com | 33 ++------------------------------- util/deltree.com | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 31 deletions(-) create mode 100644 util/deltree.com diff --git a/test/testca.com b/test/testca.com index c670f2bf5f..75020e3cc0 100644 --- a/test/testca.com +++ b/test/testca.com @@ -11,7 +11,7 @@ $ $ set noon $ if f$search("demoCA.dir") .nes. "" $ then -$ call deltree [.demoCA]*.* +$ @[-.utils]deltree [.demoCA]*.* $ set file/prot=(S:RWED,O:RWED,G:RWED,W:RWED) demoCA.dir;* $ delete demoCA.dir;* $ endif @@ -38,7 +38,7 @@ $ @[-.apps]CA.com -verify newcert.pem $ if $severity .ne. 1 then exit 3 $ $ set noon -$ call deltree [.demoCA]*.* +$ @[-.utils]deltree [.demoCA]*.* $ set file/prot=(S:RWED,O:RWED,G:RWED,W:RWED) demoCA.dir;* $ delete demoCA.dir;* $ if f$search("newcert.pem") .nes. "" then delete newcert.pem;* @@ -47,32 +47,3 @@ $ set on $! #usage: CA -newcert|-newreq|-newca|-sign|-verify $ $ exit -$ -$ deltree: subroutine ! P1 is a name of a directory -$ on control_y then goto dt_STOP -$ on warning then goto dt_exit -$ _dt_def = f$trnlnm("SYS$DISK")+f$directory() -$ if f$parse(p1) .eqs. "" then exit -$ set default 'f$parse(p1,,,"DEVICE")''f$parse(p1,,,"DIRECTORY")' -$ p1 = f$parse(p1,,,"NAME") + f$parse(p1,,,"TYPE") -$ _fp = f$parse(".DIR",p1) -$ dt_loop: -$ _f = f$search(_fp) -$ if _f .eqs. "" then goto dt_loopend -$ call deltree [.'f$parse(_f,,,"NAME")']*.* -$ goto dt_loop -$ dt_loopend: -$ _fp = f$parse(p1,".;*") -$ if f$search(_fp) .eqs. "" then goto dt_exit -$ set noon -$ set file/prot=(S:RWED,O:RWED,G:RWED,W:RWED) '_fp' -$ set on -$ delete/nolog '_fp' -$ dt_exit: -$ set default '_dt_def' -$ exit -$ dt_STOP: -$ set default '_dt_def' -$ stop/id="" -$ exit -$ endsubroutine diff --git a/util/deltree.com b/util/deltree.com new file mode 100644 index 0000000000..9f36b1a5e9 --- /dev/null +++ b/util/deltree.com @@ -0,0 +1,34 @@ +$! DELTREE.COM +$ +$ call deltree 'p1' +$ exit $status +$ +$ deltree: subroutine ! P1 is a name of a directory +$ on control_y then goto dt_STOP +$ on warning then goto dt_exit +$ _dt_def = f$trnlnm("SYS$DISK")+f$directory() +$ if f$parse(p1) .eqs. "" then exit +$ set default 'f$parse(p1,,,"DEVICE")''f$parse(p1,,,"DIRECTORY")' +$ p1 = f$parse(p1,,,"NAME") + f$parse(p1,,,"TYPE") +$ _fp = f$parse(".DIR",p1) +$ dt_loop: +$ _f = f$search(_fp) +$ if _f .eqs. "" then goto dt_loopend +$ call deltree [.'f$parse(_f,,,"NAME")']*.* +$ goto dt_loop +$ dt_loopend: +$ _fp = f$parse(p1,".;*") +$ if f$search(_fp) .eqs. "" then goto dt_exit +$ set noon +$ set file/prot=(S:RWED,O:RWED,G:RWED,W:RWED) '_fp' +$ set on +$ delete/nolog '_fp' +$ dt_exit: +$ set default '_dt_def' +$ goto dt_end +$ dt_STOP: +$ set default '_dt_def' +$ stop/id="" +$ exit +$ dt_end: +$ endsubroutine -- 2.25.1