mirror of
https://github.com/golang/go
synced 2024-11-20 08:04:42 -07:00
cmd/pack: also recognize '\\' as path separator in filenames
R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5841051
This commit is contained in:
parent
cb4ed897a3
commit
367557cd79
@ -1382,11 +1382,14 @@ mesg(int c, char *file)
|
||||
void
|
||||
trim(char *s, char *buf, int n)
|
||||
{
|
||||
char *p;
|
||||
char *p, *q;
|
||||
|
||||
for(;;) {
|
||||
p = strrchr(s, '/');
|
||||
if (!p) { /* no slash in name */
|
||||
q = strrchr(s, '\\');
|
||||
if (q > p)
|
||||
p = q;
|
||||
if (!p) { /* no (back)slash in name */
|
||||
strncpy(buf, s, n);
|
||||
return;
|
||||
}
|
||||
@ -1394,7 +1397,7 @@ trim(char *s, char *buf, int n)
|
||||
strncpy(buf, p+1, n);
|
||||
return;
|
||||
}
|
||||
*p = 0; /* strip trailing slash */
|
||||
*p = 0; /* strip trailing (back)slash */
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user