diff options
author | Narendran Gopalakrishnan <g_narendran142@yahoo.com> | 2020-10-17 16:24:45 +0530 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2020-11-24 19:05:48 +0100 |
commit | 09fe94da18d33d2c4e1fe415e8346fa99b9944b4 (patch) | |
tree | d5d405e4bfdbbe8e4940ffe92f8b50def3cb6122 /Process.c | |
parent | 42c842c190912de58ccf3f41bd58c452c595e40d (diff) |
Improving Command display/sort
Diffstat (limited to 'Process.c')
-rw-r--r-- | Process.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -416,6 +416,10 @@ void Process_done(Process* this) { free(this->comm); } +static const char* Process_getCommandStr(const Process* p) { + return p->comm ? p->comm : ""; +} + const ProcessClass Process_class = { .super = { .extends = Class(Object), @@ -424,6 +428,7 @@ const ProcessClass Process_class = { .compare = Process_compare }, .writeField = Process_writeField, + .getCommandStr = Process_getCommandStr, }; void Process_init(Process* this, const struct Settings_* settings) { @@ -503,7 +508,7 @@ long Process_compare(const void* v1, const void* v2) { case PERCENT_MEM: return SPACESHIP_NUMBER(p2->m_resident, p1->m_resident); case COMM: - return SPACESHIP_NULLSTR(p1->comm, p2->comm); + return SPACESHIP_NULLSTR(Process_getCommand(p1), Process_getCommand(p2)); case MAJFLT: return SPACESHIP_NUMBER(p2->majflt, p1->majflt); case MINFLT: |