[mod.computers.vax] TDUGGAN@WASH-VAX.BBN.COM

SYSTEM@EB0UAB51.BITNET (Inaki Nunez) (11/25/86)

        Hi!

        It's easy to write a program to recovery the lost files.
        In the program, you must do two thinks:
                1) Set on the bit of the bitmap in the INDEX BITMAP.
                2) Write again the ID number of the INDEXF.SYS. When the
        file is deleted this number is also deleted. So, you must rewrite
        this number. To do so, you must to know the ID number of the file
        to recovery. It is easy to know the block number of the Indexf.sys
        in which is the header of the file (suposing that you know the ID
        number of the file). The ID=1 is in the block numer:

                n=(cluster_size)*4+size_of_the_index_bit_map+1

                If you don't know the ID number of the file to recovery, your
        problem is worst. You can try to find the name of the file (I supose
        you know this name, at least), and compare whith the name that is
        YET in the Indexf.sys (position 4C (hexa) until 5F).
                3) The file is recovered now, but it's not accesible, because
        it hasn't directory. You can execute the verify of the disk
                        ANALIZE/DISK/REPAIR
         and the files will appear in the directory SYSLOST.

                        Well, I'll send you a program we made long time ago.
        You must write the ID numbers in a file. Be carefull with this program.
        I'm not remember well but some positions (for example the position of
        a file in the INDEXF.SYS and some others) are variables with the
        disk, and I don't rmember if in this program these positions are
        constants or variables.
                Good luck!

                                        Inaki Nunez
                                        SYSTEM@EB0UAB51

C******************************************************************************
C                                                                             *
CCC   CENTRO DE CALCULO DE LA UNIVERSIDAD AUTONOMA DE BARCELONA - (CATALUNYA) *
CCC                                                               - Espana -  *
C                                                                             *
C     Producte               :  RECUPERACION DE FICHEROS A PARTIR DEL -ID-    *
C                                                                             *
C     Sistema Operativo      :  VAX / VMS                                     *
C                                                                             *
C     Lenguaje/s Utilizado/s :  VAX - 11 FORTRAN                              *
C                                _      _                                     *
C     Elaborado por          :  Inaki Nunez                                   *
C                                        _                                    *
C                               Manuel Pena Camacho                           *
C                                                                             *
C******************************************************************************
C*
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C                                                                             C
C                                                                             C
CCC   PROGRAMA PARA RECUPERAR FICHEROS MODIFICANDO EL INDEX FILE
C                                                                             C
C                                                                             C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

        IMPLICIT INTEGER (A-Z)
C
        LOGICAL PVEZ, PVEZ2
C
        CHARACTER SN*1
C
        INTEGER*2 WORD(256), ACUMW
C
        BYTE BLOCK(512)
C
        EQUIVALENCE (WORD,BLOCK)
        EQUIVALENCE (ACUMW,ACUM)
C
CCC SE ABRE EL INDEX FILE
C
        OPEN (UNIT = 1,
     -          NAME = 'DRB1:[0,0]INDEXF.SYS',
C    -          NAME = 'INDEXF.TMP',
     -          STATUS = 'OLD',
     -          SHARED,
     -          IOSTAT = IOS)
C
        IF ( IOS .NE. 0) THEN
                TYPE *,'ERROR OPEN INDEX',IOS
                CALL EXIT
        END IF
C
CCC SE ABRE EL FICHERO QUE CONTIENE LOS ID DE LOS FICHEROS A RECUPERAR
C
        OPEN (UNIT = 2,
     -          NAME = 'ID.DAT',
     -          STATUS = 'OLD',
     -          IOSTAT = IOS)
C
        IF ( IOS .NE. 0) THEN
                TYPE *,'ERROR OPEN ID',IOS
                CALL EXIT
        END IF
C
CCC LECTURAS EN FALSO PARA OBTENER EL 1.ER BLOQUE DEL INDEX BIT MAP
C
        DO I = 1,9
                READ (1,10,IOSTAT=IOS) BLOCK
10              FORMAT (512A1)
                IF (IOSTAT .NE. 0) THEN
                        TYPE *,'ERROR LECTURA  ',IOS
                        CALL EXIT
                END IF
        END DO
C
CCC LECTURA DEL PRIMER ID A SALVAR
C
        PVEZ2 = .TRUE.
        RESTA = 0
1       READ (2,5,ERR=9000)ID
5       FORMAT (O6)
C
CCC OBTENER EL BYTE Y EL BIT A LEVANTAR EN EL INDEX BIT MAP,
CCC SI BYTE>512 NUEVA LECTURA
C
        BYTE = (ID / 8) + 1 - RESTA
        BIT = MOD (ID,8) - 1
C
        IF (BIT .LT. 0) THEN
                BIT = 7
                BYTE = BYTE - 1
        END IF
C
        IF (BYTE .GT. 512 .AND. PVEZ2) THEN
                PVEZ2 = .FALSE.
                BYTE = BYTE - 512
                RESTA = 512
C
                REWRITE (1,10,IOSTAT=IOS)BLOCK
                IF (IOSTAT .NE. 0) THEN
                        TYPE *,'ERROR REWRITE 1 ',IOS
                        CALL EXIT
                END IF
C
                READ (1,10,IOSTAT=IOS) BLOCK
                IF (IOSTAT .NE. 0) THEN
                        TYPE *,'ERROR LECTURA  ',IOS
                        CALL EXIT
                END IF
        END IF
C
        CALL LIB$INSV (1,BIT,1,BLOCK (BYTE))
C
        GO TO 1
C
9000    REWRITE (1,10,IOSTAT=IOS)BLOCK
        IF (IOSTAT .NE. 0) THEN
                TYPE *,'ERROR REWRITE 2 ',IOS
                CALL EXIT
        END IF
C
CCC SE CIERRAN LOS FICHEROS PARA REPOSICIONARNOS AL PRINCIPIO
C
        CLOSE (UNIT = 1)
        CLOSE (UNIT = 2)
C
CCC SE VUELVEN A ABRIR LOS FICHEROS
C
        OPEN (UNIT = 1,
     -          NAME = 'DRB1:[0,0]INDEXF.SYS',
C     -         NAME = 'INDEXF.TMP',
     -          STATUS = 'OLD',
     -          SHARED,
     -          IOSTAT = IOS)
C
        IF ( IOS .NE. 0) THEN
                TYPE *,'ERROR OPEN INDEX',IOS
                CALL EXIT
        END IF
C
        OPEN (UNIT = 2,
     -          NAME = 'ID.DAT',
     -          STATUS = 'OLD',
     -          IOSTAT = IOS)
C
        IF ( IOS .NE. 0) THEN
                TYPE *,'ERROR OPEN ID',IOS
                CALL EXIT
        END IF
C
CCC LECTURA DEL ID DEL FICHERO A RECUPERAR
C
        PVEZ = .TRUE.
1000    READ (2,5,ERR=9999)ID
C
        IF(PVEZ) THEN
                I2 = 14+ID
                PVEZ = .FALSE.
                IDANT = ID
        ELSE
                I2= ID - IDANT
                IDANT = ID
        END IF
C
CCC LECTURA DEL HEADER CORRESPONDIENTE AL FICHERO QUE TENGA EL ID LEIDO
C
        DO I = 1,I2
                READ (1,10,IOSTAT=IOS) BLOCK
                IF (IOSTAT .NE. 0) THEN
                        TYPE *,'ERROR LECTURA (2) ',IOS
                        CALL EXIT
                END IF
        END DO
C
CCC SE DISPLAYA EL NOMBRE DEL FICHERO PARA COMPROBACION
C
        TYPE 20,(BLOCK(I),I=77,90)
20      FORMAT (' ^ NOM DEL FITXER : ',14A)
C
CCC SE VERIFICA QUE ESTE ES EL FICHERO QUE SE PRETENDE RECUPERAR
C
        TYPE 25
25      FORMAT (' ^ VOLS ? ',$)
        ACCEPT 30,SN
30      FORMAT (A1)
C
        IF (SN .EQ. 'S') THEN
C
CCC EN CASO AFIRMATIVO SE PONE EL ID, Y SE CALCULA EL CHECKSUM
C
                WORD (5) = ID
                ACUM = 0
                DO I = 1,255
                        ACUM = ACUM + WORD(I)
                END DO
C
                WORD (256) = ACUMW
C
CCC SE REESCRIBE EL HEADER EN EL INDEX FILE
C
                REWRITE (1,10,IOSTAT=IOS)BLOCK
                IF (IOSTAT .NE. 0) THEN
                        TYPE *,'ERROR REWRITE (3) ',IOS
                        CALL EXIT
                END IF
        ELSE
                TYPE *,' ^ NO HAGO NADA'
        END IF
        GO TO 1000
C
CCC  FIN
C
9999    CALL EXIT
        END

carl@CITHEX.CALTECH.EDU.UUCP (02/12/87)

  >  I've come across two ways of handling login  command  files,  and  wonder
  >  whether anyone knows a reason to prefer (or abhor) one or the other:

  >      1.  SYS$SYLOGIN is defined to point to a  system-wide  login  command
  >      procedure,  which  is thus invoked for all processes.  LGICMD (in the
  >      UAF) for each user is defined to point to the file LOGIN.COM in  that
  >      user's home directory.

  >      2.  SYS$SYLOGIN is undefined, but LGICMD for *all*  users  points  to
  >      the system-wide login command procedure.  A line late in this command
  >      procedure checks to see if a  user  LOGIN.COM  exists,  and,  if  so,
  >      executes it.

  >  As far as I can tell, these two  methods  are  superficially  equivalent.
  >  Each  results  in  both levels of command procedure being executed in the
  >  proper order, and neither chokes if no user LOGIN.COM is present.

  >  Comments?

Using the logical name SYS$SYLOGIN:  forces all  logins  to  use  the  command
procedure  so  defined,  regardless  of the /COM= and /NOCOM qualifiers to the
username, whereas either of these qualifiers  may  be  used  to  override  the
default LGICMD specified in SYSUAF (unless appropriate flags are set).