Commit Diff


commit - 72f66c2d3ca556d35b818158e9de578c4bfa153e
commit + 0786c9647c0232825777d8e1c464bef72fdac738
blob - 6eaa8316b7de0abb97a22c00f192c01860a033a3
blob + baea44d99d0e0afb660961cfd51a96c4d1b93648
--- src/cmd/rc/glob.c
+++ src/cmd/rc/glob.c
@@ -125,6 +125,17 @@ equtf(char *p, char *q)
 			return 1;	/* broken code at end of string! */
 		return p[2]==q[2];
 	}
+	if(fourbyte(*p)){
+		if(p[1]!=q[1])
+			return 0;
+		if(p[1]=='\0')
+			return 1;
+		if(p[2]!=q[2])
+			return 0;
+		if(p[2]=='\0')
+			return 1;
+		return p[3]==q[3];
+	}
 	return 1;
 }
 /*
@@ -137,6 +148,7 @@ nextutf(char *p)
 {
 	if(twobyte(*p)) return p[1]=='\0'?p+1:p+2;
 	if(threebyte(*p)) return p[1]=='\0'?p+1:p[2]=='\0'?p+2:p+3;
+	if(fourbyte(*p)) return p[1]=='\0'?p+1:p[2]=='\0'?p+2:p[3]=='\0'?p+3:p+4;
 	return p+1;
 }
 /*
@@ -149,6 +161,7 @@ unicode(char *p)
 	int u=*p&0xff;
 	if(twobyte(u)) return ((u&0x1f)<<6)|(p[1]&0x3f);
 	if(threebyte(u)) return (u<<12)|((p[1]&0x3f)<<6)|(p[2]&0x3f);
+	if(fourbyte(u)) return (u<<18)|((p[1]&0x3f)<<12)|((p[2]&0x3f)<<6)|(p[3]&0x3f);
 	return u;
 }
 /*
blob - 3693483281217cecbe7e87e8941da70081cfa0fc
blob + d9369e5c493048cce062f50e2df1f7b2a6002af6
--- src/cmd/rc/lex.c
+++ src/cmd/rc/lex.c
@@ -173,6 +173,11 @@ addutf(char *p, int c)
 		p = addtok(p, advance());
 		return addtok(p, advance());
 	}
+	if(fourbyte(c)){	/* 4-byte escape */
+		p = addtok(p, advance());
+		p = addtok(p, advance());
+		return addtok(p, advance());
+	}
 	return p;
 }
 int lastdol;	/* was the last token read '$' or '$#' or '"'? */
blob - f95b52875e48cf756548f9a5af2b9ec9152c6c5d
blob + 7778ff4c8c145e8a456fd927a0e00e3e1c608a03
--- src/cmd/rc/rc.h
+++ src/cmd/rc/rc.h
@@ -121,6 +121,8 @@ int mypid;
 #define	onebyte(c)	((c&0x80)==0x00)
 #define	twobyte(c)	((c&0xe0)==0xc0)
 #define	threebyte(c)	((c&0xf0)==0xe0)
+#define	fourbyte(c)	((c&0xf8)==0xf0)
+
 char **argp;
 char **args;
 int nerror;		/* number of errors encountered during compilation */