247 |
|
printw("%5d", stats.user_stats->num_entries); |
248 |
|
|
249 |
|
/* Mem */ |
250 |
– |
|
250 |
|
move(6, 12); |
251 |
|
printw("%7s", size_conv(stats.mem_stats->total)); |
252 |
|
move(7, 12); |
314 |
|
network_stat_ptr++; |
315 |
|
} |
316 |
|
|
317 |
+ |
/* Disk */ |
318 |
|
disk_stat_ptr = stats.disk_stats; |
319 |
|
for(counter=0;counter<stats.disk_entries;counter++){ |
320 |
|
move(13+stats.network_entries+counter, 42); |
322 |
|
move(13+stats.network_entries+counter, 62); |
323 |
|
printw("%7s", size_conv(disk_stat_ptr->avail)); |
324 |
|
move(13+stats.network_entries+counter, 73); |
325 |
< |
printw("%5.2f%%", 100.00 * ((float)disk_stat_ptr->used / (float)disk_stat_ptr->size)); |
325 |
> |
printw("%5.2f%%", 100.00 * ((float) (disk_stat_ptr->size - disk_stat_ptr->avail) / (float) disk_stat_ptr->size)); |
326 |
|
disk_stat_ptr++; |
327 |
|
} |
328 |
|
|
352 |
|
return 1; |
353 |
|
} |
354 |
|
|
355 |
+ |
void version_num(char *progname){ |
356 |
+ |
fprintf(stderr, "%s version %s\n", progname, PACKAGE_VERSION); |
357 |
+ |
fprintf(stderr, "\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); |
358 |
+ |
exit(1); |
359 |
+ |
} |
360 |
+ |
|
361 |
+ |
void usage(char *progname){ |
362 |
+ |
fprintf(stderr, "Usage: %s [-d delay] [-v] [-h]\n\n", progname); |
363 |
+ |
fprintf(stderr, " -d Sets the update time in seconds\n"); |
364 |
+ |
fprintf(stderr, " -v Prints version number\n"); |
365 |
+ |
fprintf(stderr, " -h Displays this help information.\n"); |
366 |
+ |
fprintf(stderr, "\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); |
367 |
+ |
exit(1); |
368 |
+ |
|
369 |
+ |
} |
370 |
+ |
|
371 |
|
int main(int argc, char **argv){ |
372 |
|
|
373 |
|
extern char *optarg; |
385 |
|
|
386 |
|
int delay=2; |
387 |
|
|
388 |
< |
while ((c = getopt(argc, argv, "d:")) != EOF){ |
388 |
> |
while ((c = getopt(argc, argv, "vhd:")) != EOF){ |
389 |
|
switch (c){ |
390 |
|
case 'd': |
391 |
|
delay = atoi(optarg); |
395 |
|
} |
396 |
|
delay--; |
397 |
|
break; |
398 |
+ |
case 'v': |
399 |
+ |
version_num(argv[0]); |
400 |
+ |
break; |
401 |
+ |
case 'h': |
402 |
+ |
default: |
403 |
+ |
usage(argv[0]); |
404 |
+ |
return 1; |
405 |
+ |
break; |
406 |
+ |
|
407 |
|
} |
408 |
|
} |
409 |
|
|