Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* 2 questions: VAX-C RTL calls and VMS .DIR file entries
@ 1987-06-10 19:00 Bert Still
  1987-06-12 20:45 ` .. " Robert J. Drabek
  1987-06-26 14:05 ` 2 questions: VAX-C RTL calls " Jim Patterson
  0 siblings, 2 replies; 4+ messages in thread
From: Bert Still @ 1987-06-10 19:00 UTC (permalink / raw)



Hi There,

	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
run-time functions that are otherwise undocumented. I did a lib/list on the
VAXCRTL.OLB file and verified that the following routines do exist:

	shell$from_vms	-- translate VMS filespecs to UNIX filespecs
	shell$to_vms    -- translate UNIX filespecs to VMS filespecs
	shell$cli_name  -- determine user's command interpreter
	shell$fix_time  -- convert VMS time to UNIX format
	shell$clint     -- interface to argument lists under shell
	shell$wild      -- wildcard expansion to infinite names.

Does anyone have a copy of the correct calling sequences for these ? (I have
tried to experiment, and can guess at some of the arguments, like string
descriptors, etc. but I cannot seem to get them all.) We do not run DEC/Shell
(yet, we probably will buy it in the future), and I suspect that the answer
lies therein. In the meantime, can some kind soul please send me a copy of
the calling sequences to any/all of the above?

	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
several .DIR files, I have determined that the entries begin with 32767, and
filenames are followed by an ASCII null (\0), and that the version number
immediately follows the filename. Does anyone have a complete description of
an entry in a .DIR file, or know where I can find the information?

(For the curious, I am trying to convert some systems programs that I have
from BSD UNIX to run under VMS, and I need the OPENDIR, READDIR, CLOSEDIR, and
IOCTL functions; hence, I am trying to write them, and meeting with little
success... any help will be greatly appreciated.)
PS. If anyone has any of these functions written for VMS, I would be extremely
appreciative of any advice/aid I might receive.

                                                      Bert  8-}

--------------------------------------------------------------------------------
       What DesCartes really meant was "I think; therefore, I am paid."
--------------------------------------------------------------------------------
    ("shar" is actually an ancient term meaning "some assembly required.")
--------------------------------------------------------------------------------
                                     #
UUCP:   {...ihnp4!akgua |            #  US SNAIL:  Bert Still
         ...seismo!ncr-sd!ncrcae}    #             Dept of Mathematics
                      !usceast!still #             University of South Carolina
                                     #             Columbia, SC 29208
BITNET: T410119@UNIVSCVM             #
                                     #
--------------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: .. and VMS .DIR file entries
  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
  1987-06-15 15:56   ` rcb
  1987-06-26 14:05 ` 2 questions: VAX-C RTL calls " Jim Patterson
  1 sibling, 1 reply; 4+ messages in thread
From: Robert J. Drabek @ 1987-06-12 20:45 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: .. and VMS .DIR file entries
  1987-06-12 20:45 ` .. " Robert J. Drabek
@ 1987-06-15 15:56   ` rcb
  0 siblings, 0 replies; 4+ messages in thread
From: rcb @ 1987-06-15 15:56 UTC (permalink / raw)


The following is the specification of a directory file format:

	2 bytes - Maximum number of versions (usually 32767)
	1 byte  - Null spacer
	1 byte  - Length of name
	n bytes - Name with possibly a null byte after to realign to a 
			word boundry.
	
	repeat the next section for each version of the file until the
	end of the record:
		
		2 bytes - version number
		6 bytes - FID number (3 2byte numbers)

Hope this helps.
-- 
					Random (Randy Buckland)
					Research Triangle Institute
					rcb@rti.rti.org [128.109.139.2]
					...!mcnc!rti-sel!rcb


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2 questions: VAX-C RTL calls and VMS .DIR file entries
  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
@ 1987-06-26 14:05 ` Jim Patterson
  1 sibling, 0 replies; 4+ messages in thread
From: Jim Patterson @ 1987-06-26 14:05 UTC (permalink / raw)


In article <2405@usceast.UUCP> still@usceast.UUCP (Bert Still) writes:
>
>Hi There,
>	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.
>(For the curious, I am trying to convert some systems programs that I have
>from BSD UNIX to run under VMS, and I need the OPENDIR, READDIR, CLOSEDIR, and
>IOCTL functions)

Rather than trying to decode the VMS directory structures, you might
be better off to use the RMS directory search primatives.  You could
set up the following equivalences:

OPENDIR - establishes the directory name, and sets up SYS$SEARCH using
the given directory name and a filename of *.*;* .  (You may need to
call SYS$PARSE at this point).

READDIR - calls SYS$SEARCH to retrieve the next filename and store
information about it into the FAB (File Access Block) and NAMe
structures (plus any XABs you may need).  You can then move whatever
information is appropriate into the directory structure your program
expects.

CLOSEDIR - can just free up the various control structures.

I don't know where IOCTL fits in.

There are RTL routines that are similar (LIB$FIND_FILE, etc.).
If all you need are names of files, these may be sufficient.


-- 

Jim Patterson          decvax!utzoo!dciem!nrcaer!cognos!jimp
Cognos Incorporated    


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1987-06-26 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
1987-06-15 15:56   ` rcb
1987-06-26 14:05 ` 2 questions: VAX-C RTL calls " Jim Patterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox