Fighting the good fight.

Move libfmt, libutf into subdirectories of lib9.

Add poll-based socket i/o to libthread, so that we can
avoid using multiple procs when possible, thus removing
dependence on crappy pthreads implementations.

Convert samterm, acme to the single-proc libthread.

Bring libcomplete, acme up-to-date w.r.t. Plan 9 distribution.
diff --git a/src/cmd/acme/look.c b/src/cmd/acme/look.c
index 9f54f9e..ca7eba4 100644
--- a/src/cmd/acme/look.c
+++ b/src/cmd/acme/look.c
@@ -320,60 +320,18 @@
 	return FALSE;
 }
 
+/* Runestr wrapper for cleanname */
 Runestr
 cleanrname(Runestr rs)
 {
-	int i, j, found;
-	Rune *b;
-	int n;
-	static Rune Lslashdotdot[] = { '/', '.', '.', 0 };
+	char *s;
+	int nb, nulls;
 
-	b = rs.r;
-	n = rs.nr;
-
-	/* compress multiple slashes */
-	for(i=0; i<n-1; i++)
-		if(b[i]=='/' && b[i+1]=='/'){
-			runemove(b+i, b+i+1, n-i-1);
-			--n;
-			--i;
-		}
-	/*  eliminate ./ */
-	for(i=0; i<n-1; i++)
-		if(b[i]=='.' && b[i+1]=='/' && (i==0 || b[i-1]=='/')){
-			runemove(b+i, b+i+2, n-i-2);
-			n -= 2;
-			--i;
-		}
-	/* eliminate trailing . */
-	if(n>=2 && b[n-2]=='/' && b[n-1]=='.')
-		--n;
-	do{
-		/* compress xx/.. */
-		found = FALSE;
-		for(i=1; i<=n-3; i++)
-			if(runeeq(b+i, 3, Lslashdotdot, 3)){
-				if(i==n-3 || b[i+3]=='/'){
-					found = TRUE;
-					break;
-				}
-			}
-		if(found)
-			for(j=i-1; j>=0; --j)
-				if(j==0 || b[j-1]=='/'){
-					i += 3;		/* character beyond .. */
-					if(i<n && b[i]=='/')
-						++i;
-					runemove(b+j, b+i, n-i);
-					n -= (i-j);
-					break;
-				}
-	}while(found);
-	if(n == 0){
-		*b = '.';
-		n = 1;
-	}
-	return (Runestr){b, n};
+	s = runetobyte(rs.r, rs.nr);
+	cleanname(s);
+	cvttorunes(s, strlen(s), rs.r, &nb, &rs.nr, &nulls);
+	free(s);
+	return rs;
 }
 
 Runestr
@@ -407,6 +365,11 @@
 	Window *w;
 	char buf[128];
 	Rune Lsysinclude[] = { '/', 's', 'y', 's', '/', 'i', 'n', 'c', 'l', 'u', 'd', 'e', 0 };
+	Rune Lusrinclude[] = { '/', 'u', 's', 'r', '/', 'i', 'n', 'c', 'l', 'u', 'd', 'e', 0 };
+	Rune Lusrlocalinclude[] = { '/', 'u', 's', 'r', '/', 'l', 'o', 'c', 'a', 'l', 
+			'/', 'i', 'n', 'c', 'l', 'u', 'd', 'e', 0 };
+	Rune Lusrlocalplan9include[] = { '/', 'u', 's', 'r', '/', 'l', 'o', 'c', 'a', 'l', 
+			'/', 'p', 'l', 'a', 'n', '9', '/', 'i', 'n', 'c', 'l', 'u', 'd', 'e', 0 };
 	Runestr file;
 	int i;
 
@@ -429,6 +392,12 @@
 
 	if(file.r == nil)
 		file = includefile(Lsysinclude, r, n);
+	if(file.r == nil)
+		file = includefile(Lusrlocalplan9include, r, n);
+	if(file.r == nil)
+		file = includefile(Lusrlocalinclude, r, n);
+	if(file.r == nil)
+		file = includefile(Lusrinclude, r, n);
 	if(file.r==nil && objdir!=nil)
 		file = includefile(objdir, r, n);
 	if(file.r == nil)
@@ -702,13 +671,16 @@
 		t->w->dirty = FALSE;
 		winsettag(t->w);
 		textsetselect(&t->w->tag, t->w->tag.file->b.nc, t->w->tag.file->b.nc);
-		if(ow != nil)
+		if(ow != nil){
 			for(i=ow->nincl; --i>=0; ){
 				n = runestrlen(ow->incl[i]);
 				rp = runemalloc(n);
 				runemove(rp, ow->incl[i], n);
 				winaddincl(w, rp, n);
 			}
+			w->autoindent = ow->autoindent;
+		}else
+			w->autoindent = globalautoindent;
 	}
 	if(e->a1 == e->a0)
 		eval = FALSE;