more cleanup.
This commit is contained in:
parent
3f0a195014
commit
d2e0554bc8
13
GNUmakefile
13
GNUmakefile
|
@ -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
|
CC = occ --gno
|
||||||
|
|
||||||
|
@ -11,11 +14,11 @@ ASMFLAGS =
|
||||||
|
|
||||||
all: marlene darlene
|
all: marlene darlene
|
||||||
|
|
||||||
marlene: o/marlene.a $(OBJS)
|
marlene: $(MARLENE_OBJS) $(COMMON_OBJS)
|
||||||
$(CC) $^ -o $@
|
$(CC) -o $@ $^
|
||||||
|
|
||||||
darlene: o/darlene.a $(OBJS)
|
darlene: $(DARLENE_OBJS) $(COMMON_OBJS)
|
||||||
$(CC) $^ -o $@
|
$(CC) -lutil -o $@ $^
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
43
darlene.c
43
darlene.c
|
@ -11,20 +11,29 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <gno/gno.h>
|
|
||||||
#include <gno/kerntool.h>
|
|
||||||
#include <libutil.h>
|
#include <libutil.h>
|
||||||
#include <sgtty.h>
|
#include <sgtty.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/ioctl.compat.h>
|
#include <sys/ioctl.compat.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
#include <unistd.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_init(void);
|
||||||
extern void screen_on(void);
|
extern void screen_on(void);
|
||||||
extern void screen_off(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[1024];
|
||||||
static char out_buffer_size = 0;
|
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);
|
master = open(ptyname, O_RDWR);
|
||||||
if (master < 0) continue;
|
if (master < 0) continue;
|
||||||
|
|
||||||
slave = open(ttyname, O_RDRW);
|
slave = open(ttyname, O_RDWR);
|
||||||
if (slave < 0) {
|
if (slave < 0) {
|
||||||
close(master);
|
close(master);
|
||||||
continue;
|
continue;
|
||||||
|
@ -95,9 +104,9 @@ static int _child(int master, int slave) {
|
||||||
|
|
||||||
close(master);
|
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);
|
write(slave, "Unable to exec.\r\n", 27);
|
||||||
close(slave);
|
close(slave);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -131,8 +140,11 @@ static void sigchild(int sig, int x) {
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
static EventRecord event;
|
||||||
|
|
||||||
int pid;
|
int pid;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
Word MyID;
|
||||||
|
|
||||||
Handle dpHandle = NULL;
|
Handle dpHandle = NULL;
|
||||||
Handle shrHandle = NULL;
|
Handle shrHandle = NULL;
|
||||||
|
@ -164,12 +176,8 @@ int main(int argc, char **argv) {
|
||||||
argv += i;
|
argv += i;
|
||||||
|
|
||||||
|
|
||||||
signal(SIGCHLD,sigchild);
|
|
||||||
pid = forkpty2(&master, NULL, NULL, NULL);
|
MyID = MMStartUp();
|
||||||
if ( pid < 0) {
|
|
||||||
ErrWriteCString("Unable to forkpty.\r\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
dpHandle = NewHandle(0x0100, MyID,
|
dpHandle = NewHandle(0x0100, MyID,
|
||||||
attrBank | attrPage |attrNoCross | attrFixed | attrLocked,
|
attrBank | attrPage |attrNoCross | attrFixed | attrLocked,
|
||||||
|
@ -193,14 +201,18 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
EMStartUp((Word)*dpHandle, 0x14, 0, 0, 0, 0, MyID);
|
EMStartUp((Word)*dpHandle, 0x14, 0, 0, 0, 0, MyID);
|
||||||
|
|
||||||
|
|
||||||
screen_init();
|
screen_init();
|
||||||
|
|
||||||
vt100_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(;;) {
|
for(;;) {
|
||||||
static char buffer[1024];
|
static char buffer[1024];
|
||||||
|
@ -251,9 +263,10 @@ int main(int argc, char **argv) {
|
||||||
if (event.what == app4Mask) {
|
if (event.what == app4Mask) {
|
||||||
/* child signal received! */
|
/* child signal received! */
|
||||||
union wait wt;
|
union wait wt;
|
||||||
|
int ok;
|
||||||
ok = waitpid(pid, &wt, WNOHANG);
|
ok = waitpid(pid, &wt, WNOHANG);
|
||||||
if (ok <= 0) continue;
|
if (ok <= 0) continue;
|
||||||
display_str("\r\nChild exited.\r\n");
|
display_cstr("\r\nChild exited.\r\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
#pragma noroot
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "Marinetti.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct errlist {
|
struct errlist {
|
||||||
Word Error;
|
unsigned Error;
|
||||||
Word MsgLen;
|
unsigned MsgLen;
|
||||||
const char *Msg;
|
const char *Msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,7 +30,7 @@ static struct errlist errors[] = {
|
||||||
_ERR(0x0e,"tcperrConRefused"),
|
_ERR(0x0e,"tcperrConRefused"),
|
||||||
};
|
};
|
||||||
|
|
||||||
void display_err(Word err) {
|
void display_err(unsigned err) {
|
||||||
|
|
||||||
if (err == 0 || err >= 0x0f) return;
|
if (err == 0 || err >= 0x0f) return;
|
||||||
--err;
|
--err;
|
||||||
|
|
18
marlene.c
18
marlene.c
|
@ -23,16 +23,6 @@
|
||||||
#include "telnet.h"
|
#include "telnet.h"
|
||||||
#include "marinetti.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_pstr(const char *);
|
||||||
void display_cstr(const char *);
|
void display_cstr(const char *);
|
||||||
|
@ -50,15 +40,9 @@ extern void screen_on(void);
|
||||||
extern void screen_off(void);
|
extern void screen_off(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Word MyID;
|
|
||||||
Word __gno;
|
|
||||||
|
|
||||||
|
|
||||||
#define ESC "\x1b"
|
#define ESC "\x1b"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma databank 1
|
#pragma databank 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -127,6 +111,8 @@ int main(int argc, char **argv) {
|
||||||
int ok;
|
int ok;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
int mf = 0;
|
int mf = 0;
|
||||||
|
Word MyID;
|
||||||
|
Word __gno;
|
||||||
|
|
||||||
|
|
||||||
__gno = false;
|
__gno = false;
|
||||||
|
|
Loading…
Reference in New Issue