From 5a4bccc5b981d01fcd9fbee45817c18004e21d75 Mon Sep 17 00:00:00 2001 From: TomAwezome Date: Tue, 2 Nov 2021 17:32:47 -0400 Subject: [PATCH] Fix Gopher client null host bug. Update README to link to ISO build guide. --- README.md | 2 +- src/Home/Net/Programs/Gopher.CC | 18 ++++++++++++------ src/Kernel/BlkDev/DiskClus.CC | 2 +- src/Kernel/KDebug.CC | 2 +- src/System/Define.CC | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 839a1d45..9ea133e1 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Features in development include: - For running in a VM: Intel VT-x/AMD-V acceleration enabled in your BIOS settings. (Required to virtualize any 64-bit operating system properly.) - Working knowledge of the C programming language. -To create a Distro ISO, run `build_iso.sh` in the `build/` directory. After creating an ISO, see the Wiki for guides on installing in [VirtualBox](https://github.com/Zeal-Operating-System/ZealOS/wiki/Installing-(Virtualbox)), [VMWare](https://github.com/Zeal-Operating-System/ZealOS/wiki/Installing-(VMWare)), and [bare-metal](https://github.com/Zeal-Operating-System/ZealOS/wiki/Installing-(Bare%E2%80%90metal)). +To create a Distro ISO, run `build_iso.sh` in the `build/` directory. Check the Wiki guide for details on [building an ISO](https://github.com/Zeal-Operating-System/ZealOS/wiki/Building-an-ISO). After creating an ISO, see the Wiki guides on installing in [VirtualBox](https://github.com/Zeal-Operating-System/ZealOS/wiki/Installing-(Virtualbox)), [VMWare](https://github.com/Zeal-Operating-System/ZealOS/wiki/Installing-(VMWare)), and [bare-metal](https://github.com/Zeal-Operating-System/ZealOS/wiki/Installing-(Bare%E2%80%90metal)). ### Contributing diff --git a/src/Home/Net/Programs/Gopher.CC b/src/Home/Net/Programs/Gopher.CC index 9dd12bf8..c5a0a045 100755 --- a/src/Home/Net/Programs/Gopher.CC +++ b/src/Home/Net/Programs/Gopher.CC @@ -22,7 +22,7 @@ I64 GopherOpen(U8* host, U16 port, U8* selector, U8* query) // sock = create_connection(host, port); sock = TCPConnectionCreate(host, port); - if (sock < 0) + if (sock <= 0) { PrintErr("Failed to connect to %s:%d\n", host, port); return sock; @@ -36,7 +36,10 @@ I64 GopherOpen(U8* host, U16 port, U8* selector, U8* query) { line = StrPrint(NULL, "%s\t%s\r\n", selector, query); } - + + sock(CTCPSocket *)->timeout = TCP_TIMEOUT*5; + + // sendString(sock, line, 0); TCPSocketSendString(sock, line); Free(line); @@ -197,7 +200,10 @@ U0 GopherLine(U8* line) line++; port = Str2I64(line); } - + + if (!*host) + return; + switch (type) { case '3': @@ -224,7 +230,7 @@ public I64 GopherMenu U8 buf[256]; sock = GopherOpen(host, port, selector, query); - if (sock < 0) + if (sock <= 0) { return sock; } @@ -286,5 +292,5 @@ gopher_associations['1'] = "GopherMenu"; gopher_associations['7'] = "GopherQueryPrompt"; /* Include this file from your HomeSys, then add more associations */ -"\n\nTry using GopherMenu to connect to a gopher server," -"for example: GopherMenu(\"gopher.floodgap.com\");\n\n"; +"\n\nTry using GopherMenu to connect to a gopher server, for example:\n\n" +" $FG,2$GopherMenu(\"gopher.floodgap.com\");$FG$\n\n"; diff --git a/src/Kernel/BlkDev/DiskClus.CC b/src/Kernel/BlkDev/DiskClus.CC index 47fdceba..e9d8b0d3 100755 --- a/src/Kernel/BlkDev/DiskClus.CC +++ b/src/Kernel/BlkDev/DiskClus.CC @@ -76,7 +76,7 @@ I64 ClusBlkRead(CDrive *drive, U8 *buf, I64 c, I64 blks) if (i > drive->spc) i = drive->spc; BlkRead(drive, buf, drive->data_area + c * drive->spc, i); - buf+=i << BLK_SIZE_BITS; + buf += i << BLK_SIZE_BITS; c = ClusNumNext(drive, c, 1); blks -= i; } diff --git a/src/Kernel/KDebug.CC b/src/Kernel/KDebug.CC index 9c0b8347..c125517b 100755 --- a/src/Kernel/KDebug.CC +++ b/src/Kernel/KDebug.CC @@ -725,7 +725,7 @@ U0 Fault2(I64 fault_num, I64 fault_err_code) "Task \""; "%s", Fs->task_title; - "\"\n"; + "\"\n\n"; "Fault: 0x%02X %Z\n", fault_num, fault_num, "ST_INT_NAMES"; "Err Code: %08X\n", fault_err_code; was_in_debug = DebugMode(ON); diff --git a/src/System/Define.CC b/src/System/Define.CC index 34ecf152..1e1771e3 100755 --- a/src/System/Define.CC +++ b/src/System/Define.CC @@ -15,7 +15,7 @@ U0 LoadDocDefines() //$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/System/Boot/BootDVD.CC,DD_BOOT_HIGH_LOC_DVD"$ $TR,"LineRep"$ -$ID,2$DefinePrint("DD_ZEALOS_LOC","95,262"); +$ID,2$DefinePrint("DD_ZEALOS_LOC","95,264"); $ID,-2$ DefinePrint("DD_MP_VECT", "%08X", MP_VECT_ADDR); DefinePrint("DD_MP_VECT_END", "%08X", MP_VECT_ADDR + COREAP_16BIT_INIT_END - COREAP_16BIT_INIT - 1);