Make ls standards compliant
Except we aren't using the standard JshFrame struct. We should probably have a meeting to discuss how we're going to organize that going forward.
This commit is contained in:
parent
dc064e8ea7
commit
58009824b6
@ -12,7 +12,7 @@ import (
|
||||
func get_fileinfo(f string, size bool, mode bool, inode bool) string {
|
||||
var stat syscall.Stat_t
|
||||
var ret string
|
||||
ret = "{\"name\":\"" + f + "\""
|
||||
ret = "{\"files\": [{\"name\":\"" + f + "\""
|
||||
if err := syscall.Stat(f, &stat); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -25,7 +25,7 @@ func get_fileinfo(f string, size bool, mode bool, inode bool) string {
|
||||
if inode {
|
||||
ret = ret + ", \"inode\":" + strconv.FormatUint(stat.Ino, 10)
|
||||
}
|
||||
ret = ret + "}"
|
||||
ret = ret + "}]}"
|
||||
return ret
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ func main() {
|
||||
root := "." //flag.Arg(0)
|
||||
dir, _ := ioutil.ReadDir(root)
|
||||
|
||||
fmt.Printf("[\n")
|
||||
fmt.Printf("[{\"StdOut\": [\n")
|
||||
|
||||
if !a_flag {
|
||||
for _, entry := range dir {
|
||||
@ -71,5 +71,5 @@ func main() {
|
||||
fmt.Printf("%s\n", get_fileinfo(entry.Name(), size_flag, mode_flag, inode_flag))
|
||||
}
|
||||
}
|
||||
fmt.Printf("]\n")
|
||||
fmt.Printf("], \"StdErr\": []}]\n")
|
||||
}
|
||||
|
Reference in New Issue
Block a user