Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_FS_1_19910112 - c/misc/wancho.lib
There are no other files named wancho.lib in the archive.
22-Aug-86 00:08:55-PDT,3513;000000000001
Return-Path: <[email protected]>
Received: from SIMTEL20.ARPA by SRI-NIC.ARPA with TCP; Fri 22 Aug 86 00:08:50-PDT
Date: Fri 22 Aug 86 00:42:52-MDT
From: Frank J. Wancho <[email protected]>
Subject: Re: Library contributions?
To: [email protected]
cc: [email protected]
In-Reply-To: <[email protected]>
Message-ID: <[email protected]>

Ken,

The first significant set of functions were stolen from the SUMEX/MIT
C compiler runtime library.  These deal with filename strings.  They
might be worth converting to use a structure and pass the structure,
or else use something akin to the argblocks used with the jsys() call.
(Why weren't regs passed in a structure for jsys()?)
fnparse (old, dev, dir, nm, typ, gen, attr)
	char *old, *dev, *dir, *nm, *typ, *gen, *attr;
	/* parses a name into its components */

char *fngdv (old, buf)  char *old, *buf;
char *fngdr (old, buf)  char *old, *buf;
char *fngnm (old, buf)  char *old, *buf;
char *fngtp (old, buf)  char *old, *buf;
char *fnggn (old, buf)  char *old, *buf;
char *fngat (old, buf)  char *old, *buf;
	/* extract the relevant component only */

fncons (buf, dev, dir, nm, typ, gen, attr)
	char *buf, *dev, *dir, *nm, *typ, *gen, *attr;
	/* construct a filename (TOPS20 format) from its components */

char *fnsdf (buf, old, dv, dir, nm, typ, gen, attr)
	char *old, *buf, *dv, *dir, *nm, *typ, *gen, *attr;
	/* buf is set to contain a new filename with the
	supplied components substituted for null components of
	the filename in old */

char *fnsfd (buf, old, dv, dir, nm, typ, gen, attr)
	char *old, *buf, *dv, *dir, *nm, *typ, *gen, *attr;

	/* buf is set to contain a new filename with the
	supplied components substituted for components of the
	filename in old.  This is different from fnsdf in that
	non-zero component arguments (dv, dir, etc.) are
	substituted even if old is not null in the corresponding
	field. */

fnstd (old, buf)  char *old, *buf;
	/* copy old to buf; if old is in UNIX format, buf will
	have it in TOPS20 format.  This "standardizes" filenames
	before they are used in system calls, etc. */
char   *
makefnam    (fn1, fn2, new)
char   *fn1, *fn2, *new;
	/* fn2 is the default filename string with any components
	specified in fn1 overriding the corresponding component in
	fn2. */


static char result[100];

char   *dir (filename)		/* get files, one by one */
char   *filename;		/* template, or NULL */


int haswild(fname)		/* returns true (1) if string */
char *fname;			/* contains a TOPS-20 wildcard */


getfullname(s)	/* returns in s the full name of the file specified */
char *s;	/* in s.  The file must not be open.  */


putwe (w, iob)  /* Puts a 16-bit word into a file LSB first */
int     w;
FILE   *iob;


int     getw16 (iob)	/* get 16-bit word from file, LSB first */
FILE   *iob;		/* with sign bit propagated */


int     getx16 (iob)	/* get unsigned 16-bit word from file, LSB first */
FILE   *iob;


long
fr (fd, buf, cnt)	/* like read but stdio */
FILE *fd;
char *buf;
long cnt;


int     upper (s)	/* uppercase string in place */
char   *s;


strip (s)		/* strip leading and trailing blanks in place */
char *s;


static char todbuf[26];

char *ts()	/* timestamp - returns pointer to todbuf containing */
		/* the current date/time in default TOPS-20 format */
		/* This could easily be changed to take flags for */
		/* alternate options. */
-------