aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2024-11-14 12:11:32 -0500
committerJeffrey Armstrong <jeff@approximatrix.com>2024-11-14 12:11:32 -0500
commit7cc7ad98394decfa32779e00e7066e5f67c14712 (patch)
tree99a2f1e4bebb91a2926ad5c92999ac57f97564c5
parent3b3561fc55fe11da569117ef91fbc0c1f167a638 (diff)
downloadGWFetch-7cc7ad98394decfa32779e00e7066e5f67c14712.tar.gz
GWFetch-7cc7ad98394decfa32779e00e7066e5f67c14712.zip
Added version detection if the shell is 4DOS, which doesn't use the word version anywhere
-rw-r--r--gwfetch.bas20
1 files changed, 19 insertions, 1 deletions
diff --git a/gwfetch.bas b/gwfetch.bas
index dc06adc..fd22767 100644
--- a/gwfetch.bas
+++ b/gwfetch.bas
@@ -63,7 +63,7 @@
10080 REM output. Technically it is just the command
10090 REM interpreter version.
10100 IDX = INSTR(VERLINE$, "ersion")
-10110 IF IDX = 0 THEN INTERP$ = VERLINE$:VERSION$="":RETURN
+10110 IF IDX = 0 THEN GOTO 10210
10120 IDX = IDX - 1
10130 INTERP$ = LEFT$(VERLINE$, IDX - 2)
10140 IDX = IDX + 7
@@ -73,6 +73,17 @@
10180 NEXT IDX
10190 IF INTERP$ = "MS-DOS" OR INTERP$="PC-DOS" THEN INTERP$ = INTERP$ + " Command"
10200 RETURN
+10210 REM If we're here, the word "version" wasn't found, but no worries
+10220 SPACED = 0:IDX=0:VERSION$ = ""
+10230 FOR IDX = 2 TO LEN(VERLINE$)
+10240 C$ = MID$(IDX, 1)
+10250 GOSUB 30200
+10240 IF SPACED > 0 AND ISNUM = 1 THEN VERSION$ = VERSION$ + C$ ELSE GOTO 10270
+10250 IF SPACED = 0 AND C$ = " " THEN SPACED = IDX
+10260 NEXT IDX
+10270 IF LEN(VERSION$) > 0 AND SPACED > 0 THEN INTERP$ = LEFT$(VERLINE$, SPACED - 1) ELSE INTERP$ = VERLINE$
+10280 RETURN
+
11000 REM 'chkdsk' output parser
11010 REM TMPFILE$ contains the file to open
@@ -262,3 +273,10 @@
30160 ROWS=24
30170 ON ERROR GOTO 0
30180 RETURN
+
+30200 REM Character is number or dot
+30210 REM input: C$
+30220 REM output: ISNUM
+30230 IF C$ = "." THEN ISNUM = 1:RETURN
+30240 IF ASC(C$) >= ASC("0") AND ASC(C$) <= ASC("9") THEN ISNUM = 1:RETURN
+30250 ISNUM = 0:RETURN