more cleanup.

This commit is contained in:
Kelvin Sherlock 2018-05-10 21:22:34 -04:00
parent 3f0a195014
commit d2e0554bc8
4 changed files with 41 additions and 41 deletions

View File

@ -1,4 +1,7 @@
OBJS = o/vt100.a o/telnet.a o/ansi.a o/chars.a o/marinetti.a o/display.a o/screen.a
COMMON_OBJS = o/vt100.a o/ansi.a o/chars.a o/display.a o/screen.a
MARLENE_OBJS = o/marlene.a o/telnet.a o/marinetti.a
DARLENE_OBJS = o/darlene.a
CC = occ --gno
@ -11,11 +14,11 @@ ASMFLAGS =
all: marlene darlene
marlene: o/marlene.a $(OBJS)
$(CC) $^ -o $@
marlene: $(MARLENE_OBJS) $(COMMON_OBJS)
$(CC) -o $@ $^
darlene: o/darlene.a $(OBJS)
$(CC) $^ -o $@
darlene: $(DARLENE_OBJS) $(COMMON_OBJS)
$(CC) -lutil -o $@ $^

View File

@ -11,20 +11,29 @@
#include <errno.h>
#include <fcntl.h>
#include <gno/gno.h>
#include <gno/kerntool.h>
#include <libutil.h>
#include <sgtty.h>
#include <signal.h>
#include <string.h>
#include <sys/ioctl.compat.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <unistd.h>
#include <gno/gno.h>
#include <gno/kerntool.h>
extern void vt100_init(void);
extern void vt100_process(const unsigned char *buffer, unsigned buffer_size);
extern void vt100_event(EventRecord *event);
extern void screen_init(void);
extern void screen_on(void);
extern void screen_off(void);
void display_pstr(const char *);
void display_cstr(const char *);
static char out_buffer[1024];
static char out_buffer_size = 0;
@ -68,7 +77,7 @@ openpty2(int *amaster, int *aslave, char *name, struct sgttyb *sg, struct winsiz
master = open(ptyname, O_RDWR);
if (master < 0) continue;
slave = open(ttyname, O_RDRW);
slave = open(ttyname, O_RDWR);
if (slave < 0) {
close(master);
continue;
@ -95,9 +104,9 @@ static int _child(int master, int slave) {
close(master);
logintty(slave);
login_tty(slave);
execve(":bin:gsh", "gsh -f");
_execve(":bin:gsh", "gsh -f");
write(slave, "Unable to exec.\r\n", 27);
close(slave);
return 1;
@ -131,8 +140,11 @@ static void sigchild(int sig, int x) {
int main(int argc, char **argv) {
static EventRecord event;
int pid;
unsigned i;
Word MyID;
Handle dpHandle = NULL;
Handle shrHandle = NULL;
@ -164,12 +176,8 @@ int main(int argc, char **argv) {
argv += i;
signal(SIGCHLD,sigchild);
pid = forkpty2(&master, NULL, NULL, NULL);
if ( pid < 0) {
ErrWriteCString("Unable to forkpty.\r\n");
return 1;
}
MyID = MMStartUp();
dpHandle = NewHandle(0x0100, MyID,
attrBank | attrPage |attrNoCross | attrFixed | attrLocked,
@ -193,14 +201,18 @@ int main(int argc, char **argv) {
EMStartUp((Word)*dpHandle, 0x14, 0, 0, 0, 0, MyID);
screen_init();
vt100_init();
signal(SIGCHLD,sigchild);
pid = forkpty2(&master, NULL, NULL, NULL);
if ( pid < 0) {
display_cstr("Unable to forkpty.\r\n");
goto _exit;
}
screen_init();
vt100_init();
for(;;) {
static char buffer[1024];
@ -251,9 +263,10 @@ int main(int argc, char **argv) {
if (event.what == app4Mask) {
/* child signal received! */
union wait wt;
int ok;
ok = waitpid(pid, &wt, WNOHANG);
if (ok <= 0) continue;
display_str("\r\nChild exited.\r\n");
display_cstr("\r\nChild exited.\r\n");
break;
}
}

View File

@ -1,12 +1,10 @@
#pragma noroot
#include <string.h>
#include "Marinetti.h"
struct errlist {
Word Error;
Word MsgLen;
unsigned Error;
unsigned MsgLen;
const char *Msg;
};
@ -32,7 +30,7 @@ static struct errlist errors[] = {
_ERR(0x0e,"tcperrConRefused"),
};
void display_err(Word err) {
void display_err(unsigned err) {
if (err == 0 || err >= 0x0f) return;
--err;

View File

@ -23,16 +23,6 @@
#include "telnet.h"
#include "marinetti.h"
extern pascal void GrafOn(void) inline(0x0a04, dispatcher);
extern pascal void GrafOff(void) inline(0x0b04, dispatcher);
extern pascal void SetColorTable(Word, ColorTable) inline(0x0E04,dispatcher);
extern pascal void SysBeep2(Word) inline(0x3803,dispatcher);
extern pascal void SetAllSCBs(Word) inline(0x1404,dispatcher);
extern pascal void SetMasterSCB(Word) inline(0x1604,dispatcher);
extern pascal void InitColorTable(ColorTable) inline(0x0D04,dispatcher);
void display_pstr(const char *);
void display_cstr(const char *);
@ -50,15 +40,9 @@ extern void screen_on(void);
extern void screen_off(void);
Word MyID;
Word __gno;
#define ESC "\x1b"
#pragma databank 1
/*
@ -127,6 +111,8 @@ int main(int argc, char **argv) {
int ok;
unsigned i;
int mf = 0;
Word MyID;
Word __gno;
__gno = false;