From 4da070790e2f2e7d78fbb1f9b684e8c9062a874e Mon Sep 17 00:00:00 2001 From: 10195501441 <10195501441@stu.ecnu.edu.com> Date: Thu, 18 Mar 2021 17:19:42 +0800 Subject: [PATCH] test mytop --- yeeshell.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/yeeshell.c b/yeeshell.c index 05a4b40..6778ec1 100644 --- a/yeeshell.c +++ b/yeeshell.c @@ -399,18 +399,15 @@ int builtin_history(char **args) int builtin_mytop() { - pid_t pid; - if (pid == 0) - { - int cputimemode = 1; - getkinfo(); - mytop_memory(); + + int cputimemode = 1; + mytop_memory(); + getkinfo(); + get_procs(); + if (prev_proc == NULL) get_procs(); - if (prev_proc == NULL) - get_procs(); - print_procs(prev_proc, proc, cputimemode); - exit(0); - } + print_procs(prev_proc, proc, cputimemode); + return 1; }