更新shell

This commit is contained in:
xiaoyi1212 2024-05-21 22:40:15 +08:00
parent 199d3a865c
commit 124a51354d
4 changed files with 29 additions and 3 deletions

View File

@ -103,6 +103,7 @@ void vbe_writestring(const char *data);
void vbe_scroll();
int cur_task();
void vbe_draw_char(char c,int32_t x,int32_t y);
void draw_rect(int x0, int y0, int x1, int y1, int c);
void initVBE(multiboot_t *multiboot);

View File

@ -58,4 +58,6 @@ void wait_task(struct task_struct *task);
void start_task(struct task_struct *task);
int get_procs();
#endif //CRASHPOWEROS_TASK_H

View File

@ -64,6 +64,12 @@ void print_proc_t(int *i,struct task_struct *base,struct task_struct *cur,int is
}
}
int get_procs(){
int index = 0;
print_proc_t(&index,current,current->next,0);
return index;
}
void print_proc(){
int index = 0;
print_proc_t(&index,current,current->next,1);

View File

@ -286,8 +286,25 @@ char *user() {
void setup_shell() {
char *user1 = "default";//user();
screen_clear();
printf("%s for x86 [Version %s] \n", OS_NAME, OS_VERSION);
printf("Copyright 2024 XIAOYI12 (Build by GCC i686-elf-tools)\n");
printf("Welcome to %s %s (CPOS Kernel x86_64)\n"
"\n"
" * SourceCode: https://github.com/xiaoyi1212/CoolPotOS\n"
" * Website: https://github.com/plos-clan\n"
"\n"
" System information as of %s \n"
"\n"
" Processes: %d\n"
" Users logged in: %s\n"
" Memory usage: %d B \n"
"\n"
"Copyright 2024 XIAOYI12 (Build by GCC i686-elf-tools)\n"
,OS_NAME
,OS_VERSION
,get_date_time()
,get_procs()
,user1
,memory_usage());
char com[MAX_COMMAND_LEN];
char *argv[MAX_ARG_NR];
@ -296,7 +313,7 @@ void setup_shell() {
while (1) {
vfs_getPath(buffer);
printf("%s %s\\> ", user1, buffer);
printf("%s@localhost: %s\\$ ", user1, buffer);
if (gets(com, MAX_COMMAND_LEN) <= 0) continue;
argc = cmd_parse(com, argv, ' ');