mirror of https://github.com/xzeldon/htop.git
Merge branch 'eworm-de-unicode-runtime'
This commit is contained in:
commit
f79591ef1b
6
CRT.c
6
CRT.c
|
@ -667,7 +667,7 @@ void CRT_restorePrivileges() {
|
||||||
|
|
||||||
// TODO: pass an instance of Settings instead.
|
// TODO: pass an instance of Settings instead.
|
||||||
|
|
||||||
void CRT_init(int delay, int colorScheme) {
|
void CRT_init(int delay, int colorScheme, bool allowUnicode) {
|
||||||
initscr();
|
initscr();
|
||||||
noecho();
|
noecho();
|
||||||
CRT_delay = delay;
|
CRT_delay = delay;
|
||||||
|
@ -733,10 +733,12 @@ void CRT_init(int delay, int colorScheme) {
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
|
|
||||||
#ifdef HAVE_LIBNCURSESW
|
#ifdef HAVE_LIBNCURSESW
|
||||||
if(strcmp(nl_langinfo(CODESET), "UTF-8") == 0)
|
if (allowUnicode && strcmp(nl_langinfo(CODESET), "UTF-8") == 0)
|
||||||
CRT_utf8 = true;
|
CRT_utf8 = true;
|
||||||
else
|
else
|
||||||
CRT_utf8 = false;
|
CRT_utf8 = false;
|
||||||
|
#else
|
||||||
|
(void) allowUnicode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CRT_treeStr =
|
CRT_treeStr =
|
||||||
|
|
2
CRT.h
2
CRT.h
|
@ -189,7 +189,7 @@ extern void CRT_restorePrivileges();
|
||||||
|
|
||||||
// TODO: pass an instance of Settings instead.
|
// TODO: pass an instance of Settings instead.
|
||||||
|
|
||||||
extern void CRT_init(int delay, int colorScheme);
|
extern void CRT_init(int delay, int colorScheme, bool allowUnicode);
|
||||||
|
|
||||||
extern void CRT_done();
|
extern void CRT_done();
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,9 @@ Sort by this column (use \-\-sort\-key help for a column list)
|
||||||
\fB\-u \-\-user=USERNAME\fR
|
\fB\-u \-\-user=USERNAME\fR
|
||||||
Show only the processes of a given user
|
Show only the processes of a given user
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-U \-\-no-unicode\fR
|
||||||
|
Do not use unicode but ASCII characters for graph meters
|
||||||
|
.TP
|
||||||
\fB\-v \-\-version
|
\fB\-v \-\-version
|
||||||
Output version information and exit
|
Output version information and exit
|
||||||
.TP
|
.TP
|
||||||
|
|
11
htop.c
11
htop.c
|
@ -43,6 +43,7 @@ static void printHelpFlag() {
|
||||||
"-s --sort-key=COLUMN Sort by COLUMN (try --sort-key=help for a list)\n"
|
"-s --sort-key=COLUMN Sort by COLUMN (try --sort-key=help for a list)\n"
|
||||||
"-t --tree Show the tree view by default\n"
|
"-t --tree Show the tree view by default\n"
|
||||||
"-u --user[=USERNAME] Show only processes for a given user (or $USER)\n"
|
"-u --user[=USERNAME] Show only processes for a given user (or $USER)\n"
|
||||||
|
"-U --no-unicode Do not use unicode but plain ASCII\n"
|
||||||
"-p --pid=PID,[,PID,PID...] Show only the given PIDs\n"
|
"-p --pid=PID,[,PID,PID...] Show only the given PIDs\n"
|
||||||
"-v --version Print version info\n"
|
"-v --version Print version info\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -63,6 +64,7 @@ typedef struct CommandLineSettings_ {
|
||||||
bool useColors;
|
bool useColors;
|
||||||
bool enableMouse;
|
bool enableMouse;
|
||||||
bool treeView;
|
bool treeView;
|
||||||
|
bool allowUnicode;
|
||||||
} CommandLineSettings;
|
} CommandLineSettings;
|
||||||
|
|
||||||
static CommandLineSettings parseArguments(int argc, char** argv) {
|
static CommandLineSettings parseArguments(int argc, char** argv) {
|
||||||
|
@ -75,6 +77,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
|
||||||
.useColors = true,
|
.useColors = true,
|
||||||
.enableMouse = true,
|
.enableMouse = true,
|
||||||
.treeView = false,
|
.treeView = false,
|
||||||
|
.allowUnicode = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct option long_opts[] =
|
static struct option long_opts[] =
|
||||||
|
@ -87,6 +90,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
|
||||||
{"no-color", no_argument, 0, 'C'},
|
{"no-color", no_argument, 0, 'C'},
|
||||||
{"no-colour", no_argument, 0, 'C'},
|
{"no-colour", no_argument, 0, 'C'},
|
||||||
{"no-mouse", no_argument, 0, 'm'},
|
{"no-mouse", no_argument, 0, 'm'},
|
||||||
|
{"no-unicode", no_argument, 0, 'U'},
|
||||||
{"tree", no_argument, 0, 't'},
|
{"tree", no_argument, 0, 't'},
|
||||||
{"pid", required_argument, 0, 'p'},
|
{"pid", required_argument, 0, 'p'},
|
||||||
{0,0,0,0}
|
{0,0,0,0}
|
||||||
|
@ -94,7 +98,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
|
||||||
|
|
||||||
int opt, opti=0;
|
int opt, opti=0;
|
||||||
/* Parse arguments */
|
/* Parse arguments */
|
||||||
while ((opt = getopt_long(argc, argv, "hvmCs:td:u::p:", long_opts, &opti))) {
|
while ((opt = getopt_long(argc, argv, "hvmCs:td:u:Up:", long_opts, &opti))) {
|
||||||
if (opt == EOF) break;
|
if (opt == EOF) break;
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'h':
|
case 'h':
|
||||||
|
@ -148,6 +152,9 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
|
||||||
case 'm':
|
case 'm':
|
||||||
flags.enableMouse = false;
|
flags.enableMouse = false;
|
||||||
break;
|
break;
|
||||||
|
case 'U':
|
||||||
|
flags.allowUnicode = false;
|
||||||
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
flags.treeView = true;
|
flags.treeView = true;
|
||||||
break;
|
break;
|
||||||
|
@ -226,7 +233,7 @@ int main(int argc, char** argv) {
|
||||||
if (flags.treeView)
|
if (flags.treeView)
|
||||||
settings->treeView = true;
|
settings->treeView = true;
|
||||||
|
|
||||||
CRT_init(settings->delay, settings->colorScheme);
|
CRT_init(settings->delay, settings->colorScheme, flags.allowUnicode);
|
||||||
|
|
||||||
MainPanel* panel = MainPanel_new();
|
MainPanel* panel = MainPanel_new();
|
||||||
ProcessList_setPanel(pl, (Panel*) panel);
|
ProcessList_setPanel(pl, (Panel*) panel);
|
||||||
|
|
Loading…
Reference in New Issue