]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/stdio: split stdout/stderr into a separate file
authorJoel Sing <jsing@google.com>
Mon, 4 Jun 2012 15:38:55 +0000 (01:38 +1000)
committerJoel Sing <jsing@google.com>
Mon, 4 Jun 2012 15:38:55 +0000 (01:38 +1000)
Split stdout/stderr into a separate file so that can be handled
differently on some platforms. Both NetBSD and OpenBSD have defines
for stdout/stderr that require some coercion in order for cgo to
handle them correctly.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6247062

misc/cgo/stdio/file.go
misc/cgo/stdio/stdio.go [new file with mode: 0644]

index 6e7d479ad98f18345798da6ee4c9fcaf24aa48d8..a202f358c6653a887ccd105051f74555dae21fde 100644 (file)
@@ -23,9 +23,6 @@ import "unsafe"
 
 type File C.FILE
 
-var Stdout = (*File)(C.stdout)
-var Stderr = (*File)(C.stderr)
-
 // Test reference to library symbol.
 // Stdout and stderr are too special to be a reliable test.
 //var  = C.environ
diff --git a/misc/cgo/stdio/stdio.go b/misc/cgo/stdio/stdio.go
new file mode 100644 (file)
index 0000000..67b7aea
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2009 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !netbsd
+
+package stdio
+
+/*
+#include <stdio.h>
+*/
+import "C"
+
+var Stdout = (*File)(C.stdout)
+var Stderr = (*File)(C.stderr)