bin/top: Fix -Wformat-security
Change-Id: I40bec25162d03f5af3a12f7b6a51d88be4c6e7b8 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3370 Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
committed by
Jérôme Duval
parent
56e857a499
commit
aaca5974ec
+14
-13
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 1996 Be, Inc.
|
* Copyright (C) 1996 Be, Inc.
|
||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*
|
*
|
||||||
* This source code was published by Be, Inc. in the file gnu_x86.tar.gz for R3,
|
* This source code was published by Be, Inc. in the file gnu_x86.tar.gz for R3,
|
||||||
* a mirror is at http://linux.inf.elte.hu/ftp/beos/development/gnu/r3.0/
|
* a mirror is at http://linux.inf.elte.hu/ftp/beos/development/gnu/r3.0/
|
||||||
* needs to link to termcap.
|
* needs to link to termcap.
|
||||||
@@ -72,8 +72,8 @@ winch_handler(int notused)
|
|||||||
static void
|
static void
|
||||||
sigint_handler(int)
|
sigint_handler(int)
|
||||||
{
|
{
|
||||||
printf(exit_ca_mode);
|
tputs(exit_ca_mode, 1, putchar);
|
||||||
printf(restore_cursor);
|
tputs(restore_cursor, 1, putchar);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,9 +92,9 @@ init_term()
|
|||||||
restore_cursor = tgetstr("rc", &entries);
|
restore_cursor = tgetstr("rc", &entries);
|
||||||
save_cursor = tgetstr("sc", &entries);
|
save_cursor = tgetstr("sc", &entries);
|
||||||
|
|
||||||
printf(save_cursor);
|
tputs(save_cursor, 1, putchar);
|
||||||
printf(enter_ca_mode);
|
tputs(enter_ca_mode, 1, putchar);
|
||||||
printf(clear_string);
|
tputs(clear_string, 1, putchar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -187,8 +187,8 @@ compare(
|
|||||||
*/
|
*/
|
||||||
times.sort();
|
times.sort();
|
||||||
|
|
||||||
printf("%6s %7s %7s %7s %4s %16s %-16s \n", "THID", "TOTAL", "USER", "KERNEL",
|
printf("%6s %7s %7s %7s %4s %16s %-16s \n", "THID", "TOTAL", "USER",
|
||||||
"%CPU", "TEAM NAME", "THREAD NAME");
|
"KERNEL", "%CPU", "TEAM NAME", "THREAD NAME");
|
||||||
linecount = 1;
|
linecount = 1;
|
||||||
idletime = 0;
|
idletime = 0;
|
||||||
gtotal = 0;
|
gtotal = 0;
|
||||||
@@ -241,7 +241,8 @@ compare(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("------ %7.2f %7.2f %7.2f %4.1f%% TOTAL (%4.1f%% idle time, %4.1f%% unknown)",
|
printf("------ %7.2f %7.2f %7.2f %4.1f%% "
|
||||||
|
"TOTAL (%4.1f%% idle time, %4.1f%% unknown)",
|
||||||
(double) (gtotal / 1000),
|
(double) (gtotal / 1000),
|
||||||
(double) (utotal / 1000),
|
(double) (utotal / 1000),
|
||||||
(double) (ktotal / 1000),
|
(double) (ktotal / 1000),
|
||||||
@@ -249,8 +250,8 @@ compare(
|
|||||||
cpu_perc(idletime, uinterval),
|
cpu_perc(idletime, uinterval),
|
||||||
cpu_perc(cpus * uinterval - (gtotal + idletime), uinterval));
|
cpu_perc(cpus * uinterval - (gtotal + idletime), uinterval));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
printf(clear_string);
|
tputs(clear_string, 1, putchar);
|
||||||
printf(cursor_home);
|
tputs(cursor_home, 1, putchar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -409,8 +410,8 @@ main(int argc, char **argv)
|
|||||||
baseline = gather(&baseline, refresh);
|
baseline = gather(&baseline, refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(exit_ca_mode);
|
tputs(exit_ca_mode, 1, putchar);
|
||||||
printf(restore_cursor);
|
tputs(restore_cursor, 1, putchar);
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user