As discussed off list, "if (!term)" is redundant, as the caller does the check.
Also fix whitespace in some unrelated places. Index: usr.bin/top/display.c =================================================================== RCS file: /cvs/src/usr.bin/top/display.c,v retrieving revision 1.50 diff -u -p -r1.50 display.c --- usr.bin/top/display.c 26 Oct 2015 12:44:22 -0000 1.50 +++ usr.bin/top/display.c 11 May 2016 12:23:23 -0000 @@ -516,7 +516,7 @@ void i_header(char *text) { if (header_status == Yes && (screen_length > y_header - || !smart_terminal)) { + || !smart_terminal)) { if (!smart_terminal) { putn(); if (fputs(text, stdout) == EOF) Index: usr.bin/top/machine.c =================================================================== RCS file: /cvs/src/usr.bin/top/machine.c,v retrieving revision 1.86 diff -u -p -r1.86 machine.c --- usr.bin/top/machine.c 11 May 2016 08:11:27 -0000 1.86 +++ usr.bin/top/machine.c 11 May 2016 12:23:23 -0000 @@ -390,29 +390,25 @@ cmd_matches(struct kinfo_proc *proc, cha extern int show_args; char **args = NULL; - if (!term) { - /* No command filter set */ + /* Filter set, process name needs to contain term */ + if (strstr(proc->p_comm, term)) return 1; - } else { - /* Filter set, process name needs to contain term */ - if (strstr(proc->p_comm, term)) - return 1; - /* If showing arguments, search those as well */ - if (show_args) { - args = get_proc_args(proc); + /* If showing arguments, search those as well */ + if (show_args) { + args = get_proc_args(proc); - if (args == NULL) { - /* Failed to get args, so can't search them */ - return 0; - } + if (args == NULL) { + /* Failed to get args, so can't search them */ + return 0; + } - while (*args != NULL) { - if (strstr(*args, term)) - return 1; - args++; - } + while (*args != NULL) { + if (strstr(*args, term)) + return 1; + args++; } } + return 0; } Index: usr.bin/top/screen.c =================================================================== RCS file: /cvs/src/usr.bin/top/screen.c,v retrieving revision 1.20 diff -u -p -r1.20 screen.c --- usr.bin/top/screen.c 5 Feb 2010 10:21:10 -0000 1.20 +++ usr.bin/top/screen.c 11 May 2016 12:23:23 -0000 @@ -116,11 +116,11 @@ init_termcap(int interactive) else screen_width -= 1; - /* get necessary capabilities */ - if (tgetstr("cl", NULL) == NULL || tgetstr("cm", NULL) == NULL) { - smart_terminal = No; - return; - } + /* get necessary capabilities */ + if (tgetstr("cl", NULL) == NULL || tgetstr("cm", NULL) == NULL) { + smart_terminal = No; + return; + } /* get the actual screen size with an ioctl, if needed */ /* Index: usr.bin/top/top.h =================================================================== RCS file: /cvs/src/usr.bin/top/top.h,v retrieving revision 1.15 diff -u -p -r1.15 top.h --- usr.bin/top/top.h 21 Sep 2013 14:15:19 -0000 1.15 +++ usr.bin/top/top.h 11 May 2016 12:23:23 -0000 @@ -61,8 +61,8 @@ struct errs { /* structure for a system-call error */ - int err; /* value of errno (that is, the actual error) */ - char *arg; /* argument that caused the error */ + int err; /* value of errno (that is, the actual error) */ + char *arg; /* argument that caused the error */ }; extern struct errs errs[]; -- Michal Mazurek