draugr~ single ELF file analysis tool |
| git clone https://github.com/djnnvx/draugr.git |
| log | files | refs | archive | README |
output.odin (445B)
1 package analysis 2 3 import "core:fmt" 4 import "core:os" 5 6 // An empty out_path means stdout, which must not be closed. 7 open_out :: proc(out_path: string) -> (^os.File, string) { 8 if out_path == "" { 9 return os.stdout, "" 10 } 11 f, err := os.create(out_path) 12 if err != nil { 13 return nil, fmt.tprintf("cannot create %s: %v", out_path, err) 14 } 15 return f, "" 16 } 17 18 close_out :: proc(f: ^os.File, out_path: string) { 19 if out_path != "" { 20 os.close(f) 21 } 22 }