This is G o o g l e's cache of http://www.lp.se/ftp/mailinglists/FREE-VMS.1996-09.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.


Google is not affiliated with the authors of this page nor responsible for its content.
These search terms have been highlighted: levitte programming 

Archive-Date: Tue, 10 Sep 1996 07:29:50 +0200
Sender: owner-free-vms@lp.se
Date: Tue, 10 Sep 1996 15:28:16 +1000
From: Paul Nankervis <CCPN@LURE.LATROBE.EDU.AU>
Reply-To: Free-VMS@lp.se
Subject: RMS File Formats
To: Free-VMS@lp.se
CC: paul@lin.cbl.com.au
Message-ID: <01I9BGSDRX4296WM7L@LURE.LATROBE.EDU.AU>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-Transfer-Encoding: 7BIT

People,

Not much action on this list I'm afraid... oh well.

I am currently playing with reading VMS volumes on my PC. No serious
problems so far... until I look ahead to reading some RMS file formats,
particularly things like Prologue 3 files.

Does anyone have any information or pointers to this stuff? At present
I have no where to go with this unless I want to dump out various files
and figure out the structure for myself. Not something I am looking
forward to.

If I ever end up being able to read VMS files from my PC the next step
would be implementing a simple kernel...  (years away :-( ).   Well at
least its a way of getting to play with C++.

All help with RMS file formats appreciated!!! Thanks

Paul Nankervis
================================================================================
Archive-Date: Tue, 10 Sep 1996 14:22:58 +0200
Sender: owner-free-vms@lp.se
Date: Tue, 10 Sep 1996 8:21:04 -0400 (EDT)
From: Bob Koehler <KOEHLER@bessta.gsfc.nasa.gov>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <960910082104.1159@bessta.gsfc.nasa.gov>
Subject: RE: RMS File Formats

>
>People,
>
>Not much action on this list I'm afraid... oh well.
>
>I am currently playing with reading VMS volumes on my PC. No serious
>problems so far... until I look ahead to reading some RMS file formats,
>particularly things like Prologue 3 files.
>
>Does anyone have any information or pointers to this stuff? At present
>I have no where to go with this unless I want to dump out various files
>and figure out the structure for myself. Not something I am looking
>forward to.
>
>If I ever end up being able to read VMS files from my PC the next step
>would be implementing a simple kernel...  (years away :-( ).   Well at
>least its a way of getting to play with C++.
>
>All help with RMS file formats appreciated!!! Thanks
>
>Paul Nankervis

   There is an RMS intenals manual which would probably be quite helpfull with
this.  IMHO, I'd try contacting Digital Press (sorry, no contact info handy) as
they are most likely the publisher (I don't have a copy handy to check).

   I assume you've already got the ODS-2 reader for DOS off the net somewhere.

Bob
================================================================================
Archive-Date: Wed, 11 Sep 1996 00:51:57 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 11 Sep 1996 08:50:32 +1000
From: Paul Nankervis <CCPN@LURE.LATROBE.EDU.AU>
Reply-To: Free-VMS@lp.se
Subject: Re: RMS File Formats
To: Free-VMS@lp.se
Message-ID: <01I9CHD44Y8296WH77@LURE.LATROBE.EDU.AU>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-Transfer-Encoding: 7BIT

Bob,

>    There is an RMS intenals manual which would probably be quite helpfull with
> this.  IMHO, I'd try contacting Digital Press (sorry, no contact info handy) as
> they are most likely the publisher (I don't have a copy handy to check).

I already have a copy of the File System Internals manual which documents
lots about disk structures but nothing about RMS. I have never seen reference
to an RMS structures manual - if I had I would probably own one.  :-(

Decoding most RMS info should be reasonably easy - except for Prolog 3
where compression is used. If anyone has information in this area I would
appreciate it.

>   I assume you've already got the ODS-2 reader for DOS off the net somewhere.

I got the Unix/VMS version from SPC and am currently rewriting it from
scratch so that it can be used under 'more functional' software.

Paul
================================================================================
Archive-Date: Wed, 11 Sep 1996 02:07:48 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 11 Sep 1996 02:07:45 +0200
From: Richard Levitte <levitte@lp.se>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <009A830E.7C4C5880.20@lp.se>
Subject: Re: RMS File Formats

One way to find out anything about the Prologue 3 indexed files is to
look at the VMS source, provided you have access to it (I have).

Also, those programs that people have started to write should be
gathered in an FTP archive.  I have enough space for that, and I
can provide a mean for contributing with whatever you have come up
with.

Last time I gave Free-VMS a thought was at the beginning of this
summer.  The reason why I've been less than active during the summer
is work.

Taking a slight pause during the summer has had a good side, however.
My thoughts (which were slightly in disorder this spring) have matured,
and I've also been given input from a bunch of people which has helped.

It strikes me that many people think that what I'd like to see is a
VMS for PC's.  Well, that's just part of the truth.  I'd like to see
it work on Sparcs as well if possible, or why not on HP workstations?
Therefore, if you write code, it would be a good thing to make it as
portable as possible.  My view is that Free-VMS will be built on top
of Mach (that is the view of the current Free-VMS charter as well).

There are many things that are needed for a working Free-VMS, but
I'd say that when the ODS-2 reader (writer?  and it was ODS-2, right?)
that Paul Nankervis seems to be working on is starting to get ready,
we've got one important part done already.  Several people have told
me how great it would be to have a portable DCL to play with (the
hardest part is probably to have a portable definition of verbs.
A friend of mine has had some thoughts on doing some automagic
DCL to Unix syntax translation built into it (only for a DCL over
Unix...), but that might be a little too much to ask...).

Hence, we've got this list of starting or ongoing tasks:

	- ODS-2 reader (write in the future or perhaps now?).
	  In the Mach implementation, this is expected to become
	  one of the servers.
	- Portable DCL.

I can help with testing various things and help porting, on and to
VMS, SunOS, Linux, MSDOS, NT (at least for the moment being).

Obviously, groups will be formed to work on different parts (I imagine
a DCL hacking group will be formed), and I expect separate mailing lists
will be provided for those groups.  I have the means to provide such
services, but I'd be glad if others could contribute resources as well.
However, that's still in the future.

One last word:  don't despair.  The FSF has worked on the GNU OS since
1984 (that's a little more than a decade) and just now, version 0.1 of
their kernel (GNU Hurd) has come out.  I don't expect this project to
get done in a few months, not even in two years.  Patience is a virtue.

(I'm writing this in the middle of the night.  I hope I will find it
sensible after I've slept a few hours.  Bear with me...)

-- 
R Levitte, Levitte Programming; Spannvägen 38, I; S-161 43  Bromma; SWEDEN
Tel: +46-8-26 52 47, (via nation.se) +46-8-728 20 33;  No fax right now
PGP key fingerprint = A6 96 C0 34 3A 96 AA 6C  B0 D5 9A DF D2 E9 9C 65
Check http://www.lp.se/~levitte for my public key.  bastard@bofh.se
================================================================================
Archive-Date: Wed, 11 Sep 1996 04:39:25 +0200
Sender: owner-free-vms@lp.se
Date: Tue, 10 Sep 1996 22:37:48 -0400 (EDT)
From: EVERHART@gce.mv.com
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <960910223748.62@gce.mv.com>
Subject: ods-2 reader, C source, utility

From:	SMTP%"Postmaster@lp.se" 10-SEP-1996 22:28:52.12
To:	EVERHART
CC:	
Subj:	Mailing list or file server error

Date: Wed, 11 Sep 1996 04:28:38 +0200
From: Mailing list & file server <Postmaster@lp.se>
To: <EVERHART@Arisia.GCE.Com>
Subject: Mailing list or file server error

Note: this message was generated automatically.

The following error(s) occurred during local delivery of your message.

Error in delivery to mailing list Free-VMS:
    access denied; send subscription requests to Free-VMS-Request@lp.se

------------------------------ Rejected message ------------------------------
Received: from Arisia.GCE.Com (gce.com) by nic.lp.se (MX V4.2 VAX) with SMTP; Wed, 11 Sep 1996 04:28:03 +0200
Date: Tue, 10 Sep 1996 22:27:09 -0400 (EDT)
From: EVERHART@Arisia.GCE.Com
To: Free-VMS@lp.se
Message-ID: <960910222709.62@Arisia.GCE.Com>
Subject: ods-2 reader utility, c source

#ifdef __alpha
#define __ALPHA 1
#define Long int
#else
#define Long long
#endif
/*% cc -O -o getvms %
 *
 *  Copy files from VMS (ODS-2) filesystem.  Files may be copied to
 *  disk or to standard output.  Transfer modes supported are "text"
 *  (RMS stuff is thrown away, newline is tacked on the end of each
 *  VMS record), and "image" (straight byte-by-byte transfer).	There
 *  were once plans to support a third mode ("binary"), but this has
 *  not yet been implemented.  Defaults for the output destination and
 *  transfer mode are set by #defines, but the destination/mode can be
 *  specified at runtime by using various flags (see "options()").
 *
 *  The input device and directory, if omitted, will default to that of
 *  the previous filespec.  Note that this means that the first filespec
 *  MUST have a directory specified, and (if DFLTDEV is not defined) also
 *  a device as well.  The filename syntax is the same as the standard
 *  VMS naming scheme, except that a "." may be used to separate the
 *  filetype from the version number, and some delimiters may be changed
 *  via #defines, if desired.  (This is all to avoid the possibility of
 *  having to escape some of the characters that the shell treats as
 *  special.)  The device name is the name of the UNIX special file in
 *  /dev, rather than what VMS thinks it would be.
 *
 *  If the first character of argv[0] is "l", or if the "-l" option is
 *  used, the program lists the contents of the directory rather than
 *  copying a file.  At present, only one directory may be listed per
 *  command.
 *
 *  Written by Mark Bartelt, based on an earlier program which copied
 *  files from ODS-1 volumes.
 *
 *	hacked 6-aug-82 norman wilson:
 *		in getvb, don't let h_use get sign extended
 *		added -T & line number stripping
 *		bwk'd putch a bit in the process
 *		added access checks to openout to plug a security hole
 *		this last should probably be commented out for non-unix
 *
 *	hacked 16-aug-84  Sam Sjogren:
 *		In gethdr(), check to see if the user is the
 *		superuser.  If so, ignore file protection.
 *
 *	hacked 26-feb-85  Carl J Lydick
 *		In getde(), check for end-of-file occurring as first word
 *		in the block returned by getvb().  Failure to do so causes
 *		garbage and core dumps.
 *      hacked 22-feb-93  George J Carrette (GJC@MITECH.COM)
 *              Made this run under VMS, just for the heck of it.
 *              Updated crack() to allow newer VMS filename syntax.
 *      hacked 1-jun-93 (GJC@MITECH.COM) to have procedure prototypes,
 *              and use stdarg.h so that DEC C ANSI89 will be happy
 *              and member_alignment pragma on alpha, just in case.
 *      hacked 19-Sep-1994 Glenn C. Everhart (Everhart@Arisia.GCE.Com)
 *		Added -n nativedev switch to allow a native device or file
 *		specifier to be put in for the device on which the ODS2
 *		file system is (too darn hard to figure otherwise) and
 *		added code to try to compensate for OSF-1 on AXP having
 *		"long" mean a 64 bit integer while "int" means 32 bits there.
 *             Thus odsrdr -n /dev/rrz4c [000000] would list [000000] dir
 *             of disk on /dev/rrz4c. This can be any file actually.
 * */

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

#ifdef VMS
#ifdef __ALPHA
/* define these so people don't need to compile with
   the flag /PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES because
   /STANDARD=RELAXED_ANSI89 is the default
*/
#define access decc$access
#define getgid decc$getgid
#define getuid decc$getuid
#endif
#define index strchr
#define rindex strrchr
#include <string.h>
#include <descrip.h>
#include <ssdef.h>
#include <iodef.h>
#include <starlet.h>
#include <unixlib.h>
#include <unixio.h>
#else
#include <unistd.h>
#endif

/* #define DFLTDEV "/dev/rrz4c" */

#define err0(msg)	{ errmsg(msg,0); return(0); }
#define err1(msg,arg)	{ errmsg(msg,arg); return(0); }

#define alphnum(x)	( ( 'a'<=(x) && (x)<='z' ) || ( 'A'<=(x) && (x)<='Z' ) || ( '0'<=(x) && (x)<='9' ) || ((x) == '-') || ((x) == '_') || ((x) == '$') )

#define decimal(x)	( '0'<=(x) && (x)<='9' )

typedef unsigned short	ushort;

#ifdef __ALPHA
#pragma member_alignment __save
#pragma nomember_alignment
#endif

struct filnam {
/*	char	f_nam[14]; */	/* File name (ASCII) */
	char	f_nam[80];	/* File name (ASCII), long enough for V4 on */
	ushort	f_ver;		/* Version number */
};

struct uic {
	ushort	u_prog; 	/* Programmer number */
	ushort	u_proj; 	/* Project number */
};

struct fileid {
	ushort	f_num;		/* File number */
	ushort	f_seq;		/* File sequence number (worthless concept) */
	ushort	f_rvn;		/* Relative volume number (ditto and MBZ) */
};

struct rms {
	char	f_forg; 	/* Record format and file organization */
	char	f_ratt; 	/* Record attributes */
	ushort	f_rsiz; 	/* Record size */
	ushort	f_hvbn[2];	/* Highest VBN allocated */
	ushort	f_heof[2];	/* End of file block */
	ushort	f_ffby; 	/* First free byte */
	char	f_bksz; 	/* Bucket size */
	char	f_hdsz; 	/* Fixed header size */
	ushort	f_mrs;		/* Maximum record size */
	ushort	f_deq;		/* Default extend quantity */
};

struct ident {
	char	i_fnam[20];	/* File name */
	ushort	i_rvno; 	/* Revision number */
	char	i_crdt[8];	/* Creation date and time */
	char	i_rvdt[8];	/* Revision date and time */
	char	i_exdt[8];	/* Expiration date and time */
	char	i_bkdt[8];	/* Backup date and time */
	char	i_ulab[80];	/* User label */
};

struct header {
	char	h_idof; 	/* Ident area offset */
	char	h_mpof; 	/* Map area offset */
	char	h_acof; 	/* Access control list offset */
	char	h_rsof; 	/* Reserved area offset */
	ushort	h_fseg; 	/* Extension segment number */
	ushort	h_flev; 	/* Structure level and version */
	ushort	h_fnum; 	/* File number */
	ushort	h_fseq; 	/* File sequence number */
	ushort	h_frvn; 	/* Relative volume number */
	ushort	h_efnu; 	/* Extension file number */
	ushort	h_efsq; 	/* Extension file sequence number */
	ushort	h_ervn; 	/* Extension relative volume number */
	union {
		char	hu_ufat[32];	/* User file attributes */
		struct rms hu_rms;	/* RMS file attributes */
	} h_ufat;
#define h_rms	h_ufat.hu_rms
	char	h_fcha[4];	/* File characteristics */
#define h_ucha	h_fcha[0]	/* User controlled characteristics */
#define h_scha	h_fcha[1]	/* System controlled characteristics */
	char	h_UU1[2];	/* Unused 1 */
	char	h_use;		/* Map words in use */
	char	h_priv; 	/* Accessor privilege level */
	struct uic h_fown;	/* File owner UIC */
#define h_prog	h_fown.u_prog	/* Programmer (member) number */
#define h_proj	h_fown.u_proj	/* Project (group) number */
	ushort	h_fpro; 	/* File protection code */
	ushort	h_rpro; 	/* Record protection code */
	char	h_UU2[4];	/* Ununsed 2 */
	char	h_semk[4];	/* Security mask */
	struct ident h_ident;	/* Ident area */
	char	h_other[300];	/* Map area, access control area, etc */
};

struct homeblock {
	Long	H_hblb; 	/* Home block LBN */
	Long	H_ahlb; 	/* Alternate home block LBN */
	Long	H_ihlb; 	/* Backup index file header LBN */
	char	H_vlev[2];	/* Structure level and version */
	ushort	H_sbcl; 	/* Storage bitmap cluster factor */
	ushort	H_hbvb; 	/* Home block VBN */
	ushort	H_ahvb; 	/* Backup home block VBN */
	ushort	H_ihvb; 	/* Backup index file header VBN */
	ushort	H_ibvb; 	/* Index file bitmap VBN */
	ushort	H_iblb[2];	/* Index file bitmap LBN */
	Long	H_fmax; 	/* Maximum number of files */
	ushort	H_ibsz; 	/* Index file bitmap size */
	ushort	H_rsvf; 	/* Number of reserved files */
	ushort	H_dvty; 	/* Disk device type */
	ushort	H_rvn;		/* Relative volume number */
	ushort	H_nvol; 	/* Number of volumes */
	ushort	H_vcha; 	/* Volume characteristics */
	struct uic H_vown;	/* Volume owner UIC */
	Long	H_vsmx; 	/* Volume security mask */
	ushort	H_vpro; 	/* Volume protection code */
	ushort	H_dfpr; 	/* Default file protection */
	ushort	H_drpr; 	/* Default record protection */
	ushort	H_chk1; 	/* First checksum */
	char	H_vdat[8];	/* Volume creation date */
	char	H_wisz; 	/* Default window size */
	char	H_lruc; 	/* Directory pre-access limit */
	ushort	H_fiex; 	/* Default file extend */
	char	H_UU1[388];	/* Unused 1 */
	char	H_snam[12];	/* Structure name */
	char	H_indn[12];	/* Volume name */
	char	H_indo[12];	/* Volume owner */
	char	H_indf[12];	/* Format type */
	char	H_UU2[2];	/* Unused 2 */
	ushort	H_chk2; 	/* Second checksum */
} hblock;

struct directory {
	ushort	d_rbc;		/* Record byte count */
	ushort	d_vrlm; 	/* Version limit */
	char	d_flags;	/* Flags */
	char	d_nbc;		/* Name byte count */
	char	d_fname[1];	/* File name string */
};

struct dirval {
	ushort	d_ver;		/* Version number */
	struct fileid d_fid;	/* File ID */
};

#ifdef __ALPHA
#pragma member_alignment __restore
#endif

#define BUFSIZE 512

#define bit(x)	((01)<<(x))

#define DEV	bit(0)
#define DIR	bit(1)
#define FIL	bit(2)
#define EXT	bit(3)
#define VER	bit(4)

#define DIRBEG	'['
#define DIREND	']'

#define NULLCHR '\0'
#define NULLSTR ""

#define FSMAX	250
#define DEVMAX	20

#define TEXT	0
#define IMGRMS	1
#define IMGFULL 2
#define BINARY	3

#define DISK	0
#define STDOUT	1

#define DFLTMOD TEXT
#define DFLTOUT DISK

void usage(void);
void options(char *arg);
void getvms(void);
void errmsg(char *msg,...);
int openin(void);
void listdir(void);
int copyfile(void);
int crack(void);
int openvms(char *devname);
int finddir(void);
int gethdr(ushort fnum,struct header *hp);
int getlb(Long	lbn,char *buf);
void dirmsg(char *msg,char *dirname,char *ptr);
int okwrite(char *file);
int getvb(Long vbn,char *buf,struct header *hp);
void putch(char c);
void prtfn(struct directory *de,struct dirval *vp);
int convert(char *fl,char *tp,char *vr,struct filnam *f);
Long lbnbase(register ushort *rp);
int openout(void);

char	**av;				/* Global argv */
char	lsflag = 0;			/* Nonzero ==> list directory */
int	xfermode = DFLTMOD;		/* Transfer mode */
int	rmlineno = 0;			/* ntw - remove sos line numbers */
int	outdest = DFLTOUT;		/* Output destination */
char	filspec[FSMAX]; 		/* Full filename string being processed */
int	pflags; 			/* Flags returned by crack() */
char	*dev, *dir, *fil, *typ, *ver;	/* Pointers to cracked filename fields */
char	vmsdev[DEVMAX+6];		/* Special file name for VMS filesystem */
int	vmsfd = -1;			/* File descriptor for reading VMS filesystem */
FILE	*of;				/* Stream pointer for output file */
char	dirfound;			/* Directory found */

#define NDEVMAX 256

char	nativdev[NDEVMAX];
int	natlen;

struct header	indexh, mfdh, dirh, fileh;	/* File headers for index file, MFD,
 UFD, and file */


main(argc,argv)
int	argc;
char	**argv;
{
	char	*basename();

	av = argv;

	if ( --argc == 0 )
		usage();

	if ( *basename(*argv) == 'l' )
		++lsflag;

    natlen = 0;
   while ( argc-- ) {
		if ( **++av == '-' )
			options(*argv);
		else
			getvms();
	}
}


void usage(void)
{
	fprintf(stderr,"usage: %s [-t][-n nativdev][-i][-b][-d][-f][-s] vmsfile\n",*av);
	exit(-1);
}


char *
basename(s)
register char	*s;
{
/* NOTE:  Some versions of UNIX use the name strrchr() rather than rindex() */
	char		*rindex();
	register char	*t;

	if ( (t=rindex(s,
#ifdef VMS
		       ']'
#else
		       '/'
#endif
		       )) == NULL )
		return(s);
	else
		return(t+1);
}


/*
 *  Process option flags
 */

void options(char *arg)
{
	char	*p;
	int kk;
	char * cp;
	char cac;
	char * cop;

	for ( p = *av; *++p; ) {

		switch ( *p ) {

		case 'd':
		case 'f':	outdest = DISK; break;
		case 's':	outdest = STDOUT; break;

		case 't':	xfermode = TEXT; break;
		case 'T':	xfermode = TEXT; rmlineno++; break;	/* ntw */
		case 'i':	xfermode = IMGRMS; break;
		case 'I':	xfermode = IMGFULL; break;
		case 'b':	xfermode = BINARY; break;
		case 'n':	{cop = &nativdev[0];
				kk = 0;
		                natlen=0;
		                cp = p;
		                cac = *++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				while (*cp != '\0' && *cp != ' ' && *cp != '-'){
				if (cac != ' ' && kk < NDEVMAX-3 && cac != '\0'){
				  nativdev[kk]=cac;
				  nativdev[kk+1] = '\0';
				  kk++;
				  natlen++;
				}
				cac = *++cp;
				p = cp;
				}
				nativdev[kk] = '\0';
                                nativdev[kk+1] = '\0';
		                nativdev[kk+2] = '\0';
		                p = &nativdev[kk];

				break;
				}
		                break;  
		case 'l':	++lsflag; break;
		case 'c':	lsflag = 0; break;

		default:	fprintf(stderr,"Invalid option (%c)\n",*p);

		}
	}
}


/*
 *  Get the next requested file from the VMS filesystem
 */

void getvms(void)
{
	if ( strlen(*av) > FSMAX )
	  {errmsg("Filespec too Long");
	   return;}
	strcpy(filspec,*av);

	if ( lsflag ) {
		if ( openin() )
			listdir();
	} else {
		if ( openin() && openout() ) {
			copyfile();
			if ( of != stdout )
				fclose(of);
		}
	}
}


/*
 *  Open VMS file for input
 */

int openin(void)
{
	static int	filecnt = 0;
	struct filnam	fn;
	ushort		fnum;
	ushort		search();
	int		gh;

	++filecnt;
	if (crack() == 0)
		return (0);
	if ( pflags&DEV && !openvms(dev) )
		return(0);

        if (natlen > 0 && !(pflags&DEV) && filecnt==1 && !openvms(nativdev) )
		return(0);
#ifdef DFLTDEV
        if ( !(pflags&DEV) && filecnt==1 && !openvms(DFLTDEV) )
		return(0);
#endif
	if ( vmsfd < 0 )
		err0("No device specified");
	if ( pflags&(DEV|DIR) && !finddir() )
		return(0);
	if ( !dirfound )
		err0("No directory specified");
	if ( lsflag ) {
		if ( pflags & (FIL|EXT|VER) )
			err0("Invalid directory specification");
		return(1);
	}
	if ( !(pflags&EXT) )
		typ = NULLSTR;
	if ( !(pflags&VER) )
		ver = NULLSTR;
	if ( !convert(fil,typ,ver,&fn) )
		return(0);
	if ( !(fnum=search(&dirh,&fn)) )
		err0("File does not exist");
	if ( !(gh=gethdr(fnum,&fileh)) )
		err0("Can't get file header for file");
	if ( gh == -1 )
		err0("No access privilege for file");
	return(1);
}


/*
 *  Crack the filename string -- First step in parsing it; just
 *  locates the fields, doesn't do much real validity checking
 */

int crack(void)
{
	register char	*p = filspec;
	register char	*q;

	for ( pflags=0; *p; ) {

		if ( *p == DIRBEG ) {
			if ( pflags & (DIR|FIL|EXT|VER) )
				err0("Bad filename syntax");
			dir = p+1;
			while ( *p != DIREND ) {
				if ( 'a' <= *p && *p <= 'z' )	/* SHOUT the directory */
					*p += 'A' - 'a';	/* name in UPPER CASE */
				if ( *p++ == NULLCHR )
					err0("Bad filename syntax");
			}
			*p++ = NULLCHR;
			pflags |= DIR;
			continue;
		}

		for ( q=p; alphnum(*q); ++q )
			;

		if ( *q == ':' ) {
			if ( pflags&(DEV|DIR|FIL|EXT|VER) )
				err0("Bad filename syntax");
			dev = p;
			pflags |= DEV;
			*q = NULLCHR;
			p = q + 1;
			continue;
		}

		if ( *q == '.' || *q == ';' || *q == NULLCHR ) {

			if ( !(pflags&FIL) ) {
				if ( p == q )
					err0("Filename missing");
				fil = p;
				pflags |= FIL;
				if ( *q == ';' ) {
					typ = NULLSTR;
					pflags |= EXT;
				}
			} else if ( !(pflags&EXT) ) {
				typ = p;
				pflags |= EXT;
			} else if ( !(pflags&VER) ) {
				ver = p;
				pflags |= VER;
			} else
				err0("Bad filename syntax");

			if ( *q == NULLCHR ) {
				if ( !(pflags&EXT) )
					typ = NULLSTR;
				if ( !(pflags&VER) )
					ver = NULLSTR;
				break;
			}
			*q = NULLCHR;
			p = q + 1;
			continue;
		}

		err0("Bad filename syntax");
	}

	return(1);
}


/*
 *  Open a disk containing an VMS filesystem
 */

int openvms(char	*devname)
{
	Long	ifhbn;

	if ( strlen(devname) > DEVMAX )
		err1("Device name too Long (%s)",devname);
#ifdef VMS
	strcpy(vmsdev,"");
#else
        strcpy(vmsdev,"");
/*        strcpy(vmsdev,"/dev/"); */
/*
        if ( strncmp(devname,"disk$",5) == 0 )
		devname += 5;
	if ( strncmp(devname,"vms",3) != 0 )
		strcat(vmsdev,"vms");
*/
#endif
	strcat(vmsdev,devname);
#ifdef VMS
	{int retcode;
	 struct dsc$descriptor devd;
	 devd.dsc$w_length = strlen(vmsdev);
	 devd.dsc$a_pointer = vmsdev;
	 devd.dsc$b_class = DSC$K_CLASS_S;
	 devd.dsc$b_dtype = DSC$K_DTYPE_T;
	 vmsfd = 0;
	 retcode = sys$assign(&devd,&vmsfd,0,0);
	 if (retcode != SS$_NORMAL) vmsfd = -1;}
#else
        vmsfd=open(vmsdev,0);
#endif
	if ( vmsfd < 0 )
		err1("Can't open %s",vmsdev);

	if ( !getlb(1L,(char *)&hblock) )
		err1("Can't read homeblock on %s",vmsdev);

	ifhbn = ((Long)hblock.H_iblb[1]<<16) + (Long)hblock.H_iblb[0] + hblock.H_ibsz;
	if ( !getlb(ifhbn,(char *)&indexh) )
		err1("Can't read index file header on %s\n",vmsdev);

	if ( !getlb(ifhbn+3,(char *)&mfdh) )
		err1("Can't read mfd header on %s",vmsdev);

	return(1);
}


/*
 *  Locate the directory whose name is pointed to by "dir"
 */

#define alphanum

int finddir(void)
{
#define direrr(msg,dirname,ptr) { dirmsg(msg,dirname,ptr); return(0); }
	struct header	*hp = &mfdh;
	register char	*p = dir;
	register char	*q;
	char		*strchr();
	int		nch;
	struct filnam	dirfn;
	ushort		dirfnum;
	ushort		search();
	int		gh;

	do {
		for ( q=p; alphnum(*q); ++q )
			;
		if ( ( *q && *q!='.' ) || (nch=q-p) == 0 || nch > 39 )
			err1("Invalid directory ([%s])",dir);
		strncpy(dirfn.f_nam,p,nch);
		dirfn.f_nam[nch] = '\0';
		strcat(dirfn.f_nam,".DIR");
		dirfn.f_ver = 1;
		if ( !(dirfnum=search(hp,&dirfn)) )
			direrr("Directory [%s] does not exist",dir,q);
		if ( !(gh=gethdr(dirfnum,(hp=(&dirh)))) )
			direrr("Can't get file header for directory [%s]",dir,q);
		if ( gh == -1 )
			direrr("No access privilege for directory [%s]",dir,q);
		p = q + 1;
	} while (*q);
	dirfound = 1;
	return(1);
}


/*
 *  Error accessing a directory
 */

void dirmsg(char *msg,char *dirname,char *ptr)
{
	char	c;

	c = *ptr;
	*ptr = '\0';
	errmsg(msg,dirname);
	*ptr = c;
}


/*
 *  Convert file name, type, and version number to "struct filnam" format
 */

int convert(char *fl,char *tp,char *vr,struct filnam *f)
{
	register char *p;

	if ( strlen(fl) > 39 )
		err0("Filename Longer than 39 characters");
	if ( strlen(tp) > 39 )
		err0("File type Longer than 39 characters");
	strcpy(f->f_nam,fl);
	strcat(f->f_nam,".");
	strcat(f->f_nam,tp);
	for ( p=f->f_nam; *p; ++p )		/* This code is needed since */
		if ( 'a' <= *p && *p <= 'z' )	/* VMS loves to SHOUT at you */
			*p += 'A' - 'a';	/* in UPPER CASE all the time */
	for ( f->f_ver=0; *vr; ) {
		if ( !decimal(*vr) )
			err0("Non-digit in version number");
		f->f_ver *= 10;
		f->f_ver += *vr++ - '0';
	}
	return(1);
}


/*
 *  Search a directory (identified by dhp) for a filename
 */

ushort
search(dhp,fn)
register struct header	*dhp;
register struct filnam	*fn;
{
	int				len;
	int				bod;
	register struct directory	*de;
	struct directory		*getde();
	register struct dirval		*vp;
	register struct dirval		*vplim;

	len = strlen(fn->f_nam);
	for ( bod=1; de=getde(dhp,bod); bod=0 ) {
		if ( de->d_nbc!=len || strncmp(de->d_fname,fn->f_nam,len)!=0 )
			continue;
		vp = (struct dirval *) ( de->d_fname + ((de->d_nbc+1)&0376) );
		if ( !fn->f_ver )
			return(vp->d_fid.f_num);
		for ( vplim=(struct dirval *)((char *)(&de->d_vrlm)+de->d_rbc); vp<vplim; ++vp
 ) {
			if ( vp->d_ver > fn->f_ver )
				continue;
			if ( vp->d_ver == fn->f_ver )
				return(vp->d_fid.f_num);
			return(0);
		}
		return(0);
	}
	return(0);
}


/*
 *  Open output file
 */

int openout(void)
{
	char	outfile[256];

	if ( outdest == STDOUT ) {
		of = stdout;
		return(1);
	}

	strcpy(outfile,fil);
	strcat(outfile,".");
	strcat(outfile,typ);
	if (okwrite(outfile) == 0		/* ntw */
	||   (of=fopen(outfile,"w")) == NULL )
		err0("Can't open output file");
	return(1);
}


/*
 * see if ok to write/create this file
 * needed because we might be setuid or setgid
 * to get at the special files for disks
 * nb we assume the file is in the working directory
 * always true at the moment;  might neeed more mess in future
 */

int okwrite(char *file)
{

	if (access(file, 02) == 0)
		return (1);		/* exists and is writeable */
	if (access(file, 0) == 0)
		return (0);		/* exists although not writeable */
	if (index(file, '/'))
		return (0);		/* snh */
#ifdef VMS
	return(1);
#endif

	if (access(".", 02) == 0)
		return (1);		/* file doesn't exist and can create it */
	return (0);
}


/*
 *  Copy input file to output destination
 */

int copyfile(void)
{
	Long		eofblk;
	register Long	block = 0;
	register Long	b = 0;
	char		buf[BUFSIZE];
	int		nbytes = BUFSIZE;
	register char	*p;

	if ( xfermode == BINARY )
		err0("Binary mode not yet supported");
	if ( xfermode != IMGFULL )
		eofblk = ( (Long)fileh.h_rms.f_heof[0] << 16 ) + fileh.h_rms.f_heof[1];
	while ( getvb(++block,buf,&fileh) ) {
		if ( xfermode == IMGFULL ) {
			if ( fwrite(buf,1,BUFSIZE,of) == BUFSIZE )
				continue;
			err0("write error");
		}
		if ( ++b > eofblk )
			return(1);
		if ( b == eofblk )
			nbytes = fileh.h_rms.f_ffby;
		if ( xfermode == IMGRMS ) {
			if ( fwrite(buf,1,nbytes,of) == nbytes )
				continue;
			err0("write error");
		}
		for ( p=buf; p<buf+nbytes; )
			putch(*p++);
	}
	return(1);
}


/*
 *  Process next character from input file
 *  for text mode
 */

/*
 * possible states of the machine:
 */

#define INIT	0	/* waiting for the beginning of a record */
#define COUNT	1	/* in byte count */
#define LINENO	2	/* in line number */
#define DATA	3	/* in data */
#define NULLPAD	4	/* eating the padding null at the end */

void putch(char c)
{
	static unsigned	count;
	static int	state = INIT;
	static int	nextstate;
	static int	lnbytes;

	switch (state) {
	case INIT:
		count = (c&0377);
		state = COUNT;
		break;

	case COUNT:
		if ( (count+=((c&0377)<<8)) == 0 ) {
			putc('\n',of);
			state = INIT;
		} else {
			if (rmlineno == 0)
				state = DATA;
			else {
				lnbytes = 0;
				state = LINENO;
			}
			nextstate = INIT;
			if ( count&1 )
				nextstate = NULLPAD;
		}
		break;

	case LINENO:
		if (lnbytes == 0)
			lnbytes++;
		else
			state = DATA;
		if (--count == 0) {
			putc('\n', of);
			state = INIT;
		}
		break;

	case DATA:
		putc(c,of);
		if ( --count == 0 ) {
			state = nextstate;
			putc('\n',of);
		}
		break;

	case NULLPAD:
		state = INIT;
		break;

	default:
		errmsg("internal error in putch");
		abort();
	}
}


/*
 *  List contents of a UFD
 */

void listdir(void)
{
	register int			bod;
	register struct directory	*de;
	struct directory		*getde();
	register struct dirval		*vp;
	register struct dirval		*vplim;

	for ( bod=1; de=getde(&dirh,bod); bod=0 ) {
		vp = (struct dirval *) ( de->d_fname + ((de->d_nbc+1)&0376) );
		vplim = (struct dirval *) ((char *)(&de->d_vrlm)+de->d_rbc);
		for ( ; vp<vplim; ++vp )
			prtfn(de,vp);
	}
}


/*
 *  Write filename to standard output
 */

void prtfn(struct directory *de,struct dirval *vp)
{
	register char	*p;
	register int	i;

	for ( p=de->d_fname, i=de->d_nbc; i>0; --i )
		putc(*p++,stdout);
	fprintf(stdout,";%d\n",vp->d_ver);
}


/*
 *  Return pointer to next directory entry
 */

struct directory *
getde(dhp,bod)
register struct header	*dhp;
int			bod;
{
#define recsize (*((ushort *)de))
#define STOP	((ushort)0177777)
	static Long		vb;
	static Long		eofblk;
	static char		*limit;
	static char		dirbuf[BUFSIZE];
	static char		*de;

	if ( bod ) {
		vb = 0;
		eofblk = ( (Long)dhp->h_rms.f_heof[0] << 16 ) + dhp->h_rms.f_heof[1];
		limit = &dirbuf[BUFSIZE];
	}
	if ( bod || (de+=(recsize+2))>=limit || recsize==STOP ) {
		if ( ++vb == eofblk )
			limit = &dirbuf[dhp->h_rms.f_ffby];
		if ( !getvb(vb,dirbuf,dhp) || (*((ushort *)dirbuf)) == STOP)
			return((struct directory *)0);
		de = dirbuf;
	}
	if ( de >= limit )
		return((struct directory *)0);
	return((struct directory *)de);
}


/*
 *  Get a file header, given the file number; check access privilege
 */

int gethdr(ushort fnum,struct header *hp)
{
#define G_DENY	bit(8)
#define W_DENY	bit(12)
	register Long	bn;
	int		grp;
	int		ogrp;

	bn = (Long)fnum + hblock.H_ibvb + hblock.H_ibsz -1;
	if ( !getvb(bn,(char *)hp,&indexh) )
		return(0);
/* dyke out priv. checks here for now. */
/*
	if ( !(hp->h_fpro&W_DENY) || !getuid())
		return(1);
*/
	grp = getgid();
	ogrp = 64*(grp/100) + 8*((grp/10)%10) + (grp%10);
#ifdef VMS
	/* the user must have LOGIO priv to run this anyway. */
	return(1);
#endif
	return(1); /* dyke priv checks */
/*
	if ( ogrp != hp->h_proj || hp->h_fpro&G_DENY )
		return(-1);
	else
		return(1);
*/
}


/*
 *  Routine to get specified virtual block from a file.  Returns 0
 *  on EOF, 1 otherwise.  Note that vbn is 1-based, not 0-based.
 */

int getvb(Long vbn,char *buf,struct header *hp)
{
#define WTPMASK 0140000
#define WTP00	0000000
#define WTP01	0040000
#define WTP10	0100000
#define WTP11	0140000
	register ushort 	*rp;
	register Long		block;
	register ushort 	*limit;
	register ushort 	wtype;
	register Long		lbn;
	register Long		size;
	ushort			getsize();

	rp = (ushort *)hp + (hp->h_mpof&0377);
	block = 1;
	limit = rp + (hp->h_use & 0377);		/* ntw */
	while ( rp < limit && vbn >= ( block + (size=getsize(rp)) ) ) {
		wtype = (*rp) & WTPMASK;
		switch (wtype) {
			case WTP00:	rp += 1; break;
			case WTP01:	rp += 2; break;
			case WTP10:	rp += 3; break;
			case WTP11:	rp += 4; break;
		}
		block += size;
	}
	if ( rp >= limit )
		return(0);
	lbn = lbnbase(rp) + vbn - block;
	return(getlb(lbn,buf));
}


/*
 *  Return number of blocks mapped by the current window
 */

ushort
getsize(rp)
register ushort *rp;
{
	register ushort wtype;

	wtype = (*rp) & WTPMASK;
	switch (wtype) {
		case WTP00:	return(0);
		case WTP01:	return(((*((char *)rp))&0377)+1);
		case WTP10:	return(((*rp)&037777)+1);
		case WTP11:	return(((((Long)(*rp)&037777)<<16)+rp[1])+1);
	}
}


/*
 *  Return base lbn mapped by the current window
 */

Long lbnbase(register ushort *rp)
{
	register ushort wtype;

	wtype = (*rp)&WTPMASK;
	switch ( wtype ) {
		case WTP00:	return(0L);
		case WTP01:	return(((((char *)rp)[1]&077L)<<16)+rp[1]);
		case WTP10:	return((((Long)rp[2])<<16)+(Long)rp[1]);
		case WTP11:	return((((Long)rp[3])<<16)+(Long)rp[2]);
	}
}


/*
 *  Get block from the filesystem, given the logical block number
 */

int getlb(Long	lbn,char *buf)
{
	if ( lbn == 0L )
		err0("Bad block in file");
#ifdef VMS
	{int retcode;
	 short iosb[4];
	 retcode = sys$qiow(0,vmsfd,IO$_READLBLK,&iosb,0,0,
			    buf,BUFSIZE,lbn,
			    0,0,0);
	 if (retcode != SS$_NORMAL) err1("QIO error %d",retcode);
	 if (iosb[0] != SS$_NORMAL) err1("READVBLK error %d",iosb[0]);}
#else
	if ( lseek(vmsfd,BUFSIZE*lbn,0) == -1L ||  read(vmsfd,buf,BUFSIZE) != BUFSIZE )
		err0("Read error");
#endif
	return(1);
}


/*
 *  Issue an error message
 */

void errmsg(char *msg,...)
{va_list arglist;
 fprintf(stderr,"%s -- ",*av);
 va_start(arglist,msg);
 vfprintf(stderr,msg,arglist);
 va_end(arglist);
 fprintf(stderr,"\n");}
================================================================================
Archive-Date: Wed, 11 Sep 1996 04:39:37 +0200
Sender: owner-free-vms@lp.se
Date: Tue, 10 Sep 1996 22:38:15 -0400 (EDT)
From: EVERHART@gce.mv.com
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <960910223815.62@gce.mv.com>
Subject: ods2 reading comments

From:	SMTP%"Postmaster@lp.se" 10-SEP-1996 22:33:23.19
To:	EVERHART
CC:	
Subj:	Mailing list or file server error

Date: Wed, 11 Sep 1996 04:33:56 +0200
From: Mailing list & file server <Postmaster@lp.se>
To: <EVERHART@Arisia.GCE.Com>
Subject: Mailing list or file server error

Note: this message was generated automatically.

The following error(s) occurred during local delivery of your message.

Error in delivery to mailing list Free-VMS:
    access denied; send subscription requests to Free-VMS-Request@lp.se

------------------------------ Rejected message ------------------------------
Received: from Arisia.GCE.Com (gce.com) by nic.lp.se (MX V4.2 VAX) with SMTP; Wed, 11 Sep 1996 04:33:53 +0200
Date: Tue, 10 Sep 1996 22:33:01 -0400 (EDT)
From: EVERHART@Arisia.GCE.Com
To: Free-VMS@lp.se
Message-ID: <960910223301.62@Arisia.GCE.Com>
Subject: Re: RMS File Formats

I should point out that the ods-2 reader utility was possible to moosh
into a unix nfs server using the pd user mode nfs server, some
translation code to translate path names, and using its internal calls
to read files & directories (and keeping a bit of track of paths).

I did that for Intraco and had it working. Far from perfect, but it
didn't need unix sources (very costly for the closed commercial Unix
versions) and did work.

Similar techniques probably could be used for something on top of Mach
but let me suggest that doing Prolog 3 is probably NOT a good choice
of how to handle VMS files first off. Get random & sequential right
first and worry about ISAM later...not everyone uses it, and some
packages that handle b-trees can be made to have similar programming
semantics...possibly with better performance. If you're going to do
what amounts to a redesign of RMS, there are many areas that can be
handled more cleanly, keeping cruft that does network independence
perhaps in another layer...

================================================================================
Archive-Date: Wed, 11 Sep 1996 04:42:38 +0200
Sender: owner-free-vms@lp.se
Date: Tue, 10 Sep 1996 22:41:09 -0400 (EDT)
From: EVERHART@gce.mv.com
Reply-To: Free-VMS@lp.se
To: free-VMS@lp.se
Message-ID: <960910224109.62@gce.mv.com>
Subject: ods-2 reader, small mod for display of file id in directories

#ifdef __alpha
#define __ALPHA 1
#define Long int
#else
#define Long long
#endif
/*% cc -O -o getvms %
 *
 *  Copy files from VMS (ODS-2) filesystem.  Files may be copied to
 *  disk or to standard output.  Transfer modes supported are "text"
 *  (RMS stuff is thrown away, newline is tacked on the end of each
 *  VMS record), and "image" (straight byte-by-byte transfer).	There
 *  were once plans to support a third mode ("binary"), but this has
 *  not yet been implemented.  Defaults for the output destination and
 *  transfer mode are set by #defines, but the destination/mode can be
 *  specified at runtime by using various flags (see "options()").
 *
 *  The input device and directory, if omitted, will default to that of
 *  the previous filespec.  Note that this means that the first filespec
 *  MUST have a directory specified, and (if DFLTDEV is not defined) also
 *  a device as well.  The filename syntax is the same as the standard
 *  VMS naming scheme, except that a "." may be used to separate the
 *  filetype from the version number, and some delimiters may be changed
 *  via #defines, if desired.  (This is all to avoid the possibility of
 *  having to escape some of the characters that the shell treats as
 *  special.)  The device name is the name of the UNIX special file in
 *  /dev, rather than what VMS thinks it would be.
 *
 *  If the first character of argv[0] is "l", or if the "-l" option is
 *  used, the program lists the contents of the directory rather than
 *  copying a file.  At present, only one directory may be listed per
 *  command.
 *
 *  Written by Mark Bartelt, based on an earlier program which copied
 *  files from ODS-1 volumes.
 *
 *	hacked 6-aug-82 norman wilson:
 *		in getvb, don't let h_use get sign extended
 *		added -T & line number stripping
 *		bwk'd putch a bit in the process
 *		added access checks to openout to plug a security hole
 *		this last should probably be commented out for non-unix
 *
 *	hacked 16-aug-84  Sam Sjogren:
 *		In gethdr(), check to see if the user is the
 *		superuser.  If so, ignore file protection.
 *
 *	hacked 26-feb-85  Carl J Lydick
 *		In getde(), check for end-of-file occurring as first word
 *		in the block returned by getvb().  Failure to do so causes
 *		garbage and core dumps.
 *      hacked 22-feb-93  George J Carrette (GJC@MITECH.COM)
 *              Made this run under VMS, just for the heck of it.
 *              Updated crack() to allow newer VMS filename syntax.
 *      hacked 1-jun-93 (GJC@MITECH.COM) to have procedure prototypes,
 *              and use stdarg.h so that DEC C ANSI89 will be happy
 *              and member_alignment pragma on alpha, just in case.
 *      hacked 19-Sep-1994 Glenn C. Everhart (Everhart@Arisia.GCE.Com)
 *		Added -n nativedev switch to allow a native device or file
 *		specifier to be put in for the device on which the ODS2
 *		file system is (too darn hard to figure otherwise) and
 *		added code to try to compensate for OSF-1 on AXP having
 *		"long" mean a 64 bit integer while "int" means 32 bits there.
 *             Thus odsrdr -n /dev/rrz4c [000000] would list [000000] dir
 *             of disk on /dev/rrz4c. This can be any file actually.
 * */

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

#ifdef VMS
#ifdef __ALPHA
/* define these so people don't need to compile with
   the flag /PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES because
   /STANDARD=RELAXED_ANSI89 is the default
*/
#define access decc$access
#define getgid decc$getgid
#define getuid decc$getuid
#endif
#define index strchr
#define rindex strrchr
#include <string.h>
#include <descrip.h>
#include <ssdef.h>
#include <iodef.h>
#include <starlet.h>
#include <unixlib.h>
#include <unixio.h>
#else
#include <unistd.h>
#endif

/* #define DFLTDEV "/dev/rrz4c" */

#define err0(msg)	{ errmsg(msg,0); return(0); }
#define err1(msg,arg)	{ errmsg(msg,arg); return(0); }

#define alphnum(x)	( ( 'a'<=(x) && (x)<='z' ) || ( 'A'<=(x) && (x)<='Z' ) || ( '0'<=(x) && (x)<='9' ) || ((x) == '-') || ((x) == '_') || ((x) == '$') )

#define decimal(x)	( '0'<=(x) && (x)<='9' )

typedef unsigned short	ushort;

#ifdef __ALPHA
#pragma member_alignment __save
#pragma nomember_alignment
#endif

struct filnam {
	char	f_nam[80];	/* File name (ASCII) */
	ushort	f_ver;		/* Version number */
};

struct uic {
	ushort	u_prog; 	/* Programmer number */
	ushort	u_proj; 	/* Project number */
};

struct fileid {
	ushort	f_num;		/* File number */
	ushort	f_seq;		/* File sequence number (worthless concept) */
	ushort	f_rvn;		/* Relative volume number (ditto and MBZ) */
};

struct rms {
	char	f_forg; 	/* Record format and file organization */
	char	f_ratt; 	/* Record attributes */
	ushort	f_rsiz; 	/* Record size */
	ushort	f_hvbn[2];	/* Highest VBN allocated */
	ushort	f_heof[2];	/* End of file block */
	ushort	f_ffby; 	/* First free byte */
	char	f_bksz; 	/* Bucket size */
	char	f_hdsz; 	/* Fixed header size */
	ushort	f_mrs;		/* Maximum record size */
	ushort	f_deq;		/* Default extend quantity */
};

struct ident {
	char	i_fnam[20];	/* File name */
	ushort	i_rvno; 	/* Revision number */
	char	i_crdt[8];	/* Creation date and time */
	char	i_rvdt[8];	/* Revision date and time */
	char	i_exdt[8];	/* Expiration date and time */
	char	i_bkdt[8];	/* Backup date and time */
	char	i_ulab[80];	/* User label */
};

struct header {
	char	h_idof; 	/* Ident area offset */
	char	h_mpof; 	/* Map area offset */
	char	h_acof; 	/* Access control list offset */
	char	h_rsof; 	/* Reserved area offset */
	ushort	h_fseg; 	/* Extension segment number */
	ushort	h_flev; 	/* Structure level and version */
	ushort	h_fnum; 	/* File number */
	ushort	h_fseq; 	/* File sequence number */
	ushort	h_frvn; 	/* Relative volume number */
	ushort	h_efnu; 	/* Extension file number */
	ushort	h_efsq; 	/* Extension file sequence number */
	ushort	h_ervn; 	/* Extension relative volume number */
	union {
		char	hu_ufat[32];	/* User file attributes */
		struct rms hu_rms;	/* RMS file attributes */
	} h_ufat;
#define h_rms	h_ufat.hu_rms
	char	h_fcha[4];	/* File characteristics */
#define h_ucha	h_fcha[0]	/* User controlled characteristics */
#define h_scha	h_fcha[1]	/* System controlled characteristics */
	char	h_UU1[2];	/* Unused 1 */
	char	h_use;		/* Map words in use */
	char	h_priv; 	/* Accessor privilege level */
	struct uic h_fown;	/* File owner UIC */
#define h_prog	h_fown.u_prog	/* Programmer (member) number */
#define h_proj	h_fown.u_proj	/* Project (group) number */
	ushort	h_fpro; 	/* File protection code */
	ushort	h_rpro; 	/* Record protection code */
	char	h_UU2[4];	/* Ununsed 2 */
	char	h_semk[4];	/* Security mask */
	struct ident h_ident;	/* Ident area */
	char	h_other[300];	/* Map area, access control area, etc */
};

struct homeblock {
	Long	H_hblb; 	/* Home block LBN */
	Long	H_ahlb; 	/* Alternate home block LBN */
	Long	H_ihlb; 	/* Backup index file header LBN */
	char	H_vlev[2];	/* Structure level and version */
	ushort	H_sbcl; 	/* Storage bitmap cluster factor */
	ushort	H_hbvb; 	/* Home block VBN */
	ushort	H_ahvb; 	/* Backup home block VBN */
	ushort	H_ihvb; 	/* Backup index file header VBN */
	ushort	H_ibvb; 	/* Index file bitmap VBN */
	ushort	H_iblb[2];	/* Index file bitmap LBN */
	Long	H_fmax; 	/* Maximum number of files */
	ushort	H_ibsz; 	/* Index file bitmap size */
	ushort	H_rsvf; 	/* Number of reserved files */
	ushort	H_dvty; 	/* Disk device type */
	ushort	H_rvn;		/* Relative volume number */
	ushort	H_nvol; 	/* Number of volumes */
	ushort	H_vcha; 	/* Volume characteristics */
	struct uic H_vown;	/* Volume owner UIC */
	Long	H_vsmx; 	/* Volume security mask */
	ushort	H_vpro; 	/* Volume protection code */
	ushort	H_dfpr; 	/* Default file protection */
	ushort	H_drpr; 	/* Default record protection */
	ushort	H_chk1; 	/* First checksum */
	char	H_vdat[8];	/* Volume creation date */
	char	H_wisz; 	/* Default window size */
	char	H_lruc; 	/* Directory pre-access limit */
	ushort	H_fiex; 	/* Default file extend */
	char	H_UU1[388];	/* Unused 1 */
	char	H_snam[12];	/* Structure name */
	char	H_indn[12];	/* Volume name */
	char	H_indo[12];	/* Volume owner */
	char	H_indf[12];	/* Format type */
	char	H_UU2[2];	/* Unused 2 */
	ushort	H_chk2; 	/* Second checksum */
} hblock;

struct directory {
	ushort	d_rbc;		/* Record byte count */
	ushort	d_vrlm; 	/* Version limit */
	char	d_flags;	/* Flags */
	char	d_nbc;		/* Name byte count */
	char	d_fname[1];	/* File name string */
};

struct dirval {
	ushort	d_ver;		/* Version number */
	struct fileid d_fid;	/* File ID */
};

#ifdef __ALPHA
#pragma member_alignment __restore
#endif

#define BUFSIZE 512

#define bit(x)	((01)<<(x))

#define DEV	bit(0)
#define DIR	bit(1)
#define FIL	bit(2)
#define EXT	bit(3)
#define VER	bit(4)

#define DIRBEG	'['
#define DIREND	']'

#define NULLCHR '\0'
#define NULLSTR ""

#define FSMAX	250
#define DEVMAX	20

#define TEXT	0
#define IMGRMS	1
#define IMGFULL 2
#define BINARY	3

#define DISK	0
#define STDOUT	1

#define DFLTMOD TEXT
#define DFLTOUT DISK

void usage(void);
void options(char *arg);
void getvms(void);
void errmsg(char *msg,...);
int openin(void);
void listdir(void);
int copyfile(void);
int crack(void);
int openvms(char *devname);
int finddir(void);
int gethdr(ushort fnum,struct header *hp);
int getlb(Long	lbn,char *buf);
void dirmsg(char *msg,char *dirname,char *ptr);
int okwrite(char *file);
int getvb(Long vbn,char *buf,struct header *hp);
void putch(char c);
void prtfn(struct directory *de,struct dirval *vp);
int convert(char *fl,char *tp,char *vr,struct filnam *f);
Long lbnbase(register ushort *rp);
int openout(void);

char	**av;				/* Global argv */
char	lsflag = 0;			/* Nonzero ==> list directory */
int	xfermode = DFLTMOD;		/* Transfer mode */
int	rmlineno = 0;			/* ntw - remove sos line numbers */
int	outdest = DFLTOUT;		/* Output destination */
char	filspec[FSMAX]; 		/* Full filename string being processed */
int	pflags; 			/* Flags returned by crack() */
char	*dev, *dir, *fil, *typ, *ver;	/* Pointers to cracked filename fields */
char	vmsdev[DEVMAX+6];		/* Special file name for VMS filesystem */
int	vmsfd = -1;			/* File descriptor for reading VMS filesystem */
FILE	*of;				/* Stream pointer for output file */
char	dirfound;			/* Directory found */

#define NDEVMAX 256

char	nativdev[NDEVMAX];
int	natlen;

struct header	indexh, mfdh, dirh, fileh;	/* File headers for index file, MFD,
 UFD, and file */


main(argc,argv)
int	argc;
char	**argv;
{
	char	*basename();

	av = argv;

	if ( --argc == 0 )
		usage();

	if ( *basename(*argv) == 'l' )
		++lsflag;

    natlen = 0;
   while ( argc-- ) {
		if ( **++av == '-' )
			options(*argv);
		else
			getvms();
	}
}


void usage(void)
{
	fprintf(stderr,"usage: %s [-t][-n nativdev][-i][-b][-d][-f][-s] vmsfile\n",*av);
	exit(-1);
}


char *
basename(s)
register char	*s;
{
/* NOTE:  Some versions of UNIX use the name strrchr() rather than rindex() */
	char		*rindex();
	register char	*t;

	if ( (t=rindex(s,
#ifdef VMS
		       ']'
#else
		       '/'
#endif
		       )) == NULL )
		return(s);
	else
		return(t+1);
}


/*
 *  Process option flags
 */

void options(char *arg)
{
	char	*p;
	int kk;
	char * cp;
	char cac;
	char * cop;

	for ( p = *av; *++p; ) {

		switch ( *p ) {

		case 'd':
		case 'f':	outdest = DISK; break;
		case 's':	outdest = STDOUT; break;

		case 't':	xfermode = TEXT; break;
		case 'T':	xfermode = TEXT; rmlineno++; break;	/* ntw */
		case 'i':	xfermode = IMGRMS; break;
		case 'I':	xfermode = IMGFULL; break;
		case 'b':	xfermode = BINARY; break;
		case 'n':	{cop = &nativdev[0];
				kk = 0;
		                natlen=0;
		                cp = p;
		                cac = *++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				if (cac == ' ') cac=*++cp;
				while (*cp != '\0' && *cp != ' ' && *cp != '-'){
				if (cac != ' ' && kk < NDEVMAX-3 && cac != '\0'){
				  nativdev[kk]=cac;
				  nativdev[kk+1] = '\0';
				  kk++;
				  natlen++;
				}
				cac = *++cp;
				p = cp;
				}
				nativdev[kk] = '\0';
                                nativdev[kk+1] = '\0';
		                nativdev[kk+2] = '\0';
		                p = &nativdev[kk];

				break;
				}
		                break;  
		case 'l':	++lsflag; break;
		case 'c':	lsflag = 0; break;

		default:	fprintf(stderr,"Invalid option (%c)\n",*p);

		}
	}
}


/*
 *  Get the next requested file from the VMS filesystem
 */

void getvms(void)
{
	if ( strlen(*av) > FSMAX )
	  {errmsg("Filespec too Long");
	   return;}
	strcpy(filspec,*av);

	if ( lsflag ) {
		if ( openin() )
			listdir();
	} else {
		if ( openin() && openout() ) {
			copyfile();
			if ( of != stdout )
				fclose(of);
		}
	}
}


/*
 *  Open VMS file for input
 */

int openin(void)
{
	static int	filecnt = 0;
	struct filnam	fn;
	ushort		fnum;
	ushort		search();
	int		gh;

	++filecnt;
	if (crack() == 0)
		return (0);
	if ( pflags&DEV && !openvms(dev) )
		return(0);

        if (natlen > 0 && !(pflags&DEV) && filecnt==1 && !openvms(nativdev) )
		return(0);
#ifdef DFLTDEV
        if ( !(pflags&DEV) && filecnt==1 && !openvms(DFLTDEV) )
		return(0);
#endif
	if ( vmsfd < 0 )
		err0("No device specified");
	if ( pflags&(DEV|DIR) && !finddir() )
		return(0);
	if ( !dirfound )
		err0("No directory specified");
	if ( lsflag ) {
		if ( pflags & (FIL|EXT|VER) )
			err0("Invalid directory specification");
		return(1);
	}
	if ( !(pflags&EXT) )
		typ = NULLSTR;
	if ( !(pflags&VER) )
		ver = NULLSTR;
	if ( !convert(fil,typ,ver,&fn) )
		return(0);
	if ( !(fnum=search(&dirh,&fn)) )
		err0("File does not exist");
	if ( !(gh=gethdr(fnum,&fileh)) )
		err0("Can't get file header for file");
	if ( gh == -1 )
		err0("No access privilege for file");
	return(1);
}


/*
 *  Crack the filename string -- First step in parsing it; just
 *  locates the fields, doesn't do much real validity checking
 */

int crack(void)
{
	register char	*p = filspec;
	register char	*q;

	for ( pflags=0; *p; ) {

		if ( *p == DIRBEG ) {
			if ( pflags & (DIR|FIL|EXT|VER) )
				err0("Bad filename syntax");
			dir = p+1;
			while ( *p != DIREND ) {
				if ( 'a' <= *p && *p <= 'z' )	/* SHOUT the directory */
					*p += 'A' - 'a';	/* name in UPPER CASE */
				if ( *p++ == NULLCHR )
					err0("Bad filename syntax");
			}
			*p++ = NULLCHR;
			pflags |= DIR;
			continue;
		}

		for ( q=p; alphnum(*q); ++q )
			;

		if ( *q == ':' ) {
			if ( pflags&(DEV|DIR|FIL|EXT|VER) )
				err0("Bad filename syntax");
			dev = p;
			pflags |= DEV;
			*q = NULLCHR;
			p = q + 1;
			continue;
		}

		if ( *q == '.' || *q == ';' || *q == NULLCHR ) {

			if ( !(pflags&FIL) ) {
				if ( p == q )
					err0("Filename missing");
				fil = p;
				pflags |= FIL;
				if ( *q == ';' ) {
					typ = NULLSTR;
					pflags |= EXT;
				}
			} else if ( !(pflags&EXT) ) {
				typ = p;
				pflags |= EXT;
			} else if ( !(pflags&VER) ) {
				ver = p;
				pflags |= VER;
			} else
				err0("Bad filename syntax");

			if ( *q == NULLCHR ) {
				if ( !(pflags&EXT) )
					typ = NULLSTR;
				if ( !(pflags&VER) )
					ver = NULLSTR;
				break;
			}
			*q = NULLCHR;
			p = q + 1;
			continue;
		}

		err0("Bad filename syntax");
	}

	return(1);
}


/*
 *  Open a disk containing an VMS filesystem
 */

int openvms(char	*devname)
{
	Long	ifhbn;

	if ( strlen(devname) > DEVMAX )
		err1("Device name too Long (%s)",devname);
#ifdef VMS
	strcpy(vmsdev,"");
#else
        strcpy(vmsdev,"");
/*        strcpy(vmsdev,"/dev/"); */
/*
        if ( strncmp(devname,"disk$",5) == 0 )
		devname += 5;
	if ( strncmp(devname,"vms",3) != 0 )
		strcat(vmsdev,"vms");
*/
#endif
	strcat(vmsdev,devname);
#ifdef VMS
	{int retcode;
	 struct dsc$descriptor devd;
	 devd.dsc$w_length = strlen(vmsdev);
	 devd.dsc$a_pointer = vmsdev;
	 devd.dsc$b_class = DSC$K_CLASS_S;
	 devd.dsc$b_dtype = DSC$K_DTYPE_T;
	 vmsfd = 0;
	 retcode = sys$assign(&devd,&vmsfd,0,0);
	 if (retcode != SS$_NORMAL) vmsfd = -1;}
#else
        vmsfd=open(vmsdev,0);
#endif
	if ( vmsfd < 0 )
		err1("Can't open %s",vmsdev);

	if ( !getlb(1L,(char *)&hblock) )
		err1("Can't read homeblock on %s",vmsdev);

	ifhbn = ((Long)hblock.H_iblb[1]<<16) + (Long)hblock.H_iblb[0] + hblock.H_ibsz;
	if ( !getlb(ifhbn,(char *)&indexh) )
		err1("Can't read index file header on %s\n",vmsdev);

	if ( !getlb(ifhbn+3,(char *)&mfdh) )
		err1("Can't read mfd header on %s",vmsdev);

	return(1);
}


/*
 *  Locate the directory whose name is pointed to by "dir"
 */

#define alphanum

int finddir(void)
{
#define direrr(msg,dirname,ptr) { dirmsg(msg,dirname,ptr); return(0); }
	struct header	*hp = &mfdh;
	register char	*p = dir;
	register char	*q;
	char		*strchr();
	int		nch;
	struct filnam	dirfn;
	ushort		dirfnum;
	ushort		search();
	int		gh;

	do {
		for ( q=p; alphnum(*q); ++q )
			;
		if ( ( *q && *q!='.' ) || (nch=q-p) == 0 || nch > 39 )
			err1("Invalid directory ([%s])",dir);
		strncpy(dirfn.f_nam,p,nch);
		dirfn.f_nam[nch] = '\0';
		strcat(dirfn.f_nam,".DIR");
		dirfn.f_ver = 1;
		if ( !(dirfnum=search(hp,&dirfn)) )
			direrr("Directory [%s] does not exist",dir,q);
		if ( !(gh=gethdr(dirfnum,(hp=(&dirh)))) )
			direrr("Can't get file header for directory [%s]",dir,q);
		if ( gh == -1 )
			direrr("No access privilege for directory [%s]",dir,q);
		p = q + 1;
	} while (*q);
	dirfound = 1;
	return(1);
}


/*
 *  Error accessing a directory
 */

void dirmsg(char *msg,char *dirname,char *ptr)
{
	char	c;

	c = *ptr;
	*ptr = '\0';
	errmsg(msg,dirname);
	*ptr = c;
}


/*
 *  Convert file name, type, and version number to "struct filnam" format
 */

int convert(char *fl,char *tp,char *vr,struct filnam *f)
{
	register char *p;

	if ( strlen(fl) > 39 )
		err0("Filename Longer than 39 characters");
	if ( strlen(tp) > 39 )
		err0("File type Longer than 39 characters");
	strcpy(f->f_nam,fl);
	strcat(f->f_nam,".");
	strcat(f->f_nam,tp);
	for ( p=f->f_nam; *p; ++p )		/* This code is needed since */
		if ( 'a' <= *p && *p <= 'z' )	/* VMS loves to SHOUT at you */
			*p += 'A' - 'a';	/* in UPPER CASE all the time */
	for ( f->f_ver=0; *vr; ) {
		if ( !decimal(*vr) )
			err0("Non-digit in version number");
		f->f_ver *= 10;
		f->f_ver += *vr++ - '0';
	}
	return(1);
}


/*
 *  Search a directory (identified by dhp) for a filename
 */

ushort
search(dhp,fn)
register struct header	*dhp;
register struct filnam	*fn;
{
	int				len;
	int				bod;
	register struct directory	*de;
	struct directory		*getde();
	register struct dirval		*vp;
	register struct dirval		*vplim;

	len = strlen(fn->f_nam);
	for ( bod=1; de=getde(dhp,bod); bod=0 ) {
		if ( de->d_nbc!=len || strncmp(de->d_fname,fn->f_nam,len)!=0 )
			continue;
		vp = (struct dirval *) ( de->d_fname + ((de->d_nbc+1)&0376) );
		if ( !fn->f_ver )
			return(vp->d_fid.f_num);
		for ( vplim=(struct dirval *)((char *)(&de->d_vrlm)+de->d_rbc); vp<vplim; ++vp
 ) {
			if ( vp->d_ver > fn->f_ver )
				continue;
			if ( vp->d_ver == fn->f_ver )
				return(vp->d_fid.f_num);
			return(0);
		}
		return(0);
	}
	return(0);
}


/*
 *  Open output file
 */

int openout(void)
{
	char	outfile[256];

	if ( outdest == STDOUT ) {
		of = stdout;
		return(1);
	}

	strcpy(outfile,fil);
	strcat(outfile,".");
	strcat(outfile,typ);
	if (okwrite(outfile) == 0		/* ntw */
	||   (of=fopen(outfile,"w")) == NULL )
		err0("Can't open output file");
	return(1);
}


/*
 * see if ok to write/create this file
 * needed because we might be setuid or setgid
 * to get at the special files for disks
 * nb we assume the file is in the working directory
 * always true at the moment;  might neeed more mess in future
 */

int okwrite(char *file)
{

	if (access(file, 02) == 0)
		return (1);		/* exists and is writeable */
	if (access(file, 0) == 0)
		return (0);		/* exists although not writeable */
	if (index(file, '/'))
		return (0);		/* snh */
#ifdef VMS
	return(1);
#endif

	if (access(".", 02) == 0)
		return (1);		/* file doesn't exist and can create it */
	return (0);
}


/*
 *  Copy input file to output destination
 */

int copyfile(void)
{
	Long		eofblk;
	register Long	block = 0;
	register Long	b = 0;
	char		buf[BUFSIZE];
	int		nbytes = BUFSIZE;
	register char	*p;

	if ( xfermode == BINARY )
		err0("Binary mode not yet supported");
	if ( xfermode != IMGFULL )
		eofblk = ( (Long)fileh.h_rms.f_heof[0] << 16 ) + fileh.h_rms.f_heof[1];
	while ( getvb(++block,buf,&fileh) ) {
		if ( xfermode == IMGFULL ) {
			if ( fwrite(buf,1,BUFSIZE,of) == BUFSIZE )
				continue;
			err0("write error");
		}
		if ( ++b > eofblk )
			return(1);
		if ( b == eofblk )
			nbytes = fileh.h_rms.f_ffby;
		if ( xfermode == IMGRMS ) {
			if ( fwrite(buf,1,nbytes,of) == nbytes )
				continue;
			err0("write error");
		}
		for ( p=buf; p<buf+nbytes; )
			putch(*p++);
	}
	return(1);
}


/*
 *  Process next character from input file
 *  for text mode
 */

/*
 * possible states of the machine:
 */

#define INIT	0	/* waiting for the beginning of a record */
#define COUNT	1	/* in byte count */
#define LINENO	2	/* in line number */
#define DATA	3	/* in data */
#define NULLPAD	4	/* eating the padding null at the end */

void putch(char c)
{
	static unsigned	count;
	static int	state = INIT;
	static int	nextstate;
	static int	lnbytes;

	switch (state) {
	case INIT:
		count = (c&0377);
		state = COUNT;
		break;

	case COUNT:
		if ( (count+=((c&0377)<<8)) == 0 ) {
			putc('\n',of);
			state = INIT;
		} else {
			if (rmlineno == 0)
				state = DATA;
			else {
				lnbytes = 0;
				state = LINENO;
			}
			nextstate = INIT;
			if ( count&1 )
				nextstate = NULLPAD;
		}
		break;

	case LINENO:
		if (lnbytes == 0)
			lnbytes++;
		else
			state = DATA;
		if (--count == 0) {
			putc('\n', of);
			state = INIT;
		}
		break;

	case DATA:
		putc(c,of);
		if ( --count == 0 ) {
			state = nextstate;
			putc('\n',of);
		}
		break;

	case NULLPAD:
		state = INIT;
		break;

	default:
		errmsg("internal error in putch");
		abort();
	}
}


/*
 *  List contents of a UFD
 */

void listdir(void)
{
	register int			bod;
	register struct directory	*de;
	struct directory		*getde();
	register struct dirval		*vp;
	register struct dirval		*vplim;

	for ( bod=1; de=getde(&dirh,bod); bod=0 ) {
		vp = (struct dirval *) ( de->d_fname + ((de->d_nbc+1)&0376) );
		vplim = (struct dirval *) ((char *)(&de->d_vrlm)+de->d_rbc);
		for ( ; vp<vplim; ++vp )
			prtfn(de,vp);
	}
}


/*
 *  Write filename to standard output
 */

void prtfn(struct directory *de,struct dirval *vp)
{
	register char	*p;
	register int	i;
	struct fileid *fip;

	for ( p=de->d_fname, i=de->d_nbc; i>0; --i )
		putc(*p++,stdout);
	fip = &vp->d_fid;
	fprintf(stdout,";%d (%d,%d,%d)\n",vp->d_ver,vp->d_fid.f_num,vp->d_fid.f_seq,vp->d_fid.f_rvn);
}


/*
 *  Return pointer to next directory entry
 */

struct directory *
getde(dhp,bod)
register struct header	*dhp;
int			bod;
{
#define recsize (*((ushort *)de))
#define STOP	((ushort)0177777)
	static Long		vb;
	static Long		eofblk;
	static char		*limit;
	static char		dirbuf[BUFSIZE];
	static char		*de;

	if ( bod ) {
		vb = 0;
		eofblk = ( (Long)dhp->h_rms.f_heof[0] << 16 ) + dhp->h_rms.f_heof[1];
		limit = &dirbuf[BUFSIZE];
	}
	if ( bod || (de+=(recsize+2))>=limit || recsize==STOP ) {
		if ( ++vb == eofblk )
			limit = &dirbuf[dhp->h_rms.f_ffby];
		if ( !getvb(vb,dirbuf,dhp) || (*((ushort *)dirbuf)) == STOP)
			return((struct directory *)0);
		de = dirbuf;
	}
	if ( de >= limit )
		return((struct directory *)0);
	return((struct directory *)de);
}


/*
 *  Get a file header, given the file number; check access privilege
 */

int gethdr(ushort fnum,struct header *hp)
{
#define G_DENY	bit(8)
#define W_DENY	bit(12)
	register Long	bn;
	int		grp;
	int		ogrp;

	bn = (Long)fnum + hblock.H_ibvb + hblock.H_ibsz -1;
	if ( !getvb(bn,(char *)hp,&indexh) )
		return(0);
/* dyke out priv. checks here for now. */
/*
	if ( !(hp->h_fpro&W_DENY) || !getuid())
		return(1);
*/
	grp = getgid();
	ogrp = 64*(grp/100) + 8*((grp/10)%10) + (grp%10);
#ifdef VMS
	/* the user must have LOGIO priv to run this anyway. */
	return(1);
#endif
	return(1); /* dyke priv checks */
/*
	if ( ogrp != hp->h_proj || hp->h_fpro&G_DENY )
		return(-1);
	else
		return(1);
*/
}


/*
 *  Routine to get specified virtual block from a file.  Returns 0
 *  on EOF, 1 otherwise.  Note that vbn is 1-based, not 0-based.
 */

int getvb(Long vbn,char *buf,struct header *hp)
{
#define WTPMASK 0140000
#define WTP00	0000000
#define WTP01	0040000
#define WTP10	0100000
#define WTP11	0140000
	register ushort 	*rp;
	register Long		block;
	register ushort 	*limit;
	register ushort 	wtype;
	register Long		lbn;
	register Long		size;
	ushort			getsize();

	rp = (ushort *)hp + (hp->h_mpof&0377);
	block = 1;
	limit = rp + (hp->h_use & 0377);		/* ntw */
	while ( rp < limit && vbn >= ( block + (size=getsize(rp)) ) ) {
		wtype = (*rp) & WTPMASK;
		switch (wtype) {
			case WTP00:	rp += 1; break;
			case WTP01:	rp += 2; break;
			case WTP10:	rp += 3; break;
			case WTP11:	rp += 4; break;
		}
		block += size;
	}
	if ( rp >= limit )
		return(0);
	lbn = lbnbase(rp) + vbn - block;
	return(getlb(lbn,buf));
}


/*
 *  Return number of blocks mapped by the current window
 */

ushort
getsize(rp)
register ushort *rp;
{
	register ushort wtype;

	wtype = (*rp) & WTPMASK;
	switch (wtype) {
		case WTP00:	return(0);
		case WTP01:	return(((*((char *)rp))&0377)+1);
		case WTP10:	return(((*rp)&037777)+1);
		case WTP11:	return(((((Long)(*rp)&037777)<<16)+rp[1])+1);
	}
}


/*
 *  Return base lbn mapped by the current window
 */

Long lbnbase(register ushort *rp)
{
	register ushort wtype;

	wtype = (*rp)&WTPMASK;
	switch ( wtype ) {
		case WTP00:	return(0L);
		case WTP01:	return(((((char *)rp)[1]&077L)<<16)+rp[1]);
		case WTP10:	return((((Long)rp[2])<<16)+(Long)rp[1]);
		case WTP11:	return((((Long)rp[3])<<16)+(Long)rp[2]);
	}
}


/*
 *  Get block from the filesystem, given the logical block number
 */

int getlb(Long	lbn,char *buf)
{
	if ( lbn == 0L )
		err0("Bad block in file");
#ifdef VMS
	{int retcode;
	 short iosb[4];
	 retcode = sys$qiow(0,vmsfd,IO$_READLBLK,&iosb,0,0,
			    buf,BUFSIZE,lbn,
			    0,0,0);
	 if (retcode != SS$_NORMAL) err1("QIO error %d",retcode);
	 if (iosb[0] != SS$_NORMAL) err1("READVBLK error %d",iosb[0]);}
#else
	if ( lseek(vmsfd,BUFSIZE*lbn,0) == -1L ||  read(vmsfd,buf,BUFSIZE) != BUFSIZE )
		err0("Read error");
#endif
	return(1);
}


/*
 *  Issue an error message
 */

void errmsg(char *msg,...)
{va_list arglist;
 fprintf(stderr,"%s -- ",*av);
 va_start(arglist,msg);
 vfprintf(stderr,msg,arglist);
 va_end(arglist);
 fprintf(stderr,"\n");}
================================================================================
Archive-Date: Wed, 11 Sep 1996 04:43:36 +0200
Sender: owner-free-vms@lp.se
Date: Tue, 10 Sep 1996 22:42:41 -0400 (EDT)
From: EVERHART@gce.mv.com
Reply-To: Free-VMS@lp.se
To: free-VMS@lp.se
Message-ID: <960910224241.62@gce.mv.com>
Subject: re ods-2 reader

By the way, the ods-2 reader was in origin the work of Carl Lydick,
who recently died in California.

There's been a wake going on in the alt.callahans group of sorts.

Credit needs to be given where due.
glenn everhart
================================================================================
Archive-Date: Wed, 11 Sep 1996 16:00:23 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 11 Sep 1996 16:00:07 +0200
From: Richard Levitte <levitte@lp.se>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <009A8382.C4283EC0.8@lp.se>
Subject: Re: re ods-2 reader

>From: EVERHART@gce.mv.com

>By the way, the ods-2 reader was in origin the work of Carl Lydick,
>who recently died in California.

He shall be mourned, bastard as he was.

>Credit needs to be given where due.

Of course.

-- 
R Levitte, Levitte Programming; Spannvägen 38, I; S-161 43  Bromma; SWEDEN
Tel: +46-8-26 52 47, (via nation.se) +46-8-728 20 33;  No fax right now
PGP key fingerprint = A6 96 C0 34 3A 96 AA 6C  B0 D5 9A DF D2 E9 9C 65
Check http://www.lp.se/~levitte for my public key.  bastard@bofh.se
================================================================================
Archive-Date: Wed, 11 Sep 1996 16:03:07 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 11 Sep 1996 10:02:20 -0500
From: "Andrew C. Stoffel" <acs@campus.com>
Reply-To: Free-VMS@lp.se
Subject: Re: RMS File Formats
To: Free-VMS@lp.se
Message-ID: <SIMEON.9609111020.A@muahost.campus.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-Transfer-Encoding: 7BIT


On Wed, 11 Sep 1996 02:07:45 +0200  Richard Levitte <levitte@lp.se> 
wrote:

> It strikes me that many people think that what I'd like to see is a
> VMS for PC's.  Well, that's just part of the truth.  I'd like to see
> it work on Sparcs as well if possible, or why not on HP workstations?

Why not PowerPC ? That's what I'm interested in.... there's already 
a basic Mach implementation with Linux layered on top for a subset 
of PowerPC based Macintoshes...

 
> There are many things that are needed for a working Free-VMS, but
> I'd say that when the ODS-2 reader (writer?  and it was ODS-2, right?)
> that Paul Nankervis seems to be working on is starting to get ready,
> we've got one important part done already.  

> Several people have told
> me how great it would be to have a portable DCL to play with (the
> hardest part is probably to have a portable definition of verbs.

Didn't somebody produce a DCL for DOS ? It wasn't GREAT but not too 
bad.. & it is free.... (Unlike the psuedo-DCL product for NT)

 
> I can help with testing various things and help porting, on and to
> VMS, SunOS, Linux, MSDOS, NT (at least for the moment being).

I can help a little with MacOS/PowerPC if there is any interest....
 
> Obviously, groups will be formed to work on different parts (I imagine
> a DCL hacking group will be formed), and I expect separate mailing lists
> will be provided for those groups.  I have the means to provide such
> services, but I'd be glad if others could contribute resources as well.

I'd love to be involved...  not sure at what level...

> However, that's still in the future.

-Andy- 
 
--------------------------------------------------------------------
Andy Stoffel       Project Consultant           voice:(914) 574-4784
acs@campus.com     http://acs.sunyrockland.edu/ fax:  (914) 574-4354
Campus Consultants Group, Inc.              A Campus America Company


================================================================================
Archive-Date: Wed, 11 Sep 1996 20:45:28 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 11 Sep 1996 11:44:07 -0700
From: Tony Konashenok <tonyk@sseos.lbl.gov>
Reply-To: Free-VMS@lp.se
Message-ID: <199609111844.LAA13048@sseos.lbl.gov>
To: free-vms@lp.se
Subject: Re: ods-2 reader, small mod for display of file id in directories


A little optimisation change to the just-posted ODS-2 reader: change

                switch (wtype) {
                        case WTP00:     rp += 1; break;
                        case WTP01:     rp += 2; break;
                        case WTP10:     rp += 3; break;
                        case WTP11:     rp += 4; break;
                }

to
		switch (wtype) {
			case WTP11:	rp++;
			case WTP10:	rp++;
			case WTP01:	rp++;
			case WTP00:	rp++;
		}

I think modules which are to go deep in the internals deserve to be
optimised carefully, and the case above is not one to be easily detected
by all compilers...

Tony Konashenok
================================================================================
Archive-Date: Tue, 17 Sep 1996 01:12:11 +0200
Sender: owner-free-vms@lp.se
Date: Mon, 16 Sep 1996 17:09:40 -0600
Message-ID: <9609162309.AA23942@snake.srv.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: Free-VMS@lp.se
From: kth@srv.net (Kevin Handy)
Reply-To: Free-VMS@lp.se
Subject: Re: ods-2 reader, small mod for display of file id in directories

>
>A little optimisation change to the just-posted ODS-2 reader: change
>
>                switch (wtype) {
>                        case WTP00:     rp += 1; break;
>                        case WTP01:     rp += 2; break;
>                        case WTP10:     rp += 3; break;
>                        case WTP11:     rp += 4; break;
>                }
>
>to
>		switch (wtype) {
>			case WTP11:	rp++;
>			case WTP10:	rp++;
>			case WTP01:	rp++;
>			case WTP00:	rp++;
>		}
>
>I think modules which are to go deep in the internals deserve to be
>optimised carefully, and the case above is not one to be easily detected
>by all compilers...
>
>Tony Konashenok
>

In my experience, such "optimizations" usually end up making the
program run slower, as well as being harder to understand.

In the "optimized" version, WTP11 will have to execute at least
4 machine instructions(incr, incr, incr, incr), where the first version
there would be only two (mov, branch). If the case statement ever needs
to be extended for some reason, it would only get worse.

The "optimized" code may run faster on some processors, but it's
not going to make any noticable difference on any machine that I
know of in comparison to the running time of the whole program.

Choose the method that is easiest to understand when the
optimizations are so minute. I'd prefer to be able to understand
the program if I had to fix it, than have it run 1 micro-second faster
over a 10 minute run.
-------------------------------------------------------------
Kevin Handy  kth@srv.ne          Accounting Software for
Software Solutions. Inc.         VAX/VMS Computer Systems
Idaho Falls, Idaho

================================================================================
Archive-Date: Tue, 17 Sep 1996 04:39:00 +0200
Sender: owner-free-vms@lp.se
Date: Mon, 16 Sep 1996 22:37:03 -0400
Message-ID: <199609170237.WAA12541@harvey.cyclic.com>
From: Jim Kingdon <kingdonc@harvey.cyclic.com>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Subject: VNG/FreeVMS/LeViMS

Hi, just stumbled across your project.  As a free software enthusiast
and sometime VMS user it struck me as interesting.  I'm not making any
firm commitments in terms of helping, but my interest is piqued.

As for my two cents on the name, I like VNG.  In addition to standing
for "VNG is Not GNU" (very clever!), it could also be seen as "VMS
Next Generation".  And of course anything which arises out of a DEC
product must be named by a TLA*, right?

Here is an attempt at a task list:

1.  Identify and collect existing free user programs.  Many of these
can be made portable to non-VMS systems (this is useful in getting
various jobs done, and also helps publicize the project and involve
people).

a.  A (partial) DCL implementation is at
<URL:ftp://boss1.physik.uni-bonn.de/pub/dcl>.  Needs more features,
probably bugfixes and what-not.

b.  BACKUP?  Not sure whether this exists, but it would be useful in
transferring savesets over the network and other such tasks.

c.  Emacs EDT mode.  Other EDT/EVE/TPU/etc?

2.  Infrastructure.

a.  FTP site with whatever exists so far.

b.  Builds (make? DCL command procedures?)

c.  Packaging (RPM? Are there similar, more VMS-y, tools available?)

d.  Source control (kingdon@cyclic.com is willing to offer help using
CVS.  It can work over TCP/IP and has clients for VMS and a variety of
other systems, although the server currently must run on Unix).

3.  Kernel work (SYS$).  Lots of very different technical approaches
possible here (even if one assumes Mach), so people need to get
together and come up with a design(s).

4.  Libraries (LIB$, RMS, etc.).

5.  Code to read and write VMS filesystems (some code has been posted
to the free-vms mailing list; who will coordinate its future
development?).  This could plug into a wide variety of operating
systems, or be tested as a user mode program.  Probably all of the
above are potentially useful.

6.  Someone to maintain this task list.  kingdon@cyclic.com might put
in *some* further effort but probably does not want the job of
maintaining it long-term.

7.  Work on name and/or logo (involves coming up with ideas and
implementing them, but more importantly, seeing what other people
think and trying to find something which everyone, or as many people
as possible, will feel OK about).  See
<URL:http://www.lp.se/Free-VMS/help-needed.html>.
------------------------

* TLA = Three Letter Acronym.
================================================================================
Archive-Date: Tue, 17 Sep 1996 05:51:11 +0200
Sender: owner-free-vms@lp.se
Date: Mon, 16 Sep 1996 23:48:42 -0400
From: JayPed@aol.com
Reply-To: Free-VMS@lp.se
Message-ID: <960916234841_286556896@emout16.mail.aol.com>
To: Free-VMS@lp.se
Subject: Re: VNG/FreeVMS/LeViMS - GMS (is not VMS)

In a message dated 96-09-16 22:56:14 EDT, you write:

<< As for my two cents on the name, I like VNG.  In addition to standing
 for "VNG is Not GNU" (very clever!), it could also be seen as "VMS
 Next Generation" >>

I like GMS.  'GMS is not VMS'.  I think this gives you a good sound-alike to
VMS that would be quickly understood.

================================================================================
Archive-Date: Tue, 17 Sep 1996 13:50:41 +0200
Sender: owner-free-vms@lp.se
From: "Mike Shawaluk" <mikes@pkware.com>
Reply-To: Free-VMS@lp.se
To: <Free-VMS@lp.se>
Subject: Re: VNG/FreeVMS/LeViMS - GMS (is not VMS)
Date: Tue, 17 Sep 1996 06:48:21 -0500
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Message-ID: <11474170203562@pkware.com>

I still like my first idea, which is FreeMS (rhymes with VMS). It's easier
to say than FreeVMS. Or, there's always FreeV (rhymes with freebie).
--
Mike Shawaluk - mikes@pkware.com - http://www.execpc.com/~mikesh/
Software Developer and Webmaster 
PKWARE, Inc. - The Data Compression Experts
http://www.pkware.com/

----------
> From: JayPed@aol.com
> To: Free-VMS@lp.se
> Subject: Re: VNG/FreeVMS/LeViMS - GMS (is not VMS)
> Date: Monday, September 16, 1996 10:48 PM
> 
> In a message dated 96-09-16 22:56:14 EDT, you write:
> 
> << As for my two cents on the name, I like VNG.  In addition to standing
>  for "VNG is Not GNU" (very clever!), it could also be seen as "VMS
>  Next Generation" >>
> 
> I like GMS.  'GMS is not VMS'.  I think this gives you a good sound-alike
to
> VMS that would be quickly understood.
================================================================================
Archive-Date: Tue, 17 Sep 1996 14:46:28 +0200
Sender: owner-free-vms@lp.se
Date: Tue, 17 Sep 1996 14:46:23 +0200
From: Richard Levitte <levitte@lp.se>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <009A882F.75DB7C80.7@lp.se>
Subject: Re: VNG/FreeVMS/LeViMS - GMS (is not VMS)

>From: "Mike Shawaluk" <mikes@pkware.com>

>I still like my first idea, which is FreeMS (rhymes with VMS). It's easier

Free MicroSoft?  No thanks.  I will in a totalitary manner refuse to
accept that name.

1/2 :-)

-- 
R Levitte, Levitte Programming; Spannvägen 38, I; S-161 43  Bromma; SWEDEN
Tel: +46-8-26 52 47, (via nation.se) +46-8-728 20 33;  No fax right now
PGP key fingerprint = A6 96 C0 34 3A 96 AA 6C  B0 D5 9A DF D2 E9 9C 65
Check http://www.lp.se/~levitte for my public key.  bastard@bofh.se
================================================================================
Archive-Date: Tue, 17 Sep 1996 17:26:47 +0200
Sender: owner-free-vms@lp.se
Date: Tue, 17 Sep 1996 11:24:03 -0400 (EDT)
From: Bob Koehler <KOEHLER@bessta.gsfc.nasa.gov>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <960917112403.1446@bessta.gsfc.nasa.gov>
Subject: name


  IMHO, I like VNU (VMS is not UNIX).

Bob

================================================================================
Archive-Date: Wed, 18 Sep 1996 01:00:58 +0200
Sender: owner-free-vms@lp.se
Date: Tue, 17 Sep 1996 18:59:48 -0400
Message-ID: <199609172259.SAA24846@harvey.cyclic.com>
From: Jim Kingdon <kingdonc@harvey.cyclic.com>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Subject: task list, 17 Sep 96
BCC: 

Uh, I'm glad to see that there is so much creativity going into the
name, but at the current rate of progress we aren't going to have
anything to name :-).

Here is a new revision of the task list (you can see who has been
browsing DECUS catalogs).  I will gladly accept any mail suggesting
changes, or (better yet) mail asking to be put down as the/a
volunteer/coordinator for a task.  Changes are:

* Add item about MAIL.

* VMSINSTAL seems like the preferred packaging format (sorry, it's
been a while since I used VMS a lot; I've forgotten some things).

* Mention SHS, JED, VHS, DCLCOMPLETE, the "RMS" package.

* Add items concerning documentation and archive formats.

* Other minor edits.

Task list:

1.  Identify and collect existing free user programs.  Many of these
can be made portable to non-VMS systems (this is useful in doing Real
Work (TM), and also helps publicize the project and involve people).

a.  DCL.  A (partial) DCL implementation is at
<URL:ftp://boss1.physik.uni-bonn.de/pub/dcl>.  Needs more features,
probably bugfixes and what-not.  Also see DCLCOMPLETE at
<URL:http://www.decus.org/libcatalog/document_html/vs0185_26.html>
which describes DCL extensions which would be worth considering
(particularly as a way of getting people to consider running, and
enhancing/fixing, our DCL mutant).  VSH at
<URL:http://www.decus.org/libcatalog/description_html/v00123.html>
also might be worth a look; it claims to implement all the DCL
features from VMS 3.5.

b.  BACKUP?  Not sure whether this exists, but it would be useful in
transferring savesets over the network and other such tasks.

c.  Emacs EDT mode.  JED (said to be EDT-like).  Other editors?

d.  A clone of MAIL is not a high priority, as there are many mail
programs at
<URL:http://www.decus.org/libcatalog/description_html/vs0185.html>.
Of course, there is something to be said for offering a direct MAIL
replacement if people want to work on that.

e.  SHOW SYSTEM is done (see SHS at
<URL:ftp://www.decus.org/pub/lib/vs0185/shs/>).

2.  Infrastructure.

a.  FTP site with whatever exists so far.

b.  Builds (one of the make variants for VMS? DCL command procedures?)

c.  "official" archive format?  DECUS seems to use .ZIP which seems
like a good choice.

d.  Packaging (probably want to write a VMSINSTAL clone)

e.  Source control (kingdon@cyclic.com is willing to offer help using
CVS.  It can work over TCP/IP and has clients for VMS and a variety of
other systems, although the server currently must run on Unix).

f.  "official" documentation format?  We probably will need a browser
which can understand both HTML and VMS HELP (since there is existing
documentation in those formats, or in formats which can be readily
converted to those formats).

3.  Kernel work (SYS$).  Lots of very different technical approaches
possible here (even if one assumes Mach), so people need to get
together and come up with a design(s).

4.  Libraries (LIB$, RMS, etc.).

a.  RMS--a few include files with some starting points are at
<URL:ftp://www.decus.org/pub/lib/v00487/rms/>.  Also see discussion
from free-vms mailing list from September, 1996.

5.  Code to read and write VMS filesystems (some code was posted to
the free-vms mailing list in September, 1996; who will coordinate its
future development?).  This could plug into a wide variety of
operating systems, or be tested as a user mode program.  Probably all
of the above are potentially useful.  For the most part RMS can be
considered a separate task from providing SYS$QIO-level access.

6.  Someone to maintain this task list.  kingdon@cyclic.com might put
in *some* further effort but probably does not want the job of
maintaining it long-term.

7.  Work on name and/or logo (involves coming up with ideas and
implementing them, but more importantly, seeing what other people
think and trying to find something which everyone, or as many people
as possible, will feel OK about).  See
<URL:http://www.lp.se/Free-VMS/help-needed.html>.

8.  Documentation.  Each of the above pieces of software will need
documentation.
================================================================================
Archive-Date: Wed, 18 Sep 1996 04:58:30 +0200
Sender: owner-free-vms@lp.se
Date: Tue, 17 Sep 1996 22:55:18 -0500 (EST)
From: "Andrew C. Stoffel (914) 574-4784" <acs@campus.com>
Reply-To: Free-VMS@lp.se
Subject: Re: task list, 17 Sep 96
To: Free-VMS@lp.se
CC: ASTOFFEL@sunyrockland.edu
Message-ID: <Pine.PMDF.3.91.960917223933.11326A-100000@RCCLNK.SUNYROCKLAND.EDU>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Content-Transfer-Encoding: 7BIT

-----BEGIN PGP SIGNED MESSAGE-----

On Tue, 17 Sep 1996, Jim Kingdon wrote:

> Uh, I'm glad to see that there is so much creativity going into the
> name, but at the current rate of progress we aren't going to have
> anything to name :-).
> 
> Here is a new revision of the task list (you can see who has been
> browsing DECUS catalogs).  I will gladly accept any mail suggesting
> changes, or (better yet) mail asking to be put down as the/a
> volunteer/coordinator for a task.  Changes are:


I'm a little confused...

What's the relationship of this task list with the "Official" FreeVMS
effort... ?

> Task list:

> b.  BACKUP?  Not sure whether this exists, but it would be useful in
> transferring savesets over the network and other such tasks.

Don't even THINK about FreeVMS without some utility similar to BACKUP.
Support of the backup command options also... tar is not an acceptible
substitute...
 
> c.  Emacs EDT mode.  JED (said to be EDT-like).  Other editors?

psuedo-TPU with EDT mode instead.... why emacs ? How about something
cleaner ?

> d.  A clone of MAIL is not a high priority, as there are many mail
> programs at

> 2.  Infrastructure.

> d.  Packaging (probably want to write a VMSINSTAL clone)

 
> f.  "official" documentation format?  We probably will need a browser
> which can understand both HTML and VMS HELP (since there is existing
> documentation in those formats, or in formats which can be readily
> converted to those formats).

Why anything other than HTML ? THough there is a VMS Help gateway
available for the OSU http server...

> <URL:http://www.lp.se/Free-VMS/help-needed.html>.

Isn't this the "Official" Free-VMS site ?

SOmething missing... development tools... wasn't BLISS released into
the public domain ?



Awful large amount of energy exhibited here.... but what's the
connection between this & Free-VMS ?

- -Andy-

- ------------------------------------------------------------------------
Andy Stoffel         Project Consultant            voice: (914) 574-4784
acs@campus.com       http://acs.sunyrockland.edu/  fax:   (914) 574-4354
Campus Consultants Group, Inc.                  A Campus America Company 
[******* PGP public key: http://acs.sunyrockland.edu/pubkey.txt *******]


-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQB1AwUBMj8sSZ3f66UHPSGFAQEq9QMAizXY8SrPxzpbbo4BruE2X+Trt+2A0K1o
GlNPxD79ubv2BitZpycTVyKVuYhzXTLGVN6Szh1b523roaR6a8uv0Bgwlf4z0JtJ
0rtY1AlcFtHSHRENj8wKN8hKKMu3ZAqx
=hICM
-----END PGP SIGNATURE-----
================================================================================
Archive-Date: Wed, 18 Sep 1996 10:18:57 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 18 Sep 1996 10:18:54 +0200
From: Richard Levitte <levitte@lp.se>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <009A88D3.4279DA40.1@lp.se>
Subject: Re: task list, 17 Sep 96

>From: "Andrew C. Stoffel (914) 574-4784" <acs@campus.com>

>On Tue, 17 Sep 1996, Jim Kingdon wrote:
>
>> Uh, I'm glad to see that there is so much creativity going into the
>> name, but at the current rate of progress we aren't going to have
>> anything to name :-).
>> 
>> Here is a new revision of the task list (you can see who has been
                             ^^^
Jim, you should maybe say "my proposal for a task list" for now.  I've
received several such proposal, and I will look at them more closely
in the coming weekend and try to merge them in some way.

>I'm a little confused...
>
>What's the relationship of this task list with the "Official" FreeVMS
>effort... ?

Andy, there is a relationship.  I've explicitelly asked for help with
creating a task list.  Most people have sent their proposal to me by
private mail.  Jim has chosen not to do it that way.

I know that there is already one minimal task list (as part of the
current charter), but I want a more fine-grained one, and since I don't
claim to be a master when it comes to remembering everything, I've
asked for input.

Jim has apparently concentrated mostly on utilities, and what you can
already find out there.

>> b.  BACKUP?  Not sure whether this exists, but it would be useful in

>Don't even THINK about FreeVMS without some utility similar to BACKUP.
>Support of the backup command options also... tar is not an acceptible
>substitute...

Absolutelly correct (Hell, I should know.  I'm the maintainer of VMSTAR :-)).

>> <URL:http://www.lp.se/Free-VMS/help-needed.html>.
>
>Isn't this the "Official" Free-VMS site ?

Right you are.  Please look at that page.

>SOmething missing... development tools... wasn't BLISS released into
>the public domain ?

BLISS *binaries* were released.  I haven't seen the source anywhere.
Hunter, do you know anything more on this?

-- 
R Levitte, Levitte Programming; Spannvägen 38, I; S-161 43  Bromma; SWEDEN
Tel: +46-8-26 52 47, (via nation.se) +46-8-728 20 33;  No fax right now
PGP key fingerprint = A6 96 C0 34 3A 96 AA 6C  B0 D5 9A DF D2 E9 9C 65
Check http://www.lp.se/~levitte for my public key.  bastard@bofh.se
================================================================================
Archive-Date: Wed, 18 Sep 1996 11:10:07 +0200
Sender: owner-free-vms@lp.se
Message-ID: <199609180907.LAA19484@bofh.belwue.de>
Subject: Re: task list, 17 Sep 96
To: Free-VMS@lp.se
Date: Wed, 18 Sep 1996 08:33:17 +0200 (MET DST)
From: framstag@RUS.Uni-Stuttgart.DE (Ulli Horlacher)
Reply-To: Free-VMS@lp.se
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

> > c.  Emacs EDT mode.  JED (said to be EDT-like).  Other editors?
> 
> psuedo-TPU with EDT mode instead.... why emacs ? How about something
> cleaner ?

JED has the best EDT (keyboard emulation) I have ever saw. And I have
looked a LOT editors after I was forced to used UNIX at work.
It would be the best substitution when we don't get a real (and free) TPU.

The marco-language of JED, s-lang, is much closer to TPU than e-lisp from
emacs. While TPU's syntax is more pascal-like, s-lang looks more like C
(but it is a stack-based language (great!)).


> > f.  "official" documentation format?  We probably will need a browser
> > which can understand both HTML and VMS HELP (since there is existing
> > documentation in those formats, or in formats which can be readily
> > converted to those formats).
> 
> Why anything other than HTML ? THough there is a VMS Help gateway
> available for the OSU http server...

JED comes already with a VMS-Help reader! Exactly, it can read *.HLP
files, not *.HLB, but this is a pro in my view :-)


-- 
\ Ulli 'Framstag' Horlacher  \ BelWue-Koordination \  framstag@belwue.de \
 \ Universitaet Stuttgart \ Allmandring 30 \ D-70550 Stuttgart \  Germany \
  \ SAFT://linux.rus.uni-stuttgart.de/framstag   \    HTTP://www.belwue.de \
   \          "X.500: Security through Complexity" - Juergen G.             \

================================================================================
Archive-Date: Wed, 18 Sep 1996 11:10:53 +0200
Sender: owner-free-vms@lp.se
Message-ID: <199609180907.LAA19480@bofh.belwue.de>
Subject: Re: name
To: Free-VMS@lp.se
Date: Wed, 18 Sep 1996 08:47:08 +0200 (MET DST)
From: framstag@RUS.Uni-Stuttgart.DE (Ulli Horlacher)
Reply-To: Free-VMS@lp.se
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

>   IMHO, I like VNU (VMS is not UNIX).

<AOL> add me too! </AOL>


-- 
\ Ulli 'Framstag' Horlacher  \ BelWue-Koordination \  framstag@belwue.de \
 \ Universitaet Stuttgart \ Allmandring 30 \ D-70550 Stuttgart \  Germany \
  \ SAFT://linux.rus.uni-stuttgart.de/framstag   \    HTTP://www.belwue.de \
   \          "X.500: Security through Complexity" - Juergen G.             \

================================================================================
Archive-Date: Wed, 18 Sep 1996 15:07:55 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 18 Sep 1996 9:05:14 -0400 (EDT)
From: Bob Koehler <KOEHLER@bessta.gsfc.nasa.gov>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <960918090514.1438@bessta.gsfc.nasa.gov>
Subject: Re: task list, 17 Sep 96

>
>> b.  BACKUP?  Not sure whether this exists, but it would be useful in
>> transferring savesets over the network and other such tasks.
>
>Don't even THINK about FreeVMS without some utility similar to BACKUP.
>Support of the backup command options also... tar is not an acceptible
>substitute...
> 

 There is a vmsbackup.c available on a couple of net sites that allows one
 to read/write vms backup format tapes under UNIX.  I assume it doens't
 completely support RMS since that doesn't really make sense under UNIX, but
 it might be a good place to start.

Bob

================================================================================
Archive-Date: Wed, 18 Sep 1996 15:35:55 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 18 Sep 1996 08:33:34 CST
From: Hunter Goatley <goathunter@MadGoat.COM>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <009A88C4.8B36D4D6.19@ALPHA.WKU.EDU>
Subject: Re: task list, 17 Sep 96

Richard Levitte <levitte@lp.se> writes:
>
>>SOmething missing... development tools... wasn't BLISS released into
>>the public domain ?
>
>BLISS *binaries* were released.  I haven't seen the source anywhere.
>Hunter, do you know anything more on this?
>
The sources were not released and won't be.  The Alpha compiler uses
the GEM back-end, which all of the Alpha compilers use, so Digital
obviously isn't going to give that away. ;-)

Hunter
------
Hunter Goatley, Process Software Corporation (TCPware)
<goathunter@MadGoat.com>     http://www.wku.edu/www/madgoat/hunter.html
================================================================================
Archive-Date: Wed, 18 Sep 1996 19:01:57 +0200
Sender: owner-free-vms@lp.se
From: Bill/Carolyn Pechter <pechter@shell.monmouth.com>
Reply-To: Free-VMS@lp.se
Message-ID: <199609181655.MAA19862@shell.monmouth.com>
Subject: Re: task list, 17 Sep 96
To: Free-VMS@lp.se
Date: Wed, 18 Sep 1996 12:55:12 -0400 (EDT)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

> 
> Richard Levitte <levitte@lp.se> writes:
> >
> >>SOmething missing... development tools... wasn't BLISS released into
> >>the public domain ?
> >
> >BLISS *binaries* were released.  I haven't seen the source anywhere.
> >Hunter, do you know anything more on this?
> >
> The sources were not released and won't be.  The Alpha compiler uses
> the GEM back-end, which all of the Alpha compilers use, so Digital
> obviously isn't going to give that away. ;-)
> 
> Hunter
> ------
> Hunter Goatley, Process Software Corporation (TCPware)
> <goathunter@MadGoat.com>     http://www.wku.edu/www/madgoat/hunter.html
> 

I thought the PDP10 or PDP11 Bliss sources were released... Perhaps with a bit
of work...  (I may be wrong...)

Bill

-------------------------------------------------------------------------------
 Bill Pechter/Carolyn Pechter  | 17 Meredith Drive, Tinton Falls, NJ 07724, 
 908-389-3592                  | pechter@shell.monmouth.com                
 I'll run Win95 on my box when you pry the keyboard from my cold, dead
 hands.  FreeBSD, OS/2, CP/M, RT11, spoken here.
================================================================================
Archive-Date: Wed, 18 Sep 1996 19:27:27 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 18 Sep 1996 13:27:06 -0400
Message-ID: <199609181727.NAA04403@harvey.cyclic.com>
From: Jim Kingdon <kingdonc@harvey.cyclic.com>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Subject: Re: task list, 17 Sep 96
BCC: 

Sorry if I stepped on some toes regarding my attempt at a task list.
I would very much like it if Richard Levitte (or anyone else) goes
ahead and merges it with the other such lists which he has received.

A few specific replies:

1.  I agree, we need BACKUP at some point.  Any confusion probably
results from me not being clear about short-term versus long-term and
existing versus needs-to-be-written.

2.  Regarding editors: IMHO it is futile to try to designate one
editor as the "official" editor.  JED seems like the most attractive
candidate at the moment, but whether it is what "everyone" uses it is
something that will be determined by "everyone", not by some central
authority.  If someone wants to go write a TPU clone, by all means go
do it.

3.  Regarding documentation formats: The need is to be able to
support/import VMS HELP and HTML (and possibly others).  If you look
at all the VMS HELP files on DECUS tapes that should clarify why the
former is needed.  This support could be done in a variety of ways,
for example a browser which understands both or a VMS HELP->HTML
conversion program, and the task list should not specify one approach
or another at this stage.  (also, for reference volume3 of the
comp.sources.unix archive has a "VMS-style help facility"; I haven't
looked into whether it would be useful or not).

4.  Development tools.  GCC seems like the obvious pick--it has been
running on VMS for a long time.  I've sort of been assuming that
FreeVMS will be (mostly at least) written in C, but I don't know,
maybe other people had other ideas.

5.  You can sign me up for taking vmsbackup.c and trying to bring it
closer to being a true BACKUP replacement.  Anything people want to do
with a FTP site and/or CVS server would help me collaborate with any
other contributors/testers/etc, but I won't wait for that to at least
get a start on this.  If anyone knows of any versions of this program
more recent than the ones from comp.sources.unix volume 7, or
http://www.netlib.no/netlib/alliant/vmstapes, please let me know.
================================================================================
Archive-Date: Wed, 18 Sep 1996 19:34:28 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 18 Sep 1996 10:32:08 -0700
From: Tony Konashenok <tonyk@sseos.lbl.gov>
Reply-To: Free-VMS@lp.se
Message-ID: <199609181732.KAA01214@sseos.lbl.gov>
To: free-vms@lp.se
Subject: Re: task list, 17 Sep 96


$!   c.  Emacs EDT mode.

Could we pick anything else? Emacs is the worst resource hog of all editors!

Tony K

================================================================================
Archive-Date: Wed, 18 Sep 1996 19:45:38 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 18 Sep 1996 12:43:15 CST
From: Hunter Goatley <goathunter@MadGoat.COM>
Reply-To: Free-VMS@lp.se
To: Free-VMS@lp.se
Message-ID: <009A88E7.6C977049.8@ALPHA.WKU.EDU>
Subject: Re: task list, 17 Sep 96

Bill/Carolyn Pechter <pechter@shell.monmouth.com> writes:
>
>I thought the PDP10 or PDP11 Bliss sources were released... Perhaps with a bit
>of work...  (I may be wrong...)
>
I had heard the same thing once upon a time, but never found them.  I
*did* have someone once send me sources to MicroBLISS (I think that's
what it was called), but it looked like it would take a lot of work to
make real use of them.  I don't have a system to check on now, but
when I get my new Alpha set up, I'll look for the sources I have and
report back.

Hunter
------
Hunter Goatley, Process Software Corporation (TCPware)
<goathunter@MadGoat.com>     http://www.wku.edu/www/madgoat/hunter.html
================================================================================
Archive-Date: Wed, 18 Sep 1996 21:10:39 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 18 Sep 1996 15:08:08 -0400
From: leichter@smarts.com (Jerry Leichter)
Reply-To: Free-VMS@lp.se
Message-ID: <199609181908.PAA28006@just.smarts.com>
To: Free-VMS@lp.se
Subject: Re: task list, 17 Sep 96
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

| >I thought the PDP10 or PDP11 Bliss sources were released... Perhaps with a 
bit
| >of work...  (I may be wrong...)
| >
| I had heard the same thing once upon a time, but never found them.  I
| *did* have someone once send me sources to MicroBLISS (I think that's
| what it was called), but it looked like it would take a lot of work to
| make real use of them.  I don't have a system to check on now, but
| when I get my new Alpha set up, I'll look for the sources I have and
| report back.

There were two different PDP-10 Bliss implementations:  The original one done at 
CMU, and the DEC one.  (The DEC one was probably an outgrowth of the CMU one.)

I think you can probably get the CMU Bliss sources - I think CMU did try to sell 
their implementation at one time, but they (like other universities) soon found 
that being software houses wasn't a very good business.

The DEC and CMU Bliss languages aren't identical (though I don't have any memory 
of what the differences are).
							-- Jerry
================================================================================
Archive-Date: Wed, 18 Sep 1996 22:43:56 +0200
Sender: owner-free-vms@lp.se
Date: Wed, 18 Sep 1996 13:41:26 PDT
From: "Henry W. Miller" <henrym@sact