changeset 98:28c230f0700e

Started very early work on the shell, fnameCmp will now return 0 if a null character is reached in one of the strings at the same location as a space in the other
author Jonathan Pevarnek <pevarnj@gmail.com>
date Sat, 14 May 2011 17:12:12 -0400
parents 917b70f168b0
children 2a0aa3efc228
files .hgignore Makefile hercules/shell.cnf src/fs.c src/shell.c
diffstat 5 files changed, 54 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sat May 14 16:47:35 2011 -0400
+++ b/.hgignore	Sat May 14 17:12:12 2011 -0400
@@ -5,6 +5,7 @@
 ^sarpn$
 ^dynamic$
 ^testFS$
+^shell$
 ^loader\.bin$
 ^cscope\.out$
 \.swp$
--- a/Makefile	Sat May 14 16:47:35 2011 -0400
+++ b/Makefile	Sat May 14 17:12:12 2011 -0400
@@ -11,11 +11,12 @@
 CXXFLAGS=$(CFLAGS)
 LDFLAGS=-m elf64_s390
 
-BINS=sarpn dynamic testFS
+BINS=sarpn dynamic testFS shell
 
 sarpn_OBJS=src/sarpn.o src/std.o src/string.o src/stack.o src/operations.o src/math.o arch/arch.a
 dynamic_OBJS=src/dynamic.o src/std.o src/string.o src/stack.o arch/arch.a
 testFS_OBJS=src/testFS.o src/std.o src/string.o src/fs.o arch/arch.a
+shell_OBJS=src/shell.o src/std.o src/fs.o src/string.o arch/arch.a
 
 ARCH_OBJS=arch/io.o arch/cons.o arch/ebcdic.o arch/fba.o arch/ioint.o \
 	  arch/svc.o arch/svcint.o
@@ -44,6 +45,8 @@
 	$(LD) $(LDFLAGS) -T scripts/linker.script -o $@ $^
 testFS: $(testFS_OBJS)
 	$(LD) $(LDFLAGS) -T scripts/linker.script -o $@ $^
+shell: $(shell_OBJS)
+	$(LD) $(LDFLAGS) -T scripts/linker.script -o $@ $^
 
 arch/arch.a: $(ARCH_OBJS)
 	$(AR) rc $@ $^
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hercules/shell.cnf	Sat May 14 17:12:12 2011 -0400
@@ -0,0 +1,20 @@
+CPUSERIAL 314359        # CPU serial number
+CPUMODEL  2097          # CPU model number
+MAINSIZE  128           # Main storage size in megabytes
+XPNDSIZE  0             # Expanded storage size in megabytes
+CNSLPORT  3270          # TCP port number to which consoles connect
+NUMCPU    1             # Number of CPUs
+#OSTAILOR  QUIET         # OS tailoring
+OSTAILOR  NULL          # OS tailoring
+PANRATE   SLOW          # Panel refresh rate
+
+# .-----------------------Device number
+# |     .-----------------Device type
+# |     |       .---------File name and parameters
+# |     |       |
+# V     V       V
+#---    ----    --------------------
+0009	3215	
+000C    3505	../loader.bin ../shell ebcdic multifile eof
+
+0100	9336	curDisk.img
--- a/src/fs.c	Sat May 14 16:47:35 2011 -0400
+++ b/src/fs.c	Sat May 14 17:12:12 2011 -0400
@@ -234,6 +234,7 @@
 {
 	int i;
 	for(i = 0; i < FNAMELEN; i++, a++, b++) {
+		if((*a == ' ' && !*b) || (*b == ' ' && !*a)) break;
 		if(*a - *b) return *a - *b;
 	}
 	return 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/shell.c	Sat May 14 17:12:12 2011 -0400
@@ -0,0 +1,28 @@
+#include <std.h>
+#include <error.h>
+#include <fs.h>
+#include <die.h>
+
+#define LIST 0
+#define RUN 1
+
+void start(u64 __memsize)
+{
+	init_all(__memsize);
+	if(isError(init_fs(0x100, __memsize))) die();
+	char buffer[1024];
+	while(1) {
+		sPrint("> ");
+		sGet(buffer, 78);
+		u32 progID;
+		if(isError(lookupFile(buffer, &progID))) {
+			sPrint("ERROR: command not found\n");
+		} else {
+			sPrint("THE COMMAND WAS FOUND!!!  YAY!!!\n");
+		}
+	}
+
+//END:
+	sPrint("DONE\n");
+	die();
+}