diff options
author | Flavio Cruz <flaviocruz@gmail.com> | 2015-12-29 23:15:01 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2015-12-29 23:24:59 +0100 |
commit | 5089d4a559eb3a0a0f008ad00ba8c5ed8bbc94c6 (patch) | |
tree | 5b5dd54ee2a2c0b96e59164d84e050160bc17b3b /utils/vmstat.c | |
parent | fd0f30ca23e685f56578bebd08b666be0287d59e (diff) | |
download | hurd-5089d4a559eb3a0a0f008ad00ba8c5ed8bbc94c6.tar.gz hurd-5089d4a559eb3a0a0f008ad00ba8c5ed8bbc94c6.tar.bz2 hurd-5089d4a559eb3a0a0f008ad00ba8c5ed8bbc94c6.zip |
fix compiler warnings in hurd/utils
utils: Fix compiler warnings.
* utils/rpcscan.c (setup_extract_target): Remove name variable.
* utils/rpcscan.c (setup_extract_target): Fix bad initializer.
* utils/rpctrace.c (new_send_wrapper, wrap_all_threads, wrap_new_thread,
wrap_new_task, traced_spawn): Fix format strings.
* utils/rpctrace.c (trace_and_forward): Cast to unsigned int.
* utils/rpctrace.c (trace_and_forward): Use memcmp instead of pointer
dereferencing to compare structures.
* utils/rpctrace.c (wrap_all_threads): Cast to vm_address_t.
* utils/rpctrace.c (main): Fix bad initializer.
* utils/shd.c (run): Initialize save0.
* utils/vminfo.c: Fix format strings.
* utils/vmstat.c: Remove PSEP macro and expand the code.
* utils/w.c (add_utmp_procs): Remove unused pos variable.
Diffstat (limited to 'utils/vmstat.c')
-rw-r--r-- | utils/vmstat.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/utils/vmstat.c b/utils/vmstat.c index 92a36726..bdd1d812 100644 --- a/utils/vmstat.c +++ b/utils/vmstat.c @@ -477,10 +477,6 @@ main (int argc, char **argv) ? size_units \ : ((field)->type == PAGESZ ? 0 : state.vmstats.pagesize)) - /* Prints SEP if the variable FIRST is 0, otherwise, prints START (if - it's non-zero), and sets first to 0. */ -#define PSEP(sep, start) \ - (first ? (first = 0, (start && fputs (start, stdout))) : fputs (sep, stdout)) #define PVAL(val, field, width, sign) \ print_val (val, (field)->type, SIZE_UNITS (field), width, sign) /* Intuit the likely maximum field width of FIELD. */ @@ -539,7 +535,13 @@ main (int argc, char **argv) const_fields &= ~(1 << (field - fields)); else { - PSEP (", ", "("); + if (first) + { + first = 0; + fputs("(", stdout); + } + else + fputs(",", stdout); printf ("%s: ", field->name); PVAL (val, field, 0, 0); } @@ -570,7 +572,10 @@ main (int argc, char **argv) for (field = fields, num = 0, first = 1; field->name; field++, num++) if (output_fields & (1 << (field - fields))) { - PSEP (" ", 0); + if (first) + first = 0; + else + fputs (" ", stdout); fprintf (stdout, "%*s", fwidths[num], field->hdr); } putchar ('\n'); @@ -601,7 +606,10 @@ main (int argc, char **argv) val -= vm_state_get_field (&prev_state, field); } - PSEP (" ", 0); + if (first) + first = 0; + else + fputs (" ", stdout); PVAL (val, field, fwidths[num], sign); } } |