rio: fix parsing of directory path (-cd) when creating a new window via wctl
Before applying this patch the following will fail to open ed
in the '/tmp/s p a c e' folder:
<snip>
% mkdir '/tmp/s p a c e'
% window -cd '/tmp/s p a c e' ed
!pwd
/tmp/s p a c e
!
q
<snap>
After applying the patch the above sequence works as expected,
opening ed in the '/tmp/s p a c e' folder, printing the present
working directory, and quitting ed.
The root cause was a faulty computation of the pointer `s`,
being off by one, leading to any arguments after the
directory path to be skipped.
This regression was introduced in revision:
• 614f1d6268
Thanks umbraticus for finding and reporting the issue.
This commit is contained in:
parent
4ab2d149d4
commit
876907a530
1 changed files with 7 additions and 8 deletions
|
@ -202,7 +202,7 @@ riostrtol(char *s, char **t)
|
|||
int
|
||||
parsewctl(char **argp, Rectangle r, Rectangle *rp, int *pidp, int *idp, int *hiddenp, int *scrollingp, char **cdp, char *s, char *err)
|
||||
{
|
||||
int cmd, param, xy, sign;
|
||||
int cmd, n, nt, param, xy, sign;
|
||||
char *f[2], *t;
|
||||
|
||||
*pidp = 0;
|
||||
|
@ -252,13 +252,12 @@ parsewctl(char **argp, Rectangle r, Rectangle *rp, int *pidp, int *idp, int *hid
|
|||
s++;
|
||||
if(param == Cd){
|
||||
*cdp = s;
|
||||
gettokens(*cdp, f, nelem(f), " \t\r\n\v\f");
|
||||
s += strlen(*cdp);
|
||||
if((*cdp)[0] == '\'' && s[-1] == '\''){
|
||||
/* drop quotes */
|
||||
*cdp += 1;
|
||||
s[-1] = '\0';
|
||||
}
|
||||
if((nt = gettokens(*cdp, f, nelem(f), " \t\r\n\v\f")) < 1)
|
||||
return -1;
|
||||
n = strlen(*cdp);
|
||||
if((*cdp)[0] == '\'' && (*cdp)[n-1] == '\'')
|
||||
((*cdp)++)[n-1] = '\0'; /* drop quotes */
|
||||
s += n+(nt-1);
|
||||
continue;
|
||||
}
|
||||
sign = 0;
|
||||
|
|
Loading…
Reference in a new issue