Bodge the ancient em monitor library into building as a libsys for the em22

plat. It's completely untested, but it builds and makes e.out executables.
This commit is contained in:
David Given 2018-06-13 21:44:25 +09:00
parent 13a7abdd69
commit 7eaa235fd1
101 changed files with 202 additions and 19 deletions

View file

@ -18,7 +18,7 @@ extern void _close(int);
#define FAIL 127
extern const char **_penvp;
extern const char **environ;
static const char *exec_tab[] = {
"sh", /* argv[0] */
"-c", /* argument to the shell */
@ -39,7 +39,7 @@ system(const char *str)
_close(i);
if (!str) str = "cd ."; /* just testing for a shell */
exec_tab[2] = str; /* fill in command */
_execve("/bin/sh", exec_tab, _penvp);
_execve("/bin/sh", exec_tab, environ);
/* get here if execve fails ... */
_exit(FAIL); /* see manual page */
}

View file

@ -1,2 +0,0 @@
/* $Id$ */
_cleanup(){}

View file

@ -93,6 +93,6 @@ killbss()
extern int catch();
int (*handler)() = catch;
char **argv = 0, **environ = 0;
char **argv = 0;
int argc = 0;
char *MainLB = 0;

View file

@ -2,7 +2,7 @@
mes 2,EM_WSIZE,EM_PSIZE
exp $_execl
pro $_execl,0
lae _penvp
lae environ
loi EM_PSIZE
lal EM_PSIZE
lal 0

View file

@ -2,7 +2,7 @@
mes 2,EM_WSIZE,EM_PSIZE
exp $execl
pro $execl,0
lae _penvp
lae environ
loi EM_PSIZE
lal EM_PSIZE
lal 0

View file

@ -2,7 +2,7 @@
mes 2,EM_WSIZE,EM_PSIZE
exp $execv
pro $execv,0
lae _penvp
lae environ
loi EM_PSIZE
lal 0
loi 2*EM_PSIZE

12
plat/em/libsys/isatty.c Normal file
View file

@ -0,0 +1,12 @@
/* $Id$ */
isatty(f)
{
char buf[128];
/* not a sgttyb struct; it might not be large enough;
I know for a fact that it is'nt large enough on PC/IX,
where gtty is an ioctl(..., TCGETA, ...)
*/
if (gtty(f, buf) < 0) return 0;
return 1;
}

View file

@ -12,6 +12,7 @@ installable {
map = {
"+libs",
"./include+pkg",
["$(PLATIND)/em22/libsys.a"] = "./libsys+lib",
}
}

View file

@ -9,7 +9,10 @@ local function addheader(h)
end
addheader("ack/config.h")
addheader("sys/types.h")
addheader("sys/timeb.h")
addheader("unistd.h")
addheader("sgtty.h")
acklibrary {
name = "headers",

119
plat/em22/include/sgtty.h Normal file
View file

@ -0,0 +1,119 @@
/* $Id$ */
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* Data structures for ioctl/stty/gtty, sufficient for ACK libraries */
#ifndef _SGTTY_H
#define _SGTTY_H
struct sgttyb {
char sg_ispeed; /* input speed (not used) */
char sg_ospeed; /* output speed (not used) */
char sg_erase; /* erase character */
char sg_kill; /* kill character */
#if defined(__USG) && !defined(_XENIX)
int sg_flags; /* mode flags */
#else
short sg_flags; /* mode flags */
#endif
};
struct tchars {
char t_intrc; /* SIGINT char */
char t_quitc; /* SIGQUIT char */
char t_startc; /* start output (initially CTRL-Q) */
char t_stopc; /* stop output (initially CTRL-S) */
char t_eofc; /* EOF (initially CTRL-D) */
char t_brkc; /* input delimiter (like nl) */
};
/* Fields in t_flags. */
#define ALLDELAY 0177400
#define BSDELAY 0100000
# define BS0 0000000
# define BS1 0100000
#define VTDELAY 0040000
# define FF0 0000000
# define FF1 0040000
#define CRDELAY 0030000
# define CR0 0000000
# define CR1 0010000
# define CR2 0020000
# define CR3 0030000
#if defined(__USG) && !defined(_XENIX)
#define XTABS 0000002 /* do tab expansion */
#else
#define XTABS 0006000 /* do tab expansion */
#endif
#define TBDELAY 0006000
# define TAB0 0000000
# define TAB1 0002000
# define TAB2 0004000
#define NLDELAY 0001400
# define NL0 0000000
# define NL1 0000400
# define NL2 0001000
# define NL3 0001400
#define ANYP 0000300
#define EVENP 0000200
#define ODDP 0000100
#define RAW 0000040 /* enable raw mode */
#define CRMOD 0000020 /* map lf to cr + lf */
#define ECHO 0000010 /* echo input */
#define LCASE 0000004
#define CBREAK 0000002 /* enable cbreak mode */
#if defined(__BSD4_2) || defined(_XENIX)
#define TANDEM 0000001
#else
#define HUPCL 0000001 /* unused ??? */
#endif
/*#define COOKED 0000000 */ /* neither CBREAK nor RAW */
#ifdef __BDS4_2
#define TIOCGETP (('t'<<8) | 8 | (6 << 16) | 0x40000000)
#define TIOCSETP (('t'<<8) | 9 | (6 << 16) | 0x80000000)
#define TIOCSETN (('t'<<8) | 10 | (6 << 16) | 0x80000000)
#define TIOCEXCL (('t'<<8) | 13 | 0x20000000)
#define TIOCNXCL (('t'<<8) | 14 | 0x20000000)
#define TIOCHPCL (('t'<<8) | 2 | 0x20000000)
#define TIOCGETC (('t'<<8) | 18 | (6 << 16) | 0x40000000)
#define TIOCSETC (('t'<<8) | 17 | (6 << 16) | 0x80000000)
#else
#define TIOCGETP (('t'<<8) | 8)
#define TIOCSETP (('t'<<8) | 9)
#define TIOCSETN (('t'<<8) | 10)
#define TIOCEXCL (('t'<<8) | 13)
#define TIOCNXCL (('t'<<8) | 14)
#define TIOCHPCL (('t'<<8) | 2)
#define TIOCGETC (('t'<<8) | 18)
#define TIOCSETC (('t'<<8) | 17)
#endif
#define B0 0
#define B50 1
#define B75 2
#define B110 3
#define B134 4
#define B150 5
#define B200 6
#define B300 7
#define B600 8
#define B1200 9
#define B1800 10
#define B2400 11
#define B4800 12
#define B9600 13
#define EXTA 14
#define EXTB 15
#endif /* _SGTTY_H */

View file

@ -1,12 +1,11 @@
/* $Id$ */
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
exit(code)
{
_cleanup() ;
_exit(code) ;
}
struct timeb {
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};

View file

@ -0,0 +1,18 @@
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
#include <stddef.h> /* for off_t, ptrdiff_t, size_t */
typedef int blkcnt_t; /* XXX should have 64 bits */
typedef int blksize_t;
typedef int dev_t;
typedef unsigned int gid_t;
typedef unsigned int ino_t;
typedef unsigned short mode_t;
typedef unsigned short nlink_t;
typedef int pid_t;
typedef ptrdiff_t ssize_t;
typedef unsigned int uid_t;
typedef unsigned long time_t;
#endif

View file

@ -59,11 +59,25 @@ typedef int sig_atomic_t;
#define SIG_DFL ((sighandler_t) 0) /* Default action. */
#define SIG_IGN ((sighandler_t) 1) /* Ignore signal. */
#define SIGABRT 6 /* Abort (ANSI) */
#define SIGILL 11 /* Illegal instruction */
#define _NSIG 16 /* number of signals used */
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt (DEL) */
#define SIGQUIT 3 /* quit (ASCII FS) */
#define SIGILL 4 /* illegal instruction */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGABRT 6 /* IOT instruction */
#define SIGIOT 6 /* SIGABRT for people who speak PDP-11 */
#define SIGEMT 7 /* EMT instruction */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* bus error */
#define SIGSEGV 11 /* segmentation violation */
#define SIGSYS 12 /* bad argument to system call */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define _NSIG 32 /* Biggest signal number + 1
(not including real-time signals). */
typedef void (*sighandler_t)(int);
extern sighandler_t signal(int signum, sighandler_t handler);
extern int raise(int signum);

Some files were not shown because too many files have changed in this diff Show more