From: robert@arizona.edu (Robert J. Drabek)
Subject: Re: .. and VMS .DIR file entries
Date: Fri, 12-Jun-87 16:45:39 EDT [thread overview]
Message-ID: <1764@megaron.arizona.edu> (raw)
In-Reply-To: 2405@usceast.UUCP
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
next prev parent reply other threads:[~1987-06-12 20:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1987-06-10 19:00 2 questions: VAX-C RTL calls and VMS .DIR file entries Bert Still
1987-06-12 20:45 ` Robert J. Drabek [this message]
1987-06-15 15:56 ` .. " rcb
1987-06-26 14:05 ` 2 questions: VAX-C RTL calls " Jim Patterson
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox