diff options
author | Benoît Dejean <bdejean@src.gnome.org> | 2008-06-23 22:07:26 +0000 |
---|---|---|
committer | Benoît Dejean <bdejean@src.gnome.org> | 2008-06-23 22:07:26 +0000 |
commit | ce23ce407cb1cf68d9ab32957ec08ae914434c97 (patch) | |
tree | 2ac8fc53af16ea8c861782a77abd23a745014c68 | |
parent | 7f779e078dfe859e8e5ffbe889ed80458219ec38 (diff) | |
download | libgtop-ce23ce407cb1cf68d9ab32957ec08ae914434c97.tar.gz |
Improved example.
svn path=/trunk/; revision=2758
-rw-r--r-- | examples/df.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/examples/df.c b/examples/df.c index 27be1371..6fcbae00 100644 --- a/examples/df.c +++ b/examples/df.c @@ -27,25 +27,31 @@ static void print_fsusage(const char *mountpoint) } -int main() +int main(int argc, char **argv) { glibtop_mountlist buf; - glibtop_mountentry *entries; - size_t i; glibtop_init(); printf("%-30s %10s %10s %10s %5s %10s %10s\n", "Filesystem", "Size", "Used", "Avail", "Use%", "Read", "Write"); - entries = glibtop_get_mountlist(&buf, TRUE); + if (argc > 1) { + while (*++argv) + print_fsusage(*argv); + } else { + glibtop_mountentry *entries; + size_t i; - for(i = 0; i < buf.number; ++i) - { - print_fsusage(entries[i].mountdir); - } + entries = glibtop_get_mountlist(&buf, TRUE); - g_free(entries); + for(i = 0; i < buf.number; ++i) + { + print_fsusage(entries[i].mountdir); + } + + g_free(entries); + } glibtop_close(); |