From: Igor Böhm Date: Thu, 25 Nov 2021 01:57:04 +0000 Subject: [PATCH] rio: allow spaces in working directory path (-cd) when creating a new window The initial working directory of the new window may be set by a `-cd directory` option. However, the `-cd directory` option is not capable of handling paths with spaces. To enable paths with spaces the function /sys/src/cmd/rio/wctl.c:/^parsewctl is extended to handle quoted directory paths, using a closing quote as the end of a path instead of a space. Before applying the patch the following will fail to open a new window by writing to /dev/wctl: % rio -i window % mkdir '/tmp/path with space' % echo new -cd '''/tmp/path with space''' window -x rc >> /dev/wctl % pwd /tmp/path with space After applying the patch the above sequence works as expected, opening a window running rc and the working directory set to '/tmp/path with space'. --- diff f8dc73782d90c741e7886629252215c13e35af40 343aafa3a09dd808a1652670d8a7e20021cb0057 --- a/sys/src/cmd/rio/wctl.c Mon Nov 8 00:31:11 2021 +++ b/sys/src/cmd/rio/wctl.c Thu Nov 25 02:57:04 2021 @@ -252,8 +252,13 @@ s++; if(param == Cd){ *cdp = s; - while(*s && !isspace(*s)) - s++; + if(*s == '\''){ /* quoted directory */ + *cdp = ++s; + while(*s && *s != '\'') + s++; + }else + while(*s && !isspace(*s)) + s++; if(*s != '\0') *s++ = '\0'; continue;