add awaitfor and waitfor
diff --git a/src/lib9/wait.c b/src/lib9/wait.c
index 856f85c..31d8c02 100644
--- a/src/lib9/wait.c
+++ b/src/lib9/wait.c
@@ -2,13 +2,12 @@
 #include <libc.h>
 
 static Waitmsg*
-_wait(int nohang)
+_wait(int n, char *buf)
 {
-	int n, l;
-	char buf[512], *fld[5];
+	int l;
+	char *fld[5];
 	Waitmsg *w;
 
-	n = (nohang ? awaitnohang : await)(buf, sizeof buf-1);
 	if(n <= 0)
 		return nil;
 	buf[n] = '\0';
@@ -32,12 +31,24 @@
 Waitmsg*
 wait(void)
 {
-	return _wait(0);
+	char buf[256];
+
+	return _wait(await(buf, sizeof buf-1), buf);
 }
 
 Waitmsg*
 waitnohang(void)
 {
-	return _wait(1);
+	char buf[256];
+
+	return _wait(awaitnohang(buf, sizeof buf-1), buf);
+}
+
+Waitmsg*
+waitfor(int pid)
+{
+	char buf[256];
+
+	return _wait(awaitfor(pid, buf, sizeof buf-1), buf);
 }