LEFT | RIGHT |
| 1 // skip |
| 2 |
1 // Copyright 2009 The Go Authors. All rights reserved. | 3 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 4 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 5 // license that can be found in the LICENSE file. |
4 | 6 |
5 package stdio | 7 package stdio |
6 | 8 |
7 /* | 9 /* |
8 #include <stdio.h> | 10 #include <stdio.h> |
9 | 11 |
10 // on mingw, stderr and stdout are defined as &_iob[FILENO] | 12 // on mingw, stderr and stdout are defined as &_iob[FILENO] |
11 // on netbsd, they are defined as &__sF[FILENO] | 13 // on netbsd, they are defined as &__sF[FILENO] |
12 // and cgo doesn't recognize them, so write a function to get them, | 14 // and cgo doesn't recognize them, so write a function to get them, |
13 // instead of depending on internals of libc implementation. | 15 // instead of depending on internals of libc implementation. |
14 FILE *getStdout(void) { return stdout; } | 16 FILE *getStdout(void) { return stdout; } |
15 FILE *getStderr(void) { return stderr; } | 17 FILE *getStderr(void) { return stderr; } |
16 */ | 18 */ |
17 import "C" | 19 import "C" |
18 | 20 |
19 var Stdout = (*File)(C.getStdout()) | 21 var Stdout = (*File)(C.getStdout()) |
20 var Stderr = (*File)(C.getStderr()) | 22 var Stderr = (*File)(C.getStderr()) |
LEFT | RIGHT |