Remove VMS related code.

This commit is contained in:
Renaud 2019-07-04 08:06:13 +08:00
parent 28551a3e81
commit a35185c4fa
10 changed files with 27 additions and 271 deletions

View File

@ -5,7 +5,7 @@
/* Must define one of
VMS | V7 | USG | BSD | MSDOS
V7 | USG | BSD | MSDOS
*/
#define USG 1

View File

@ -1,3 +1,5 @@
/* estruct.h -- */
#ifndef _ESTRUCT_H_
#define _ESTRUCT_H_
@ -21,7 +23,7 @@
/* Machine/OS definitions. */
#if defined(AUTOCONF) || defined(MSDOS) || defined(BSD) || defined(SYSV) || defined(VMS)
#if defined(AUTOCONF) || defined(MSDOS) || defined(BSD) || defined(SYSV)
/* Make an intelligent guess about the target system. */
@ -31,7 +33,7 @@
#define MSDOS 0
#endif
#if defined(BSD) || defined(sun) || defined(ultrix) || (defined(vax) && defined(unix)) || defined(ultrix) || defined(__osf__)
#if defined(BSD) || defined(sun) || defined(ultrix) || defined(__osf__)
#ifndef BSD
#define BSD 1 /* Berkeley UNIX */
#endif
@ -51,12 +53,6 @@
#define USG 0
#endif
#if defined(VMS) || (defined(vax) && ! defined(unix))
#define VMS 1 /* VAX/VMS */
#else
#define VMS 0
#endif
#define V7 0 /* No more. */
#else
@ -65,7 +61,6 @@
#define V7 0 /* V7 UNIX or Coherent or BSD4.2 */
#define BSD 0 /* UNIX BSD 4.2 and ULTRIX */
#define USG 0 /* UNIX system V */
#define VMS 0 /* VAX/VMS */
#endif /*autoconf */
@ -101,29 +96,26 @@
/* Terminal Output definitions */
#define ANSI 0 /* ANSI escape sequences */
#define VMSVT 0 /* various VMS terminal entries */
#define VT52 0 /* VT52 terminal (Zenith). */
#define TERMCAP 0 /* Use TERMCAP */
#define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */
#elif defined( MINGW32)
#define VT220 (UNIX | VMS)
#define VT220 UNIX
#define VT100 0
#define ANSI 0
#define VMSVT 0
#define VT52 0
#define TERMCAP 0
#define IBMPC 0
#else
#define VT220 (UNIX | VMS)
#define VT220 UNIX
#define VT100 0
#define ANSI 0
#define VMSVT VMS
#define VT52 0
#define TERMCAP UNIX
#define IBMPC MSDOS
@ -163,8 +155,8 @@
#else
#define XONXOFF (UNIX | VMS)
#define NATIONL (UNIX | VMS)
#define XONXOFF UNIX
#define NATIONL UNIX
#endif /* Autoconf. */
@ -191,10 +183,6 @@
#define movmem(a, b, c) memcpy(b, a, c)
#endif
#if VMS
#define unlink(a) delete(a)
#endif
/* Define some ability flags. */
#if IBMPC
@ -289,3 +277,5 @@ void cexit( int status) ;
#endif
#endif
/* end of estruct.h */

9
file.c
View File

@ -390,15 +390,6 @@ void makename( bname_t bname, const char *fname)
while (*cp1 != 0)
++cp1;
#if VMS
#if PKCODE
while (cp1 != &fname[0] && cp1[-1] != ':' && cp1[-1] != ']'
&& cp1[-1] != '>')
#else
while (cp1 != &fname[0] && cp1[-1] != ':' && cp1[-1] != ']')
#endif
--cp1;
#endif
#if MSDOS
while (cp1 != &fname[0] && cp1[-1] != ':' && cp1[-1] != '\\'
&& cp1[-1] != '/')

View File

@ -51,19 +51,9 @@ fio_code ffropen( const char *fn)
* Open a file for writing. Return TRUE if all is well, and FALSE on error
* (cannot create).
*/
fio_code ffwopen( const char *fn)
{
#if VMS
int fd;
if ((fd = creat(fn, 0666, "rfm=var", "rat=cr")) < 0
|| (ffp = fdopen(fd, "w")) == NULL)
#else
if ((ffp = fopen(fn, "w")) == NULL)
#endif
return FIOERR;
return FIOSUC;
fio_code ffwopen( const char *fn) {
ffp = fopen( fn, "w") ;
return (ffp == NULL) ? FIOERR : FIOSUC ;
}
/*

11
flook.c
View File

@ -31,16 +31,7 @@ const char *pathname[] = {
#endif
"/usr/local/", "/usr/lib/", ""
#endif
#if VMS
{
"emacs.rc", "emacs.hlp", "",
#if PKCODE
"sys$login:", "emacs_dir:",
#endif
"sys$sysdevice:[vmstools]"
#endif
};
} ;
#define PATHNAME_SIZE (sizeof pathname / sizeof pathname[ 0])

4
main.c
View File

@ -149,10 +149,6 @@ int main(int argc, char **argv)
int errflag; /* C error processing? */
bname_t bname ; /* buffer name of file to read */
#if PKCODE & VMS
(void) umask(-1); /* Use old protection (this is at wrong place). */
#endif
#if PKCODE & BSD
sleep(1); /* Time for window manager. */
#endif

12
posix.c
View File

@ -56,8 +56,7 @@ static char tobuf[TBUFSIZ]; /* terminal output buffer */
/*
* This function is called once to set up the terminal device streams.
* On VMS, it translates TT until it finds the terminal, then assigns
* a channel to it and sets it raw. On CPM it is a no-op.
* On CPM it is a no-op.
*/
void ttopen(void)
{
@ -105,7 +104,7 @@ void ttopen(void)
/*
* This function gets called just before we go back home to the command
* interpreter. On VMS it puts the terminal back in a reasonable state.
* interpreter.
* Another no-operation on CPM.
*/
void ttclose(void)
@ -114,8 +113,7 @@ void ttclose(void)
}
/*
* Write a character to the display. On VMS, terminal output is buffered, and
* we just put the characters in the big array, after checking for overflow.
* Write a character to the display.
* On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
* MS-DOS (use the very very raw console output routine).
*/
@ -158,8 +156,8 @@ void ttflush(void)
/*
* Read a character from the terminal, performing no editing and doing no echo
* at all. More complex in VMS that almost anyplace else, which figures. Very
* simple on CPM, because the system can do exactly what you want.
* at all.
* Very simple on CPM, because the system can do exactly what you want.
*/
int ttgetc(void)
{

View File

@ -1287,7 +1287,7 @@ static int mcstr(void)
if (status) {
rtpcm = &tapcm[0];
while (--mj >= 0) {
#if MSC | TURBO | VMS | USG | BSD | V7
#if MSC | TURBO | USG | BSD | V7
*rtpcm++ = *--mcptr;
#endif
}

66
spawn.c
View File

@ -25,18 +25,6 @@
#include "terminal.h"
#include "window.h"
#if VMS
#define EFN 0 /* Event flag. */
#include <ssdef.h> /* Random headers. */
#include <stsdef.h>
#include <descrip.h>
#include <iodef.h>
extern int oldmode[3]; /* In "termio.c" */
extern int newmode[3]; /* In "termio.c" */
extern short iochan; /* In "termio.c" */
#endif
#if V7 | USG | BSD
#include <signal.h>
@ -52,8 +40,7 @@ extern short iochan; /* In "termio.c" */
/*
* Create a subjob with a copy of the command intrepreter in it. When the
* command interpreter exits, mark the screen as garbage so that you do a full
* repaint. Bound to "^X C". The message at the start in VMS puts out a newline.
* Under some (unknown) condition, you don't get one free when DCL starts up.
* repaint. Bound to "^X C".
*/
int spawncli(int f, int n)
{
@ -65,18 +52,6 @@ int spawncli(int f, int n)
if (restflag)
return resterr();
#if VMS
movecursor(term.t_nrow, 0); /* In last line. */
mlwrite("(Starting DCL)\r\n");
TTflush(); /* Ignore "ttcol". */
sgarbf = TRUE;
sys(NULL);
sleep(1);
mlwrite("\r\n(Returning from DCL)\r\n");
TTflush();
sleep(1);
return TRUE;
#endif
#if MSDOS & (MSC | TURBO)
movecursor(term.t_nrow, 0); /* Seek to last line. */
TTflush();
@ -391,45 +366,6 @@ int filter_buffer( int f, int n) {
return TRUE;
}
#if VMS
/*
* Run a command. The "cmd" is a pointer to a command string, or NULL if you
* want to run a copy of DCL in the subjob (this is how the standard routine
* LIB$SPAWN works. You have to do wierd stuff with the terminal on the way in
* and the way out, because DCL does not want the channel to be in raw mode.
*/
int sys(char *cmd)
{
struct dsc$descriptor cdsc;
struct dsc$descriptor *cdscp;
long status;
long substatus;
long iosb[2];
status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
oldmode, sizeof(oldmode), 0, 0, 0, 0);
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
return FALSE;
cdscp = NULL; /* Assume DCL. */
if (cmd != NULL) { /* Build descriptor. */
cdsc.dsc$a_pointer = cmd;
cdsc.dsc$w_length = strlen(cmd);
cdsc.dsc$b_dtype = DSC$K_DTYPE_T;
cdsc.dsc$b_class = DSC$K_CLASS_S;
cdscp = &cdsc;
}
status = LIB$SPAWN(cdscp, 0, 0, 0, 0, 0, &substatus, 0, 0, 0);
if (status != SS$_NORMAL)
substatus = status;
status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
newmode, sizeof(newmode), 0, 0, 0, 0);
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
return FALSE;
if ((substatus & STS$M_SUCCESS) == 0) /* Command failed. */
return FALSE;
return TRUE;
}
#endif
#if MSDOS & (TURBO | MSC)

146
termio.c
View File

@ -26,27 +26,6 @@
int ttrow = HUGE ; /* Row location of HW cursor */
int ttcol = HUGE ; /* Column location of HW cursor */
#if VMS
#include <stsdef.h>
#include <ssdef.h>
#include <descrip.h>
#include <iodef.h>
#include <ttdef.h>
#include <tt2def.h>
#define NIBUF 128 /* Input buffer size */
#define NOBUF 1024 /* MM says bug buffers win! */
#define EFN 0 /* Event flag */
char obuf[NOBUF]; /* Output buffer */
int nobuf; /* # of bytes in above */
char ibuf[NIBUF]; /* Input buffer */
int nibuf; /* # of bytes in above */
int ibufi; /* Read index */
int oldmode[3]; /* Old TTY mode bits */
int newmode[3]; /* New TTY mode bits */
short iochan; /* TTY I/O channel */
#endif
#if MSDOS & (MSC | TURBO)
union REGS rg; /* cpu register for use of DOS calls */
@ -106,60 +85,10 @@ char tobuf[TBUFSIZ]; /* terminal output buffer */
/*
* This function is called once to set up the terminal device streams.
* On VMS, it translates TT until it finds the terminal, then assigns
* a channel to it and sets it raw. On CPM it is a no-op.
* On CPM it is a no-op.
*/
void ttopen(void)
{
#if VMS
struct dsc$descriptor idsc;
struct dsc$descriptor odsc;
char oname[40];
int iosb[2];
int status;
odsc.dsc$a_pointer = "TT";
odsc.dsc$w_length = strlen(odsc.dsc$a_pointer);
odsc.dsc$b_dtype = DSC$K_DTYPE_T;
odsc.dsc$b_class = DSC$K_CLASS_S;
idsc.dsc$b_dtype = DSC$K_DTYPE_T;
idsc.dsc$b_class = DSC$K_CLASS_S;
do {
idsc.dsc$a_pointer = odsc.dsc$a_pointer;
idsc.dsc$w_length = odsc.dsc$w_length;
odsc.dsc$a_pointer = &oname[0];
odsc.dsc$w_length = sizeof(oname);
status = LIB$SYS_TRNLOG(&idsc, &odsc.dsc$w_length, &odsc);
if (status != SS$_NORMAL && status != SS$_NOTRAN)
exit(status);
if (oname[0] == 0x1B) {
odsc.dsc$a_pointer += 4;
odsc.dsc$w_length -= 4;
}
} while (status == SS$_NORMAL);
status = SYS$ASSIGN(&odsc, &iochan, 0, 0);
if (status != SS$_NORMAL)
exit(status);
status = SYS$QIOW(EFN, iochan, IO$_SENSEMODE, iosb, 0, 0,
oldmode, sizeof(oldmode), 0, 0, 0, 0);
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
exit(status);
newmode[0] = oldmode[0];
newmode[1] = oldmode[1] | TT$M_NOECHO;
#if XONXOFF
#else
newmode[1] &= ~(TT$M_TTSYNC | TT$M_HOSTSYNC);
#endif
newmode[2] = oldmode[2] | TT2$M_PASTHRU;
status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
newmode, sizeof(newmode), 0, 0, 0, 0);
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
exit(status);
term.t_nrow = (newmode[1] >> 24) - 1;
term.t_ncol = newmode[0] >> 16;
#endif
#if MSDOS & (TURBO | (PKCODE & MSC))
/* kill the CONTROL-break interupt */
rg.h.ah = 0x33; /* control-break check dos call */
@ -231,24 +160,11 @@ void ttopen(void)
/*
* This function gets called just before we go back home to the command
* interpreter. On VMS it puts the terminal back in a reasonable state.
* interpreter.
* Another no-operation on CPM.
*/
void ttclose(void)
{
#if VMS
int status;
int iosb[1];
ttflush();
status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
oldmode, sizeof(oldmode), 0, 0, 0, 0);
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
exit(status);
status = SYS$DASSGN(iochan);
if (status != SS$_NORMAL)
exit(status);
#endif
#if MSDOS & (TURBO | (PKCODE & MSC))
/* restore the CONTROL-break interupt */
rg.h.ah = 0x33; /* control-break check dos call */
@ -292,22 +208,6 @@ int ttputc( unicode_t c) {
* up. A no-operation on systems where byte at a time terminal I/O is done.
*/
void ttflush( void) {
#if VMS
int status;
int iosb[2];
status = SS$_NORMAL;
if (nobuf != 0) {
status =
SYS$QIOW(EFN, iochan, IO$_WRITELBLK | IO$M_NOFORMAT,
iosb, 0, 0, obuf, nobuf, 0, 0, 0, 0);
if (status == SS$_NORMAL)
status = iosb[0] & 0xFFFF;
nobuf = 0;
}
return status;
#endif
#if MSDOS
#endif
@ -336,42 +236,10 @@ void ttflush( void) {
/*
* Read a character from the terminal, performing no editing and doing no echo
* at all. More complex in VMS that almost anyplace else, which figures. Very
* simple on CPM, because the system can do exactly what you want.
* at all.
* Very simple on CPM, because the system can do exactly what you want.
*/
int ttgetc( void) {
#if VMS
int status;
int iosb[2];
int term[2];
while (ibufi >= nibuf) {
ibufi = 0;
term[0] = 0;
term[1] = 0;
status = SYS$QIOW(EFN, iochan, IO$_READLBLK | IO$M_TIMED,
iosb, 0, 0, ibuf, NIBUF, 0, term, 0, 0);
if (status != SS$_NORMAL)
exit(status);
status = iosb[0] & 0xFFFF;
if (status != SS$_NORMAL && status != SS$_TIMEOUT &&
status != SS$_DATAOVERUN)
exit(status);
nibuf = (iosb[0] >> 16) + (iosb[1] >> 16);
if (nibuf == 0) {
status = SYS$QIOW(EFN, iochan, IO$_READLBLK,
iosb, 0, 0, ibuf, 1, 0, term, 0,
0);
if (status != SS$_NORMAL
|| (status = (iosb[0] & 0xFFFF)) != SS$_NORMAL)
if (status != SS$_DATAOVERUN)
exit(status);
nibuf = (iosb[0] >> 16) + (iosb[1] >> 16);
}
}
return ibuf[ibufi++] & 0xFF; /* Allow multinational */
#endif
#if MSDOS & (MSC | TURBO)
int c; /* character read */
@ -426,10 +294,6 @@ int typahead( void)
return (ioctl(0, FIONREAD, &x) < 0) ? 0 : x;
#endif
#if PKCODE & VMS
return ibufi < nibuf;
#endif
#if USG
if (!kbdqp) {
if (!kbdpoll && fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0)
@ -442,7 +306,7 @@ int typahead( void)
return kbdqp;
#endif
#if !UNIX & !VMS & !MSDOS
#if !UNIX & !MSDOS
return FALSE;
#endif
}