fix dup MAX

pull/385/head
Alexander Medvednikov 2019-06-23 01:50:53 +02:00
parent acb00bf623
commit ac66d49c51
1 changed files with 3 additions and 11 deletions

14
os/os.v
View File

@ -293,19 +293,11 @@ pub fn system(cmd string) string {
if isnil(f) { if isnil(f) {
println('popen $cmd failed') println('popen $cmd failed')
} }
#define MAX 1000 max := 1000
# char buf[MAX]; # char buf[max];
// # char* buf = malloc(MAX); # while (fgets(buf, max, f) != NULL) {
// j# sleep(1);
// # if (!fgets(buf, MAX, f)) {
// jprintln('first get failed')
// jos.print_c_errno()
// j# }
# while (fgets(buf, MAX, f) != NULL) {
// # printf("popen buf=%s\n", buf);
# res = string_add(res, tos(buf, strlen(buf))); # res = string_add(res, tos(buf, strlen(buf)));
# } # }
// println(res)
return res.trim_space() return res.trim_space()
} }