aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/acme
diff options
context:
space:
mode:
authorAkshat Kumar <seed@mail.nanosouffle.net>2013-09-06 16:10:26 -0400
committerRuss Cox <rsc@swtch.com>2013-09-06 16:10:26 -0400
commit951fef52c99ad174f9cfb413ba7fd831d1ee5e4b (patch)
treebb092e308632561ffff13726f0bf3882bd7c222f /src/cmd/acme
parent6541f1798bb775b2a00c64af2b8d3f296a3d6f40 (diff)
downloadplan9port-951fef52c99ad174f9cfb413ba7fd831d1ee5e4b.tar.gz
plan9port-951fef52c99ad174f9cfb413ba7fd831d1ee5e4b.tar.bz2
plan9port-951fef52c99ad174f9cfb413ba7fd831d1ee5e4b.zip
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
Diffstat (limited to 'src/cmd/acme')
-rw-r--r--src/cmd/acme/mail/win.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/cmd/acme/mail/win.c b/src/cmd/acme/mail/win.c
index db3bd73c..84c9cee0 100644
--- a/src/cmd/acme/mail/win.c
+++ b/src/cmd/acme/mail/win.c
@@ -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