diff options
author | James Dominic P. Guana <guana.histark@gmail.com> | 2020-05-26 10:57:48 +0800 |
---|---|---|
committer | Robert Roth <robert.roth.off@gmail.com> | 2020-11-04 13:38:03 +0000 |
commit | 9cbb3b91f11ad0c4944a1428d609201c054cffab (patch) | |
tree | 2456ecc117edf25ce43fecf625946a40e72007f6 /sysdeps/linux/glibtop_private.c | |
parent | 9e62440b314fbf87bbeca865a4223311314c52a3 (diff) | |
download | libgtop-9cbb3b91f11ad0c4944a1428d609201c054cffab.tar.gz |
Handle LVM and RAID
Diffstat (limited to 'sysdeps/linux/glibtop_private.c')
-rw-r--r-- | sysdeps/linux/glibtop_private.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/sysdeps/linux/glibtop_private.c b/sysdeps/linux/glibtop_private.c index 7b36561c..7bca42a5 100644 --- a/sysdeps/linux/glibtop_private.c +++ b/sysdeps/linux/glibtop_private.c @@ -57,21 +57,20 @@ skip_token (const char *p) } -int -check_alphanumeric_word (const char *p) +void +get_from_pipe (char *buffer, const char *cmd) { - int test = 0; - p = next_token(p); - while (*p && !g_ascii_isspace(*p)) { - if(g_ascii_isalpha(*p)){ - test = 0; - }else if(g_ascii_isdigit(*p)){ - test = 1; - } - p++; - }; - p = next_token(p); - return test; + FILE* fp; + long psize; + + fp = popen (cmd, "r"); + + fseek (fp, 0, SEEK_END); + psize = ftell (fp); + fseek (fp, 0, SEEK_SET); + fread(buffer,1,psize,fp); + + pclose (fp); } |