From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 19-AUG-1989 03:20
To:	MRGATE::"ARISIA::EVERHART"
Subj:	VMS MORE 7 OF 7

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri, 18 AUG 89 22:12:11 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Fri, 18 Aug 89 22:08:38 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.37)
	id AA29402; Fri, 18 Aug 89 21:53:34 -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: 19 Aug 89 04:00:14 GMT
From: gem.mps.ohio-state.edu!ginosko!aplcen!jhunix!jhuvms.bitnet@tut.cis.ohio-state.edu  (Xuning Shan)
Organization: Dept. of Chemical Engineering, The Johns Hopkins University
Subject: VMS MORE 7 OF 7
Message-Id: <2326@jhunix.HCF.JHU.EDU>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

-+-+-+-+-+-+-+-+ START OF PART 7 -+-+-+-+-+-+-+-+
X        BLD  = tgetstr(SMG$K_BEGIN_BOLD);
X        BLDE = tgetstr(SMG$K_END_BOLD);
X`009SCROLLR = tgetstr(SMG$K_SCROLL_REVERSE);
X        WSCREEN = tgetstr(SMG$K_WIDTH_WIDE);
X        NSCREEN = tgetstr(SMG$K_WIDTH_NARROW);
X        setbuf(stdout, 0);
X        return TRUE;
X`125  /* Terminal_Open */
X`032
X/* ClrEOL
X      Clears   from begining to end of line*/
Xvoid ClrEOL()
X`123
X        if (CE != NULL)`123
X`009`009putchar('\r');
X                printf("%s",CE);
X`009`125
X        else
X        `123
X                int i;
X                for (i = 0; i < Screen_Width - 1; i++)
X                        putchar(' ');
X                putchar('\r');
X        `125
X`125  /* ClrEOL */
X
Xint scroll_r()
X`123
X`009if(SCROLLR!=NULL) `123
X`009`009printf("%s%s",HC,SCROLLR);
X`009`009return(1);
X`009`125
X`009else `032
X`009`009return(0);
X`125
X `032
Xvoid clrs()
X`123
X        if(HC!=NULL) printf("%s",HC);
X        if(CLS!=NULL) printf("%s",CLS);
X`125    `032
X
X/*send escape sequences to physically change screen mode to narrow*/
Xvoid narrow_width()
X`123
X`009clrs();
X`009if(NSCREEN!=NULL) printf("%s",NSCREEN);
X`125
X
Xstatic int wide_width()
X`123
X`009clrs();
X`009if(WSCREEN!=NULL)`123
X`009`009 printf("%s",WSCREEN);
X`009`009 return(1);
X`009`125
X`009else `123
X`009`009return(0);
X`009`125
X`125
X`032
Xvoid standout()
X`123
X        if (SO != NULL) printf("%s",SO);
X        if (BLD != NULL) printf("%s",BLD);
X`032
X`125  /* standout */
X`032
Xvoid standend()
X`123
X        if (SE != NULL) printf("%s",SE);
X        if (BLDE != NULL) printf("%s",BLDE);
X`125  /* standend */
X`032
X/* getkey
X     Read in a keystroke in raw noecho mode.*/
Xint getkey()
X`123
X        static short int ch;
X        smg$read_keystroke(&Kb, &ch);
X        return ch;
X`125  /* getkey */
X`032
X
Xint  set_width(width)
Xint width;
X`123
X        short fd;
X        int status;
X        iosb iostatus;
X        $DESCRIPTOR(devnam, "SYS$COMMAND");
X`009/* Switching physical terminal to narrow/wide mode.
X`009   If the terminal does not support wide mode, wait`032
X`009   for a second, return FALSE */
X`009if(width<=80)
X`009`009 narrow_width();
X`009else `123
X`009`009if(!wide_width()) `123
X`009`009   cursor(Screen_Height,1);
X`009`009   printf("\nYour terminal does not support wide mode!\n");
X`009`009   sleep(2);
X`009           return(0);
X`009`009`125
X`009`125
X
X        /* Assign input to a channel */
X        status = sys$assign(&devnam, &fd, 0, 0);
X        if ((status & 1) == 0)
X                exit(status);
X      /* Get current terminal characteristics */
X        status = sys$qiow(           /* Queue and wait   */
X        0,           /* Wait on event flag zero  */
X        fd,           /* Channel to input terminal  */
X        IO$_SENSEMODE,   /* Get current characteristic */
X        &iostatus,       /* Status after operation */
X        0, 0,            /* No AST service   */
X        &tc,             /* Terminal characteristics buf */
X        sizeof(tc),      /* Size of the buffer   */
X        0, 0, 0, 0);     /* P3-P6 unused     */
X       `032
X`009/*set terminal characteristics */
X `009tc.t_width=width;
X        status = sys$qiow(           /* Queue and wait   */
X        0,           /* Wait on event flag zero  */
X        fd,           /* Channel to input terminal  */
X        IO$_SETMODE,   /* Get current characteristic */
X        &iostatus,       /* Status after operation */
X        0, 0,            /* No AST service   */
X        &tc,             /* Terminal characteristics buf */
X        sizeof(tc),      /* Size of the buffer   */
X        0, 0, 0, 0);     /* P3-P6 unused     */
X
X`009if( (sys$dassgn(fd)  & 1)==0)
X`009`009exit(status);
X        return(1);
X`125
X
Xvoid cursor(x,y)
Xint x,y;
X`123
X`009char buffer`091240`093;
X`009int status, length, arg`0913`093;
X`009arg`0910`093=2;  /* two arguments*/
X`009arg`0911`093=x;   arg`0912`093=y;
X`009status=smg$get_term_data(&termaddr,&SMG$K_SET_CURSOR_ABS,
X               &sizeof(buffer),&length,buffer,arg);
X`009buffer`091length`093='\0';
X`009printf("%s",buffer);
X        if (CE != NULL)printf("%s",CE);  /*erase to end of line*/
X
X`125
X
X
Xvoid message(str)
Xchar *str;
X`123
X`009cursor(Screen_Height,Screen_Width/2);
X`009standout();
X  `009printf(str);
X        standend();
X`125
$ CALL UNPACK TERMIO.C;1 1179189044
$ create/nolog 'f'
X/*VMS  MORE V1.5*/
X#define NULL (char *)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 */
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        src = fn;
X        dst = buffer;
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 67446437
$ v=f$verify(v)
$ EXIT

