[TUHS] compiling v9sh

arnold at skeeve.com arnold at skeeve.com
Tue Feb 11 17:46:29 AEST 2020


For anyone who's interested, here is what it took to compile Geoff
Collyer's v9sh on Ubuntu 18.04.

Arnold
----------------------------------
diff -ur v9sh/error.c v9sh-new/error.c
--- v9sh/error.c	2017-07-29 11:45:07.000000000 +0300
+++ v9sh-new/error.c	2020-02-10 17:31:33.275920947 +0200
@@ -24,7 +24,7 @@
 	}
 	if (per) {
 		prs(colon);
-		prs(errno < 0 || errno >= sys_nerr? "Bad errno": sys_errlist[errno]);
+		prs(strerror(errno));
 	}
 	newline();
 	exitsh(ERROR);
diff -ur v9sh/pathserv.c v9sh-new/pathserv.c
--- v9sh/pathserv.c	2017-07-29 12:06:25.000000000 +0300
+++ v9sh-new/pathserv.c	2020-02-10 17:29:43.666971083 +0200
@@ -30,7 +30,7 @@
 {
 	struct stat buf;
 
-	if (stat(name, &buf) == 0 && (buf.st_mode&S_IFMT) == S_IFREG &&
+	if (stat(name, &buf) == 0 && S_ISREG(buf.st_mode) &&
 	    access(name, EXECUTE) == 0)
 		return 0;
 	else
diff -ur v9sh/xec.c v9sh-new/xec.c
--- v9sh/xec.c	2017-07-29 12:27:02.000000000 +0300
+++ v9sh-new/xec.c	2020-02-10 17:29:50.607030967 +0200
@@ -612,7 +612,7 @@
 
 			if (flags&ttyflg && (dir1 = spname(tempdir, &score)) &&
 			    stat(dir1, &sb) == 0 &&
-			    (sb.st_mode&S_IFMT) == S_IFDIR &&
+			    S_ISDIR(sb.st_mode) &&
 			    access(dir1, EXECUTE) == 0) {
 				/* dir1 is a searchable directory. */
 				if (score < bestscore) {


More information about the TUHS mailing list