From: sysop@robot.nuceng.ufl.edu (Shawn A. Clifford)
Subject: Re: HELP undelete (UNDELETE.003-OF-003)
News-Software: VAX/VMS VNEWS 1.41    
Keywords:  UNDELETE
Reply-To: sysop@robot.nuceng.ufl.edu
Organization: Nuclear Engineering Sciences - Univ. of Florida
Date: 13 Oct 1992 12:31 EST  

-+-+-+-+-+-+-+-+ START OF PART 3 -+-+-+-+-+-+-+-+
X`09Attributes.FPRO.Attrib_Addr`09:= IADDRESS(Header`5E.Header.FH$FILEPROT);
X   `20
X`09Attributes.CREDATE.Attrib_Size`09:= ATR$S_CREDATE;
X`09Attributes.CREDATE.Attrib_Type`09:= ATR$C_CREDATE;
X`09Attributes.CREDATE.Attrib_Addr`09:= IADDRESS(Ident`5E.FI$CREDATE);
X   `20
X`09Attributes.BAKDATE.Attrib_Size`09:= ATR$S_BAKDATE;
X`09Attributes.BAKDATE.Attrib_Type`09:= ATR$C_BAKDATE;
X`09Attributes.BAKDATE.Attrib_Addr`09:= IADDRESS(Ident`5E.FI$BAKDATE);
X   `20
X`09Attributes.EXPDATE.Attrib_Size`09:= ATR$S_EXPDATE;
X`09Attributes.EXPDATE.Attrib_Type`09:= ATR$C_EXPDATE;
X`09Attributes.EXPDATE.Attrib_Addr`09:= IADDRESS(Ident`5E.FI$EXPDATE);
X   `20
X`09Attributes.Tail := 0;
X   `20
X`09REPEAT
X`09    Status := $QIOW(`09CHAN`09:= Channel,
X`09`09`09`09FUNC`09:= IO$_CREATE + IO$M_CREATE + IO$M_ACCESS,
X`09`09`09`09IOSB`09:= FIB$IOSB,
X`09`09`09`09P1`09:= FIB$DESCR,
X`09`09`09`09P2`09:= IADDRESS(Name_Desc),
X`09`09`09`09P3`09:= IADDRESS(New_File.Length),
X`09`09`09`09P4`09:= IADDRESS(New_File_Desc),
X`09`09`09`09P5`09:= IADDRESS(Attributes));
X`09    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X
X`09    FIB`5E.FIB$W_NMCTL`09:= FIB$M_NEWVER;
X`09UNTIL FIB$IOSB.Status <> SS$_DUPFILENAME;
X
X`09IF NOT ODD(FIB$IOSB.Status)`20
X`09THEN BEGIN
X`09    Created.ARG$COUNT`09`09:= 5;
X`09    Created.DEF$MESSAGE$OPT`09:= 0;
X`09    Created.MESSAGE$CODE`09:= IADDRESS(UNDELETE_WRITERR);
X`09    Created.FAO$COUNT`09`09:= 1;
X`09    Created.NEW$MESSAGE$OPT`09:= 0;
X`09    Created.FAO$1`09`09:= IADDRESS(Name_Desc);
X`09    Created.FAO$2`09`09:= FIB$IOSB.Status;
X`09    Created.FAO$3`09`09:= 0;
X`09    Status := $PUTMSG(`09MSGVEC`09:= Created);
X`09    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X`09END
X`09ELSE BEGIN
X`09    Status := $QIOW(`09CHAN`09:= Channel,
X`09`09`09`09FUNC`09:= IO$_WRITEVBLK,
X`09`09`09`09IOSB`09:= FIB$IOSB,
X`09`09`09`09P1`09:= Header`5E.Data`5E,
X`09`09`09`09P2`09:= Header`5E.Data_Length,
X`09`09`09`09P3`09:= 1);
X`09    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X`09    IF NOT ODD(FIB$IOSB.Status) THEN LIB$SIGNAL(FIB$IOSB.Status);
X
X`09    FIB`5E.FIB$W_DID_NUM`09:= 0;
X`09    FIB`5E.FIB$W_EXCTL`09:= 0;
X`09    FIB`5E.FIB$L_ACCTL`09:= 0;
X`09    FIB`5E.FIB$W_NMCTL`09:= 0;
X
X`09    Status := $QIOW(`09CHAN`09:= Channel,
X`09`09`09`09FUNC`09:= IO$_DEACCESS,
X`09`09`09`09IOSB`09:= FIB$IOSB,
X`09`09`09`09P1`09:= FIB$DESCR);
X`09    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X`09    IF NOT ODD(FIB$IOSB.Status) THEN LIB$SIGNAL(FIB$IOSB.Status);
X
X`09    Created.ARG$COUNT`09`09:= 6;
X`09    Created.DEF$MESSAGE$OPT`09:= 0;
X`09    Created.MESSAGE$CODE`09:= IADDRESS(UNDELETE_WRITTEN);
X`09    Created.FAO$COUNT`09`09:= 4;
X`09    Created.NEW$MESSAGE$OPT`09:= 0;
X`09    Created.FAO$1`09`09:= Name.Length;
X`09    Created.FAO$2`09`09:= IADDRESS(Name.Body);
X`09    Created.FAO$3`09`09:= New_File.Length;
X`09    Created.FAO$4`09`09:= IADDRESS(New_File.Body);
X`09    Status := $PUTMSG(`09MSGVEC`09:= Created);
X`09    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X`09END;
X
X`09Header := Header`5E.Link;
X    END;
X
X    DISPOSE(FIB);
X
X    Status := $DASSGN(`09CHAN`09:= Channel);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
XEND;
X
X`7B`0C----------------------------------------------------------------------
V----`7D
X
XBEGIN
X    Filename_Desc.Length  := SIZE(Filename.Body);
X    Filename_Desc.Dtype   := DSC$K_DTYPE_VT;
X    Filename_Desc.Class   := DSC$K_CLASS_VS;
X    Filename_Desc.Address := IADDRESS(Filename);
X
X    Status := CLI$GET_VALUE('Filename', Filename_Desc);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);`20
X
X    DN := '.*;*';
X
X    NEW(NAM);
X    NAM`5E.NAM$B_BID`09:= NAM$C_BID;
X    NAM`5E.NAM$B_BLN`09:= NAM$C_BLN;
X    NAM`5E.NAM$L_ESA`09:= IADDRESS(ES.Body);
X    NAM`5E.NAM$B_ESS`09:= LENGTH(ES.Body);
X    NAM`5E.NAM$L_RSA`09:= IADDRESS(RS.Body);
X    NAM`5E.NAM$B_RSS`09:= LENGTH(RS.Body);
X
X    NEW(FAB);
X    FAB`5E.FAB$B_BID`09:= FAB$C_BID;
X    FAB`5E.FAB$B_BLN`09:= FAB$C_BLN;
X    FAB`5E.FAB$L_FNA`09:= IADDRESS(Filename.Body);
X    FAB`5E.FAB$B_FNS`09:= Filename.Length;
X    FAB`5E.FAB$L_DNA`09:= IADDRESS(DN.Body);
X    FAB`5E.FAB$B_DNS`09:= DN.Length;
X    FAB`5E.FAB$L_NAM`09:= IADDRESS(NAM`5E);
X
X    Status := $PARSE(FAB`5E);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X
X    Device := SUBSTR(NAM`5E.NAM$T_DVI, 2, ORD(NAM`5E.NAM$T_DVI`5B1`5D));
X
X    Status := $ASSIGN(`09DEVNAM`09:= Device,
X`09`09`09CHAN`09:= Channel);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X
X    NEW(FIB);
X    FIB`5E.FIB$W_FID_NUM`09:= 1;
X    FIB`5E.FIB$W_FID_SEQ`09:= 1;
X    FIB`5E.FIB$L_ACCTL`09:= FIB$M_WRITE + FIB$M_NORECORD;
X
X    FIB$DESCR.Class   := 0;
X    FIB$DESCR.Dtype   := 0;
X    FIB$DESCR.Length  := SIZE(FIB`5E);
X    FIB$DESCR.Address := IADDRESS(FIB`5E);
X
X
X    Status := $QIOW(`09CHAN`09:= Channel,
X`09`09`09FUNC`09:= IO$_ACCESS + IO$M_ACCESS,
X`09`09`09IOSB`09:= FIB$IOSB,
X`09`09`09P1`09:= FIB$DESCR);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X    IF NOT ODD(FIB$IOSB.Status) THEN LIB$SIGNAL(FIB$IOSB.Status);
X
X    Status := $QIOW(`09CHAN`09:= Channel,
X`09`09`09FUNC`09:= IO$_READVBLK,
X`09`09`09IOSB`09:= FIB$IOSB,
X`09`09`09P1`09:= Home,
X`09`09`09P2`09:= SIZE(Home),
X`09`09`09P3`09:= 2);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X    IF NOT ODD(FIB$IOSB.Status) THEN LIB$SIGNAL(FIB$IOSB.Status);
X
X    Status := $QIOW(`09CHAN`09:= Channel,
X`09`09`09FUNC`09:= IO$_READVBLK,
X`09`09`09IOSB`09:= FIB$IOSB,
X`09`09`09P1`09:= Bitmap,
X`09`09`09P2`09:= SIZE(Bitmap),
X`09`09`09P3`09:= Home.HM$IBMAPVBN);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X    IF NOT ODD(FIB$IOSB.Status) THEN LIB$SIGNAL(FIB$IOSB.Status);
X
X    Status := $QIOW(`09CHAN`09:= Channel,
X`09`09`09FUNC`09:= IO$_DEACCESS,
X`09`09`09IOSB`09:= FIB$IOSB,
X`09`09`09P1`09:= FIB$DESCR);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X    IF NOT ODD(FIB$IOSB.Status) THEN LIB$SIGNAL(FIB$IOSB.Status);
X
X    FIB`5E.FIB$L_ACCTL`09:= 0;
X
X    Status := $QIOW(`09CHAN`09:= Channel,
X`09`09`09FUNC`09:= IO$_ACCESS + IO$M_ACCESS,
X`09`09`09IOSB`09:= FIB$IOSB,
X`09`09`09P1`09:= FIB$DESCR);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X    IF NOT ODD(FIB$IOSB.Status) THEN LIB$SIGNAL(FIB$IOSB.Status);
X
X
X    Header_List := NIL;
X
X    IB_Index := 1;
X    Status := SS$_NORMAL;
X    REPEAT
X`09IF Bitmap`5BIB_Index`5D = FALSE
X`09THEN Status := Check_Header(IB_Index);
X
X`09IB_Index := IB_Index + 1;
X    UNTIL Status <> SS$_NORMAL;
X
X
X    Status := $QIOW(`09CHAN`09:= Channel,
X`09`09`09FUNC`09:= IO$_DEACCESS,
X`09`09`09IOSB`09:= FIB$IOSB,
X`09`09`09P1`09:= FIB$DESCR);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X    IF NOT ODD(FIB$IOSB.Status) THEN LIB$SIGNAL(FIB$IOSB.Status);
X
X    Status := LIB$GETJPI(ITMCODE  := JPI$_PROCPRIV, OUTVAL := Proc_Priv);
X    IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X
X    IF Proc_Priv`5BPRV$V_SYSPRV`5D = FALSE
X    THEN BEGIN
X`09$SETPRV(ENBFLG`09:= 0,
X`09`09PRVADR`09:= PRV$M_SYSPRV);
X`09IF NOT ODD(Status) THEN LIB$SIGNAL(Status);
X    END;
X
X    Read_Files;
X
X    Write_Files;
XEND.
$ CALL UNPACK UNDELETE.PAS;1 1683804827
$ create 'f'
X.TITLE`09`09UNDELETE Error and Warning  Messages
X.IDENT`09`09'VERSION 4.00'
X.FACILITY`09UNDELETE, 1`20
X.SEVERITY`09INFORMATIONAL
XLOCATED`09`09<located file !AS> /FAO_COUNT=1
X.SEVERITY`09INFORMATIONAL
XNONFOUND`09<no files found>`20
X.SEVERITY`09INFORMATIONAL
XWRITTEN`09`09<deleted file !AD written to !AD> /FAO_COUNT=4
X.SEVERITY`09ERROR
XWRITERR`09`09<error restoring deleted file !AS> /FAO_COUNT=1
X.END
$ CALL UNPACK UNDELETE_MSG.MSG;1 521764086
$ v=f$verify(v)
$ EXIT