From: Craig Small Date: Wed, 23 Oct 2019 10:40:49 +0000 (+1100) Subject: pstree: use out_string instead of printf X-Git-Tag: v23.3~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=01540fe5ed58419d4fdcad09a2b603e6593c7b15;p=psmisc pstree: use out_string instead of printf The colour functions used printf but now use the out_string like the rest of pstree. --- diff --git a/src/pstree.c b/src/pstree.c index ab0de5f..99881e9 100644 --- a/src/pstree.c +++ b/src/pstree.c @@ -196,27 +196,6 @@ const char *get_ns_name(enum ns_type id) { return ns_names[id]; } -static void reset_color(void){ - if (color_highlight != COLOR_NONE) - printf("\033[0m"); -} - -static void print_proc_color(const int process_age) { - - switch(color_highlight) { - case COLOR_AGE: { - struct age_to_color *p; - for(p=age_to_color; p->age_seconds != 0; p++) - if (process_age < p->age_seconds) - break; - printf("%s", p->color); - } - break; - default: - break; - } - -} static enum ns_type get_ns_id(const char *name) { int i; @@ -500,6 +479,27 @@ static void out_newline(void) cur_x = 1; } +static void reset_color(void){ + if (color_highlight != COLOR_NONE) + out_string("\033[0m"); +} + +static void print_proc_color(const int process_age) { + + switch(color_highlight) { + case COLOR_AGE: { + struct age_to_color *p; + for(p=age_to_color; p->age_seconds != 0; p++) + if (process_age < p->age_seconds) + break; + out_string(p->color); + } + break; + default: + break; + } + +} static PROC *find_proc(pid_t pid) {