Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!uwvax!oddjob!hao!noao!arizona!robert From: robert@arizona.edu (Robert J. Drabek) Newsgroups: comp.os.vms,comp.sys.dec,comp.org.decus Subject: Re: .. and VMS .DIR file entries Message-ID: <1764@megaron.arizona.edu> Date: Fri, 12-Jun-87 16:45:39 EDT Article-I.D.: megaron.1764 Posted: Fri Jun 12 16:45:39 1987 Date-Received: Sat, 20-Jun-87 18:38:36 EDT References: <2405@usceast.UUCP> Organization: U of Arizona CS Dept, Tucson Lines: 82 Keywords: shell$xxxx calls in VAXCRTL.OLB, format of a record in a .DIR file Summary: some ides Xref: mnetor comp.os.vms:948 comp.sys.dec:237 comp.org.decus:172 In article <2405@usceast.UUCP>, still@usceast.UUCP (Bert Still) writes: > > I have 2 (possibly) strange questions for netland. The first concerns > the VAX-C run-time library. Listed in the VAX-C manual are references to some > ... > The second question concerns VMS directories. I have perused the > "orange manuals" for the last two weeks looking for something that describes > the VMS directory files' organization. So far, by dumping the contents of > ... The following more or less works, but there are still some problems and I am posting this hoping someone can fill in some of the blanks. Yes, I know there are routines like lib$find_file() to do this work, but I needed something faster. The highest-version entries are ??? ??? I don't recall exactly what these were ??? 1 byte containing name length name-length bytes containing the name sometimes a null byte 2 bytes - version number 3 bytes of unknown (to me) information 3 null bytes The lower-version entries are 2 bytes - version number 3 bytes of unknown (to me) information 3 null bytes /* -------------------------------------------------------------------- */ /* readdir Read the next directory entry and return its string name. I used fopen() and fclose() in place of opendir() and closedir(). */ char *readdir(dp) FILE *dp; { int ch, i, len, ver; char *p; static char temp[8]; static char dirname[MAXNAMLEN + 1]; ch = fgetc(dp); ver = (fgetc(dp) << 8) + ch; if ((ch = fgetc(dp)) == EOF) return 0; if (ch == 0) { /* higher-version entry */ len = fgetc(dp); for (i = 0; i < len; i++) { ch = fgetc(dp); dirname[i] = isprint(ch) ? tolower(ch) : '?'; } dirname[i] = ';'; dirname[i + 1] = '\0'; while ((ch = fgetc(dp)) == 0) ; ver = (fgetc(dp) << 8) + ch; sprintf(temp, "%d", ver); strcat(dirname, temp); fread(temp, 1, 6, dp); /* skip over unknown stuff */ } else { /* lower-version entry */ fread(temp, 1, 5, dp); /* skip over unknown stuff */ sprintf(temp, "%d", ver); p = strrchr(dirname, ';'); strcpy(p + 1, temp); } return dirname; } /* readdir */ /* -------------------------------------------------------------------- */ -- Robert J. Drabek Department of Computer Science University of Arizona Tucson, AZ 85721