static Htop_Reaction actionHelp(State* st) { Settings* settings = st->settings; clear(); attrset(CRT_colors[HELP_BOLD]); for (int i = 0; i < LINES-1; i++) mvhline(i, 0, ' ', COLS); mvaddstr(0, 0, "htop " VERSION " - " COPYRIGHT); mvaddstr(1, 0, "Released under the GNU GPL. See 'man' page for more info."); attrset(CRT_colors[DEFAULT_COLOR]); mvaddstr(3, 0, "CPU usage bar: "); #define addattrstr(a,s) attrset(a);addstr(s) addattrstr(CRT_colors[BAR_BORDER], "["); if (settings->detailedCPUTime) { addattrstr(CRT_colors[CPU_NICE_TEXT], "low"); addstr("/"); addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/"); addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/"); addattrstr(CRT_colors[CPU_IRQ], "irq"); addstr("/"); addattrstr(CRT_colors[CPU_SOFTIRQ], "soft-irq"); addstr("/"); addattrstr(CRT_colors[CPU_STEAL], "steal"); addstr("/"); addattrstr(CRT_colors[CPU_GUEST], "guest"); addstr("/"); addattrstr(CRT_colors[CPU_IOWAIT], "io-wait"); addattrstr(CRT_colors[BAR_SHADOW], " used%"); } else { addattrstr(CRT_colors[CPU_NICE_TEXT], "low-priority"); addstr("/"); addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/"); addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/"); addattrstr(CRT_colors[CPU_STEAL], "virtualiz"); addattrstr(CRT_colors[BAR_SHADOW], " used%"); } addattrstr(CRT_colors[BAR_BORDER], "]"); attrset(CRT_colors[DEFAULT_COLOR]); mvaddstr(4, 0, "Memory bar: "); addattrstr(CRT_colors[BAR_BORDER], "["); addattrstr(CRT_colors[MEMORY_USED], "used"); addstr("/"); addattrstr(CRT_colors[MEMORY_BUFFERS_TEXT], "buffers"); addstr("/"); addattrstr(CRT_colors[MEMORY_CACHE], "cache"); addattrstr(CRT_colors[BAR_SHADOW], " used/total"); addattrstr(CRT_colors[BAR_BORDER], "]"); attrset(CRT_colors[DEFAULT_COLOR]); mvaddstr(5, 0, "Swap bar: "); addattrstr(CRT_colors[BAR_BORDER], "["); addattrstr(CRT_colors[SWAP], "used"); addattrstr(CRT_colors[BAR_SHADOW], " used/total"); addattrstr(CRT_colors[BAR_BORDER], "]"); attrset(CRT_colors[DEFAULT_COLOR]); mvaddstr(6,0, "Type and layout of header meters are configurable in the setup screen."); if (CRT_colorScheme == COLORSCHEME_MONOCHROME) { mvaddstr(7, 0, "In monochrome, meters display as different chars, in order: |#*@$%&."); } mvaddstr( 8, 0, " Status: R: running; S: sleeping; T: traced/stopped; Z: zombie; D: disk sleep"); for (int i = 0; helpLeft[i].info; i++) { mvaddstr(9+i, 9, helpLeft[i].info); } for (int i = 0; helpRight[i].info; i++) { mvaddstr(9+i, 49, helpRight[i].info); } attrset(CRT_colors[HELP_BOLD]); for (int i = 0; helpLeft[i].key; i++) { mvaddstr(9+i, 0, helpLeft[i].key); } for (int i = 0; helpRight[i].key; i++) { mvaddstr(9+i, 40, helpRight[i].key); } attrset(CRT_colors[PROCESS_THREAD]); mvaddstr(16, 32, "threads"); mvaddstr(17, 26, "threads"); attrset(CRT_colors[DEFAULT_COLOR]); attrset(CRT_colors[HELP_BOLD]); mvaddstr(23,0, "Press any key to return."); attrset(CRT_colors[DEFAULT_COLOR]); refresh(); CRT_readKey(); clear(); return HTOP_RECALCULATE | HTOP_REDRAW_BAR; }
static void showHelp(ProcessList* pl) { clear(); attrset(CRT_colors[HELP_BOLD]); for (int i = 0; i < LINES-1; i++) mvhline(i, 0, ' ', COLS); mvaddstr(0, 0, "htop " VERSION " - " COPYRIGHT); mvaddstr(1, 0, "Released under the GNU GPL. See 'man' page for more info."); attrset(CRT_colors[DEFAULT_COLOR]); mvaddstr(3, 0, "CPU usage bar: "); #define addattrstr(a,s) attrset(a);addstr(s) addattrstr(CRT_colors[BAR_BORDER], "["); if (pl->detailedCPUTime) { addattrstr(CRT_colors[CPU_NICE], "low"); addstr("/"); addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/"); addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/"); addattrstr(CRT_colors[CPU_IRQ], "irq"); addstr("/"); addattrstr(CRT_colors[CPU_SOFTIRQ], "soft-irq"); addstr("/"); addattrstr(CRT_colors[CPU_IOWAIT], "io-wait"); addstr("/"); addattrstr(CRT_colors[CPU_STEAL], "steal"); addstr("/"); addattrstr(CRT_colors[CPU_GUEST], "guest"); addattrstr(CRT_colors[BAR_SHADOW], " used%"); } else { addattrstr(CRT_colors[CPU_NICE], "low-priority"); addstr("/"); addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/"); addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/"); addattrstr(CRT_colors[CPU_STEAL], "virtualiz"); addattrstr(CRT_colors[BAR_SHADOW], " used%"); } addattrstr(CRT_colors[BAR_BORDER], "]"); attrset(CRT_colors[DEFAULT_COLOR]); mvaddstr(4, 0, "Memory bar: "); addattrstr(CRT_colors[BAR_BORDER], "["); addattrstr(CRT_colors[MEMORY_USED], "used"); addstr("/"); addattrstr(CRT_colors[MEMORY_BUFFERS], "buffers"); addstr("/"); addattrstr(CRT_colors[MEMORY_CACHE], "cache"); addattrstr(CRT_colors[BAR_SHADOW], " used/total"); addattrstr(CRT_colors[BAR_BORDER], "]"); attrset(CRT_colors[DEFAULT_COLOR]); mvaddstr(5, 0, "Swap bar: "); addattrstr(CRT_colors[BAR_BORDER], "["); addattrstr(CRT_colors[SWAP], "used"); addattrstr(CRT_colors[BAR_SHADOW], " used/total"); addattrstr(CRT_colors[BAR_BORDER], "]"); attrset(CRT_colors[DEFAULT_COLOR]); mvaddstr(6,0, "Type and layout of header meters are configurable in the setup screen."); if (CRT_colorScheme == COLORSCHEME_MONOCHROME) { mvaddstr(7, 0, "In monochrome, meters are displayed through different chars, in order: |#*@$%&"); } mvaddstr( 8, 0, " Status: R: running; S: sleeping; T: traced/stopped; Z: zombie; D: disk sleep"); mvaddstr( 9, 0, " Arrows: scroll process list F5 t: tree view"); mvaddstr(10, 0, " Digits: incremental PID search u: show processes of a single user"); mvaddstr(11, 0, " F3 /: incremental name search H: hide/show user threads"); mvaddstr(12, 0, " F4 \\: incremental name filtering K: hide/show kernel threads"); mvaddstr(13, 0, " Space: tag processes F: cursor follows process"); mvaddstr(14, 0, " U: untag all processes + -: expand/collapse tree"); mvaddstr(15, 0, " F9 k: kill process/tagged processes P M T: sort by CPU%, MEM% or TIME"); mvaddstr(16, 0, " ] F7: higher priority (root only) i: set IO priority"); mvaddstr(17, 0, " [ F8: lower priority (+ nice) I: invert sort order"); #if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY) if (pl->cpuCount > 1) mvaddstr(18, 0, " a: set CPU affinity F6 >: select sort column"); else #endif mvaddstr(18, 0, " F6 >: select sort column"); mvaddstr(19, 0, " F2 S: setup l: list open files with lsof"); mvaddstr(20, 0, " F1 h: show this help screen s: trace syscalls with strace"); mvaddstr(21, 0, " F10 q: quit"); attrset(CRT_colors[HELP_BOLD]); mvaddstr( 9, 0, " Arrows"); mvaddstr( 9,40, " F5 t"); mvaddstr(10, 0, " Digits"); mvaddstr(10,40, " u"); mvaddstr(11, 0, " F3 /"); mvaddstr(11,40, " H"); mvaddstr(12, 0, " F4 \\"); mvaddstr(12,40, " K"); mvaddstr(13, 0, " Space"); mvaddstr(13,40, " F"); mvaddstr(14, 0, " U"); mvaddstr(14,40, " + -"); mvaddstr(15, 0, " F9 k"); mvaddstr(15,40, "P M T"); mvaddstr(16, 0, " ] F7"); mvaddstr(16,40, " i"); mvaddstr(17, 0, " [ F8"); mvaddstr(17,40, " I"); mvaddstr(18,40, " F6 >"); #if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY) if (pl->cpuCount > 1) mvaddstr(18, 0, " a:"); #endif mvaddstr(19, 0, " F2 S"); mvaddstr(19,40, " l"); mvaddstr(20, 0, " ? F1 h"); mvaddstr(20,40, " s"); mvaddstr(21, 0, " F10 q"); attrset(CRT_colors[DEFAULT_COLOR]); attrset(CRT_colors[HELP_BOLD]); mvaddstr(23,0, "Press any key to return."); attrset(CRT_colors[DEFAULT_COLOR]); refresh(); CRT_readKey(); clear(); }