1
0
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:
Shenghou Ma 2012-03-17 01:34:44 +08:00
parent cb4ed897a3
commit 367557cd79

View File

@ -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 */
}
}