apps/top.c
/**
 * @brief Print one entry to stdout with the appropriate formatter.
 *
 * @p out Process entry to print.
 * @p width Total available screen width.
 */
@brief Print one entry to stdout with the appropriate formatter.
@p out Process entry to print.
@p width Total available screen width.
@brief Print one entry to stdout with the appropriate formatter . @p out Process entry to print . @p width Total available screen width .
void print_entry(struct process * out, int width) {
	int used = 0;
	for (int * c = columns; *c; ++c) {
		if (*c == sort_column) printf("\033[1m");
		used += print_column(out, *c);
		if (*c == sort_column) printf("\033[0m");
	}
	printf("%.*s\033[K\n", width - used, out->command_line ? out->command_line : out->process);
}
void print_entry ( struct process * out , int width ) { int used = 0 ; for ( int * c = columns ; * c ; ++ c ) { if ( * c == sort_column ) printf ( " \033 " ) ; used += print_column ( out , * c ) ; if ( * c == sort_column ) printf ( " \033 " ) ; } printf ( " \033 \n " , width - used , out -> command_line ? out -> command_line : out -> process ) ; }
@brief Print one entry to stdout with the appropriate formatter.
@brief Print one entry to stdout with the appropriate formatter .