os: implement Getwd

This commit is contained in:
Federico G. Schwindt
2021-10-04 23:14:09 +01:00
committed by GitHub
parent 98fbf7ff25
commit b1ec8eb2e0
5 changed files with 47 additions and 2 deletions
+10
View File
@@ -22,3 +22,13 @@ func uitoa(val uint) string {
buf[i] = byte(val + '0')
return string(buf[i:])
}
// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
func clen(n []byte) int {
for i := 0; i < len(n); i++ {
if n[i] == 0 {
return i
}
}
return len(n)
}