ref: 1391a257e3efe1a9c3c431a0ba40533b75928b17
parent: 3c33cd2228df8e1c040090c5ee7a086d772739b9
author: phil9 <telephil9@gmail.com>
date: Sun Jul 7 13:45:29 EDT 2024
fix shell escape for rc (thanks shurizzle)
--- a/misc2.c
+++ b/misc2.c
@@ -1265,7 +1265,11 @@
else
# endif
if (*p == '\'')
+# ifdef PLAN9
+ length += 1; /* ' => '' */
+# else
length += 3; /* ' => '\'' */
+# endif
}
/* Allocate memory for the result and fill it. */
@@ -1300,8 +1304,10 @@
if (*p == '\'')
{
*d++='\'';
+# ifndef PLAN9
*d++='\\';
*d++='\'';
+# endif
*d++='\'';
++p;
continue;