Commit aed2c06d authored by Hector Chu's avatar Hector Chu Committed by Russ Cox

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
parent 08ae1a5a
...@@ -307,6 +307,8 @@ extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); ...@@ -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)
......
...@@ -44,7 +44,11 @@ enum ...@@ -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) ...@@ -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;
......
...@@ -460,17 +460,13 @@ outhist(Biobuf *b) ...@@ -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;
......
...@@ -44,7 +44,11 @@ enum ...@@ -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) ...@@ -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;
......
...@@ -331,17 +331,13 @@ outhist(Biobuf *b) ...@@ -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;
......
...@@ -44,7 +44,11 @@ enum ...@@ -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) ...@@ -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;
......
...@@ -330,17 +330,13 @@ outhist(Biobuf *b) ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment