mirror of
https://github.com/sheumann/NetDisk.git
synced 2024-12-30 14:30:53 +00:00
Set up framework of the NetDisk init.
This commit is contained in:
parent
9883d47517
commit
cb236fbeb3
35
Makefile
Normal file
35
Makefile
Normal file
@ -0,0 +1,35 @@
|
||||
CC = occ
|
||||
CFLAGS = -w-1 -O-1
|
||||
|
||||
HTTPTEST_OBJS = httptest.a hostname.a http.a readtcp.a seturl.a strcasecmp.a tcpconnection.a urlparser.a
|
||||
HTTPTEST_PROG = httptest
|
||||
|
||||
NETDISKINIT_OBJS = initstart.a netdiskinit.a hostname.a http.a readtcp.a seturl.a strcasecmp.a tcpconnection.a urlparser.a
|
||||
# NETDISKINIT_RSRC =
|
||||
NETDISKINIT_PROG = NetDiskInit
|
||||
|
||||
# NETDISKCDEV_OBJS =
|
||||
# NETDISKCDEV_RSRC =
|
||||
# NETDISKCDEV_CDEV =
|
||||
|
||||
PROGS = $(HTTPTEST_PROG) $(NETDISKINIT_PROG)
|
||||
|
||||
.PHONY: default
|
||||
default: $(PROGS)
|
||||
|
||||
$(HTTPTEST_PROG): $(HTTPTEST_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
$(NETDISKINIT_PROG): $(NETDISKINIT_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
iix chtyp -tpif $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(PROGS) *.a *.o *.root *.A *.O *.ROOT
|
||||
|
||||
%.a: %.c *.h
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
%.a: %.asm
|
||||
$(CC) $(CFLAGS) -c $<
|
@ -1,3 +1,5 @@
|
||||
#pragma noroot
|
||||
|
||||
#include <tcpip.h>
|
||||
#include <misctool.h>
|
||||
#include <orca.h>
|
||||
|
2
http.c
2
http.c
@ -54,7 +54,7 @@ Boolean BuildHTTPRequest(Session *sess, char *resourceStr) {
|
||||
sizeNeeded = snprintf(sess->httpRequest, sizeNeeded,
|
||||
"GET /%s HTTP/1.1\r\n"
|
||||
"Host: %s\r\n"
|
||||
"User-Agent: GSRemoteDisk/0.1\r\n"
|
||||
"User-Agent: GS-NetDisk/1.0a1\r\n"
|
||||
"Accept-Encoding: identity\r\n"
|
||||
//"Accept: */*\r\n" /* default, but some clients send explicitly */
|
||||
//"Connection: Keep-Alive\r\n" /* same */
|
||||
|
16
initstart.asm
Normal file
16
initstart.asm
Normal file
@ -0,0 +1,16 @@
|
||||
case on
|
||||
|
||||
dummy private
|
||||
jmp InitStart
|
||||
end
|
||||
|
||||
InitStart private
|
||||
tay
|
||||
tsc
|
||||
clc
|
||||
adc #4
|
||||
sta >unloadFlagPtr
|
||||
lda #0
|
||||
sta >unloadFlagPtr+2
|
||||
tya
|
||||
end
|
48
netdiskinit.c
Normal file
48
netdiskinit.c
Normal file
@ -0,0 +1,48 @@
|
||||
#pragma rtl
|
||||
|
||||
#include <stddef.h>
|
||||
#include <locator.h>
|
||||
#include <misctool.h>
|
||||
#include <tcpip.h>
|
||||
#include <orca.h>
|
||||
|
||||
const char bootInfoString[] = "NetDisk v1.0a1";
|
||||
|
||||
Word *unloadFlagPtr;
|
||||
|
||||
static void setUnloadFlag(void) {
|
||||
if (unloadFlagPtr != NULL && *unloadFlagPtr == 0)
|
||||
*unloadFlagPtr = 1;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
/*
|
||||
* Load Marinetti.
|
||||
* We may get an error if the TCPIP init isn't loaded yet, but we ignore it.
|
||||
* The tool stub is still loaded in that case, which is enough for now.
|
||||
*/
|
||||
LoadOneTool(54, 0x0200);
|
||||
//if (toolerror() && toolerror() != terrINITNOTFOUND)
|
||||
// goto error;
|
||||
|
||||
/* We're not going to error out, so show boot info. */
|
||||
ShowBootInfo(bootInfoString, NULL);
|
||||
|
||||
/*
|
||||
* Put Marinetti in the default TPT so its tool stub won't be unloaded,
|
||||
* even if UnloadOneTool is called on it. Programs may still call
|
||||
* TCPIPStartUp and TCPIPShutDown, but those don't actually do
|
||||
* anything, so the practical effect is that Marinetti will always
|
||||
* be available once its init has loaded (which may not have happened
|
||||
* yet when this init loads).
|
||||
*/
|
||||
SetDefaultTPT();
|
||||
|
||||
// TODO install driver
|
||||
|
||||
return;
|
||||
|
||||
error:
|
||||
setUnloadFlag();
|
||||
return;
|
||||
}
|
2
seturl.c
2
seturl.c
@ -1,3 +1,5 @@
|
||||
#pragma noroot
|
||||
|
||||
#include <types.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
@ -1,3 +1,7 @@
|
||||
#ifdef __ORCAC__
|
||||
# pragma noroot
|
||||
#endif
|
||||
|
||||
#include "urlparser.h"
|
||||
#include <string.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user