On Monday 25 of July 2011 17:12:03 Russ Cox wrote:
> cd $PLAN9/src/cmd/mk
> g 16384

thank you a lot, Russ.

will you accept the attached patch for p9p?

nb., i'm still curious why the output from debug print() was truncated as 
well.

-- 
dexen deVries

[[[↓][→]]]

For example, if the first thing in the file is:
   <?kzy irefvba="1.0" rapbqvat="ebg13"?>
an XML parser will recognize that the document is stored in the traditional 
ROT13 encoding.

(( Joe English, http://www.flightlab.com/~joe/sgml/faq-not.txt ))
mk: do not truncate environmental variable

use smprint() to support arbitrary long environmental variables

Signed-off-by: dexen deVries <dexen.devr...@gmail.com>
---
 src/cmd/mk/unix.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/cmd/mk/unix.c b/src/cmd/mk/unix.c
index c63d3ce..6a1312a 100644
--- a/src/cmd/mk/unix.c
+++ b/src/cmd/mk/unix.c
@@ -55,16 +55,14 @@ exportenv(Envy *e, Shell *sh)
 {
 	int i;
 	char **p;
-	static char buf[16384];
 
 	p = 0;
 	for(i = 0; e->name; e++, i++) {
 		p = (char**) Realloc(p, (i+2)*sizeof(char*));
 		if(e->values)
-			snprint(buf, sizeof buf, "%s=%s", e->name,  wtos(e->values, sh->iws));
+			p[i] = smprint("%s=%s", e->name,  wtos(e->values, sh->iws));
 		else
-			snprint(buf, sizeof buf, "%s=", e->name);
-		p[i] = strdup(buf);
+			p[i] = smprint("%s=", e->name);
 	}
 	p[i] = 0;
 	environ = p;
-- 
1.7.4.1

Reply via email to