1
0
mirror of https://github.com/golang/go synced 2024-11-21 19:24:45 -07:00

5a, 5c, 6a, 6c, 8a, 8c: fix Windows file paths

Verified with objdump -W.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/4974061
This commit is contained in:
Hector Chu 2011-09-07 15:49:56 -04:00 committed by Russ Cox
parent 08ae1a5a23
commit aed2c06dcb
7 changed files with 38 additions and 48 deletions

View File

@ -307,6 +307,8 @@ extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
extern int fork(void); extern int fork(void);
extern int pread(int fd, void *buf, int n, int off); extern int pread(int fd, void *buf, int n, int off);
extern int pwrite(int fd, void *buf, int n, int off); extern int pwrite(int fd, void *buf, int n, int off);
#undef getwd
#define getwd(s, ns) getcwd(s, ns)
#undef lseek #undef lseek
#define lseek(fd, n, base) _lseeki64(fd, n, base) #define lseek(fd, n, base) _lseeki64(fd, n, base)
#define mkdir(path, perm) mkdir(path) #define mkdir(path, perm) mkdir(path)

View File

@ -44,7 +44,11 @@ enum
int int
systemtype(int sys) systemtype(int sys)
{ {
#ifdef _WIN32
return sys&Windows;
#else
return sys&Plan9; return sys&Plan9;
#endif
} }
void void
@ -643,17 +647,13 @@ outhist(void)
for(h = hist; h != H; h = h->link) { for(h = hist; h != H; h = h->link) {
p = h->name; p = h->name;
op = 0; op = 0;
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && p && p[1] == ':'){ if(systemtype(Windows) && p && p[1] == ':'){
p += 2; c = p[2];
c = *p; } else if(p && p[0] != c && h->offset == 0 && pathname){
}
if(p && p[0] != c && h->offset == 0 && pathname){
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && pathname[1] == ':') { if(systemtype(Windows) && pathname[1] == ':') {
op = p; op = p;
p = pathname+2; p = pathname;
c = *p; c = p[2];
} else if(pathname[0] == c){ } else if(pathname[0] == c){
op = p; op = p;
p = pathname; p = pathname;

View File

@ -460,17 +460,13 @@ outhist(Biobuf *b)
for(h = hist; h != H; h = h->link) { for(h = hist; h != H; h = h->link) {
p = h->name; p = h->name;
op = 0; op = 0;
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && p && p[1] == ':'){ if(systemtype(Windows) && p && p[1] == ':'){
p += 2; c = p[2];
c = *p; } else if(p && p[0] != c && h->offset == 0 && pathname){
}
if(p && p[0] != c && h->offset == 0 && pathname){
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && pathname[1] == ':') { if(systemtype(Windows) && pathname[1] == ':') {
op = p; op = p;
p = pathname+2; p = pathname;
c = *p; c = p[2];
} else if(pathname[0] == c){ } else if(pathname[0] == c){
op = p; op = p;
p = pathname; p = pathname;

View File

@ -44,7 +44,11 @@ enum
int int
systemtype(int sys) systemtype(int sys)
{ {
#ifdef _WIN32
return sys&Windows;
#else
return sys&Plan9; return sys&Plan9;
#endif
} }
int int
@ -1251,17 +1255,13 @@ outhist(void)
for(h = hist; h != H; h = h->link) { for(h = hist; h != H; h = h->link) {
p = h->name; p = h->name;
op = 0; op = 0;
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && p && p[1] == ':'){ if(systemtype(Windows) && p && p[1] == ':'){
p += 2; c = p[2];
c = *p; } else if(p && p[0] != c && h->offset == 0 && pathname){
}
if(p && p[0] != c && h->offset == 0 && pathname){
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && pathname[1] == ':') { if(systemtype(Windows) && pathname[1] == ':') {
op = p; op = p;
p = pathname+2; p = pathname;
c = *p; c = p[2];
} else if(pathname[0] == c){ } else if(pathname[0] == c){
op = p; op = p;
p = pathname; p = pathname;

View File

@ -331,17 +331,13 @@ outhist(Biobuf *b)
for(h = hist; h != H; h = h->link) { for(h = hist; h != H; h = h->link) {
p = h->name; p = h->name;
op = 0; op = 0;
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && p && p[1] == ':'){ if(systemtype(Windows) && p && p[1] == ':'){
p += 2; c = p[2];
c = *p; } else if(p && p[0] != c && h->offset == 0 && pathname){
}
if(p && p[0] != c && h->offset == 0 && pathname){
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && pathname[1] == ':') { if(systemtype(Windows) && pathname[1] == ':') {
op = p; op = p;
p = pathname+2; p = pathname;
c = *p; c = p[2];
} else if(pathname[0] == c){ } else if(pathname[0] == c){
op = p; op = p;
p = pathname; p = pathname;

View File

@ -44,7 +44,11 @@ enum
int int
systemtype(int sys) systemtype(int sys)
{ {
#ifdef _WIN32
return sys&Windows;
#else
return sys&Plan9; return sys&Plan9;
#endif
} }
int int
@ -912,17 +916,13 @@ outhist(void)
for(h = hist; h != H; h = h->link) { for(h = hist; h != H; h = h->link) {
p = h->name; p = h->name;
op = 0; op = 0;
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && p && p[1] == ':'){ if(systemtype(Windows) && p && p[1] == ':'){
p += 2; c = p[2];
c = *p; } else if(p && p[0] != c && h->offset == 0 && pathname){
}
if(p && p[0] != c && h->offset == 0 && pathname){
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && pathname[1] == ':') { if(systemtype(Windows) && pathname[1] == ':') {
op = p; op = p;
p = pathname+2; p = pathname;
c = *p; c = p[2];
} else if(pathname[0] == c){ } else if(pathname[0] == c){
op = p; op = p;
p = pathname; p = pathname;

View File

@ -330,17 +330,13 @@ outhist(Biobuf *b)
for(h = hist; h != H; h = h->link) { for(h = hist; h != H; h = h->link) {
p = h->name; p = h->name;
op = 0; op = 0;
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && p && p[1] == ':'){ if(systemtype(Windows) && p && p[1] == ':'){
p += 2; c = p[2];
c = *p; } else if(p && p[0] != c && h->offset == 0 && pathname){
}
if(p && p[0] != c && h->offset == 0 && pathname){
/* on windows skip drive specifier in pathname */
if(systemtype(Windows) && pathname[1] == ':') { if(systemtype(Windows) && pathname[1] == ':') {
op = p; op = p;
p = pathname+2; p = pathname;
c = *p; c = p[2];
} else if(pathname[0] == c){ } else if(pathname[0] == c){
op = p; op = p;
p = pathname; p = pathname;