From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX"  4-AUG-1989 00:25
To:	MRGATE::"ARISIA::EVERHART"
Subj:	VMS MORE V1.00 5 OF 5

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Thu,  3 AUG 89 20:48:45 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Thu, 3 Aug 89 20:31:07 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.37)
	id AA15511; Thu, 3 Aug 89 20:30:56 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 3 Aug 89 19:51:09 GMT
From: haven!aplcen!jhunix!ins_bxs@purdue.edu  (Xuning Shan)
Organization: The Johns Hopkins University - HCF
Subject: VMS MORE V1.00 5 OF 5
Message-Id: <2195@jhunix.HCF.JHU.EDU>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

VMS MORE V1.00  5 OF 5:

-+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+
X * additions into the word definition.
X *
X * If the string parameter is 0 or null string, the table is reset back to t
Vhe
X * default, which contains A-Z a-z 0-9 _. `091We use the compact bitset
X * representation for the default table`093 */
X    `032
Xnoshare static char deftab`09116`093 = `123
X        0, 0, 0, 0, 0, 0, 377, 003, 376, 377, 377, 207,
X        376, 377, 377, 007
X`125;
X    `032
Xvoid re_modw(s)
X        register char  *s;
X`123
X        register int    i;
X        if (!s `124`124 !*s) `123
X                for (i = 0; i < MAXCHR; i++)
X                        if (!isinset(deftab, i))
X                                iswordc(i) = 0;
X        `125 else
X                while (*s)
X                        iswordc(*s++) = 1;
X`125
X    `032
X/* re_subs: substitute the matched portions of the src in dst.
X *
X * &    substitute the entire matched pattern.
X *
X * \digit    substitute a subpattern, with the given tag number. Tags are
X * numbered from 1 to 9. If the particular tagged subpattern does not exist,
X * null is substituted. */
Xint re_subs(src, dst)
X        register char  *src;
X        register char  *dst;
X`123
X        register char   c;
X        register int    pin;
X        register char  *bp;
X        register char  *ep;
X        if (!*src `124`124 !bopat`0910`093)
X                return (0);
X        while (c = *src++) `123
X                switch (c) `123
X                case '&':
X                        pin = 0;
X                        break;
X                case '\\':
X                        c = *src++;
X                        if (c >= '0' && c <= '9') `123
X                                pin = c - '0';
X                                break;
X                        `125
X                default:
X                        *dst++ = c;
X                        continue;
X                `125
X    `032
X                if ((bp = bopat`091pin`093) && (ep = eopat`091pin`093)) `123
X                        while (*bp && bp < ep)
X                                *dst++ = *bp++;
X                        if (bp < ep)
X                                return (0);
X                `125
X        `125
X        *dst = (char) 0;
X        return (1);
X`125
X/* re_fail: internal error handler for re_exec.
X * should probably do something like a longjump to recover gracefully.*/
Xvoid re_fail(s, c)
X        char           *s;
X        char            c;
X`123
X        printf("\n%s `091opcode %o`093\n", s, c);
X        exit(0);
X`125
$ CALL UNPACK REG.C;2 107616656
$ create/nolog 'f'
X#define NULL 0
X/**********************************************************************
X *     convert_unix_to_vms () --- Converts a unix file name to a vms
X *                   file name.  THIS IS A HACK.  DOESN'T
X *                                  UNDERSTAND `126user/ or ./xxx .`032
X *     --Warner Losh
X */
X`032
Xchar *convert_unix_to_vms (fn)
Xchar *fn;
X`123
X        register char *src, *dst;
X        int len;
X        static char buffer`091160`093;
X        char *strchr();
X        char *strrchr();
X`032
X        src = fn;
X        dst = buffer;
X`032
X        if (*src == '`126')
X        `123
X                strcpy (dst, getenv ("HOME"));
X                dst += strlen (dst);
X                src += 1;
X                if (*src == '/')
X                        src += 1;
X                if (strchr (src, '/') != (char *) NULL)
X                        *(dst - 1) = '.';
X        `125
X        else if (*src == '/')
X        `123
X                *dst++ = '`091';
X                src += 1;
X        `125
X        else if (strchr (src, ':') != (char *) NULL)
X        `123
X                len = strchr (src, ':') - src + 1;
X                strncpy (dst, src, len);
X                dst += len;
X                src += len;
X                if (*src == '/')
X                        src++;
X                *dst++ = '`091';
X        `125
X        else
X        `123
X                if (*src == '.')
X                `123
X                        *dst++ = '`091';
X                `125
X                else
X                `123
X                        strcpy (buffer, "`091.");
X                        dst += 2;
X                `125
X        `125
X`032
X        while (*src)
X        `123
X                if (strncmp ("../", src, 3) == 0)
X                `123
X                        *dst++ = '-';
X                        src += 3;
X                        if (strchr (src, '/') == (char *) NULL)
X                                *dst++ = '`093';
X                        continue;
X                `125
X                if (*src == '/')
X                `123
X                        if (strchr (src + 1, '/') == (char *) NULL)
X                                *dst++ = '`093';
X                        else
X                                *dst++ = '.';
X                        src += 1;
X                        continue;
X                `125
X                if (*(dst - 1) == '-' && *(src - 1) == '/')
X                        *dst++ = '.';
X                *dst++ = *src++;
X        `125
X        dst = malloc (strlen (buffer) + 1);
X        strcpy (dst, buffer);
X        return dst;
X`125    /* end of convert_unix_to_vms () */
X
$ CALL UNPACK UNIX2VMS.C;1 1398481989
$ EXIT

