summaryrefslogtreecommitdiff
path: root/libgo/go/os/dir.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/os/dir.go')
-rw-r--r--libgo/go/os/dir.go23
1 files changed, 13 insertions, 10 deletions
diff --git a/libgo/go/os/dir.go b/libgo/go/os/dir.go
index 0e3c39976d4..f119a214639 100644
--- a/libgo/go/os/dir.go
+++ b/libgo/go/os/dir.go
@@ -10,12 +10,15 @@ import (
"unsafe"
)
-func libc_dup(fd int) int __asm__ ("dup")
-func libc_opendir(*byte) *syscall.DIR __asm__ ("opendir")
-func libc_closedir(*syscall.DIR) int __asm__ ("closedir")
+//extern opendir
+func libc_opendir(*byte) *syscall.DIR
+
+//extern closedir
+func libc_closedir(*syscall.DIR) int
// FIXME: pathconf returns long, not int.
-func libc_pathconf(*byte, int) int __asm__ ("pathconf")
+//extern pathconf
+func libc_pathconf(*byte, int) int
func clen(n []byte) int {
for i := 0; i < len(n); i++ {
@@ -26,14 +29,14 @@ func clen(n []byte) int {
return len(n)
}
-var elen int;
+var elen int
func (file *File) readdirnames(n int) (names []string, err error) {
if elen == 0 {
- var dummy syscall.Dirent;
+ var dummy syscall.Dirent
elen = (unsafe.Offsetof(dummy.Name) +
- libc_pathconf(syscall.StringBytePtr(file.name), syscall.PC_NAME_MAX) +
- 1);
+ libc_pathconf(syscall.StringBytePtr(file.name), syscall.PC_NAME_MAX) +
+ 1)
}
if file.dirinfo == nil {
@@ -55,7 +58,7 @@ func (file *File) readdirnames(n int) (names []string, err error) {
dir := file.dirinfo.dir
if dir == nil {
return names, NewSyscallError("opendir", syscall.GetErrno())
- }
+ }
for n != 0 {
var result *syscall.Dirent
@@ -67,7 +70,7 @@ func (file *File) readdirnames(n int) (names []string, err error) {
break // EOF
}
var name = string(result.Name[0:clen(result.Name[0:])])
- if name == "." || name == ".." { // Useless names
+ if name == "." || name == ".." { // Useless names
continue
}
names = append(names, name)