1 | XBRESTL1 ; acc/ohprd - routine to restore 1st line of routines from save file ;
|
---|
2 | ;;4.0;XB;;Jul 20, 2009;Build 2
|
---|
3 | ;
|
---|
4 | W !!,"-- ROUTINE TO RESTORE 1ST LINE OF ROUTINES FROM %RS FILE --",!
|
---|
5 | W "CAUTION: THIS ROUTINE KILLS ALL VARIABLES, IS NOT NAMESPACED.",!
|
---|
6 | R "ABORT HERE (^ OR CTL-C) OR PRESS RETURN TO CONTINUE: ",%:$S($D(DTIME):DTIME,1:999),! I %="^" W "-- aborted.",! G OUT
|
---|
7 | W !
|
---|
8 | K
|
---|
9 | GETFN R "Name of %RS-format save file: ",FN:$S($D(DTIME):DTIME,1:999),! G:"^"[FN EXIT
|
---|
10 | I FN["?" W "(Enter the name of a unix file containing routines which was produced by %RS)",! G GETFN
|
---|
11 | D GETHFS E W "-- couldn't get HFS device!",! G EXIT
|
---|
12 | U DEV
|
---|
13 | R L1,L2
|
---|
14 | U 0
|
---|
15 | W "Header lines from %RS file:",!,?2,L1,!,?2,L2,!
|
---|
16 | R "OK to proceed: N// ",%:$S($D(DTIME):DTIME,1:999),! S %=$E(%_"N") I "Yy"'[% W "-- aborted.",! G OUT
|
---|
17 | F NR=1:1 D GETR Q:RN="" W:NR=1 "Routines repaired:",! W ?2,$J(NR,3),": ",RL1,! D FIXL1
|
---|
18 | C DEV
|
---|
19 | EXIT W "Bye.",!
|
---|
20 | OUT K
|
---|
21 | Q
|
---|
22 | GETHFS ;
|
---|
23 | F DEV=51:1:54 O DEV:(FN:"R"):1 Q:$T
|
---|
24 | E S DEV=0
|
---|
25 | Q
|
---|
26 | GETR ;
|
---|
27 | U DEV
|
---|
28 | R RN Q:RN=""
|
---|
29 | R RL1
|
---|
30 | F R RL Q:RL=""
|
---|
31 | U 0
|
---|
32 | Q
|
---|
33 | FIXL1 ;
|
---|
34 | X "ZL @RN ZR +1 ZI RL1 ZS @RN"
|
---|
35 | Q
|
---|