shithub: neatroff

Download patch

ref: b66f7af07003a601e2e125e2c2926586c8664571
parent: 7f189830897b8e338087b45dfba9b7ff18a9bb24
author: Jacob Moody <moody@posixcafe.org>
date: Mon Feb 13 21:45:54 EST 2023

fixed stubbed system()

--- a/tr.c
+++ b/tr.c
@@ -389,7 +389,18 @@
 
 static void tr_sy(char **args)
 {
-	//system(args[1]);
+	char *a[64] = { "rc", "-c", nil};
+	char **s, **d;
+
+	s = args + 1;
+	d = a + 2;
+	while((*d++ = *s++) != nil)
+		;
+	if(fork() == 0){
+		exec("/bin/rc", a);
+		sysfatal("exec: %r");
+	}
+	waitpid();
 }
 
 static void tr_lt(char **args)