top(1): unbreak build with gcc7; fix varargs

- use correct function for varargs argument
- allow build to complete with gcc7 at current WARNS

Reported by:	jhibbits, ian
This commit is contained in:
Eitan Adler 2018-05-22 02:13:04 +00:00
parent 9e2154ff1c
commit bc875b45c5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334010
4 changed files with 5 additions and 16 deletions

View File

@ -129,11 +129,7 @@ next_field(char *str)
}
static int
scanint(str, intp)
char *str;
int *intp;
scanint(char *str, int *intp)
{
int val = 0;
char ch;

View File

@ -1011,7 +1011,7 @@ new_message(int type, char *msgfmt, ...)
va_start(args, msgfmt);
/* first, format the message */
snprintf(next_msg, sizeof(next_msg), msgfmt, args);
vsnprintf(next_msg, sizeof(next_msg), msgfmt, args);
va_end(args);

View File

@ -762,7 +762,6 @@ get_process_info(struct system_info *si, struct process_select *sel,
int show_self;
int show_system;
int show_uid;
int show_command;
int show_kidle;
/*
@ -832,7 +831,6 @@ get_process_info(struct system_info *si, struct process_select *sel,
show_self = sel->self == -1;
show_system = sel->system;
show_uid = sel->uid[0] != -1;
show_command = sel->command != NULL;
show_kidle = sel->kidle;
/* count up process states and get pointers to interesting procs */
@ -984,8 +982,7 @@ format_next_process(caddr_t xhandle, char *(*get_userid)(int), int flags)
break;
default:
if (state >= 0 &&
state < sizeof(state_abbrev) / sizeof(*state_abbrev))
if (state < sizeof(state_abbrev) / sizeof(*state_abbrev))
sprintf(status, "%.6s", state_abbrev[state]);
else
sprintf(status, "?%5zu", state);

View File

@ -94,7 +94,7 @@ static void (*d_process)(int line, char *thisline) = i_process;
static void reset_display(void);
static void
reset_uids()
reset_uids(void)
{
for (size_t i = 0; i < TOP_MAX_UIDS; ++i)
ps.uid[i] = -1;
@ -198,11 +198,7 @@ handle_user(char *buf, size_t buflen)
}
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int i;
int active_procs;