summaryrefslogtreecommitdiff
path: root/doc/progs
diff options
context:
space:
mode:
Diffstat (limited to 'doc/progs')
-rw-r--r--doc/progs/file.go14
-rwxr-xr-xdoc/progs/run2
2 files changed, 8 insertions, 8 deletions
diff --git a/doc/progs/file.go b/doc/progs/file.go
index 0f9a4a9f8..ff796c565 100644
--- a/doc/progs/file.go
+++ b/doc/progs/file.go
@@ -10,11 +10,11 @@ import (
)
type File struct {
- fd int64; // file descriptor number
+ fd int; // file descriptor number
name string; // file name at Open time
}
-func newFile(fd int64, name string) *File {
+func newFile(fd int, name string) *File {
if fd < 0 {
return nil
}
@@ -27,7 +27,7 @@ var (
Stderr = newFile(2, "/dev/stderr");
)
-func Open(name string, mode int64, perm int64) (file *File, err os.Error) {
+func Open(name string, mode int, perm int) (file *File, err os.Error) {
r, e := syscall.Open(name, mode, perm);
return newFile(r, name), os.ErrnoToError(e)
}
@@ -36,16 +36,16 @@ func (file *File) Close() os.Error {
if file == nil {
return os.EINVAL
}
- r, e := syscall.Close(file.fd);
+ e := syscall.Close(file.fd);
file.fd = -1; // so it can't be closed again
- return nil
+ return os.ErrnoToError(e);
}
func (file *File) Read(b []byte) (ret int, err os.Error) {
if file == nil {
return -1, os.EINVAL
}
- r, e := syscall.Read(file.fd, &b[0], int64(len(b)));
+ r, e := syscall.Read(file.fd, b);
return int(r), os.ErrnoToError(e)
}
@@ -53,7 +53,7 @@ func (file *File) Write(b []byte) (ret int, err os.Error) {
if file == nil {
return -1, os.EINVAL
}
- r, e := syscall.Write(file.fd, &b[0], int64(len(b)));
+ r, e := syscall.Write(file.fd, b);
return int(r), os.ErrnoToError(e)
}
diff --git a/doc/progs/run b/doc/progs/run
index c02a632d0..7b9ebfa80 100755
--- a/doc/progs/run
+++ b/doc/progs/run
@@ -46,7 +46,7 @@ function testitpipe {
testit helloworld "" "Hello, world; or Καλημέρα κόσμε; or こんにちは 世界"
-testit helloworld3 "" "hello, world can't open file; err=No such file or directory"
+testit helloworld3 "" "hello, world can't open file; err=no such file or directory"
testit echo "hello, world" "hello, world"
testit sum "" "6"