mailfs: allow spaces in box name
Mail services (such as Google Mail) will often have directories with names that contain spaces. Acme does not support spaces in window names. So, replace spaces in mail directory names with the Unicode character for visible space. The code is a bit of an over-approximation and generally non-optimal. R=rsc, david.ducolombier, 0intro CC=plan9port.codebot https://codereview.appspot.com/13010048
This commit is contained in:
parent
6541f1798b
commit
951fef52c9
@ -105,7 +105,22 @@ wintagwrite(Window *w, char *s, int n)
|
||||
void
|
||||
winname(Window *w, char *s)
|
||||
{
|
||||
ctlprint(w->ctl, "name %s\n", s);
|
||||
int len;
|
||||
char *ns, *sp;
|
||||
Rune r = L'␣'; /* visible space */
|
||||
|
||||
len = 0;
|
||||
ns = emalloc(strlen(s)*runelen(r) + 1);
|
||||
for(sp = s; *sp != '\0'; sp++, len++){
|
||||
if(isspace(*sp)){
|
||||
len += runetochar(ns+len, &r)-1;
|
||||
continue;
|
||||
}
|
||||
*(ns+len) = *sp;
|
||||
}
|
||||
ctlprint(w->ctl, "name %s\n", ns);
|
||||
free(ns);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Loading…
Reference in New Issue
Block a user