Skip to content

Commit

Permalink
fixing shell
Browse files Browse the repository at this point in the history
  • Loading branch information
Kbz-8 committed Jul 22, 2024
1 parent bf92165 commit f734edb
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions sources/kernel/shell/dumb_shell.zig
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,24 @@ pub const DumbShell = struct
}
else if(key == '\n')
{
if (!drivers.vga.canScroll())
drivers.vga.scroll_buffer_clear(drivers.vga.Color.BLACK)
else
libk.io.kputchar('\n');
if(!drivers.vga.canScroll())
drivers.vga.scroll_buffer_clear(drivers.vga.Color.BLACK)
else
libk.io.kputchar('\n');
return;
}
else if(key < 256) // to accept only printable keys
{
libk.io.kputchar(@truncate(key));
if(libk.str.strlen(&self.buffer) == self.buffer.len)
continue;
var j: usize = self.buffer.len - 1;
while(j > i) : (j -= 1)
{
self.buffer[j] = 0;
self.buffer[j] = self.buffer[j - 1];
}
self.buffer[i] = @truncate(key);
if(libk.str.strlen(&self.buffer) == self.buffer.len)
return;
libk.io.kputchar(@truncate(key));
i += 1;
}
}
Expand Down Expand Up @@ -137,22 +137,22 @@ pub const DumbShell = struct
libk.io.kputs(logs.getLogBuffer());
libk.io.kputs("================ Journal ================\n");
}
else if (libk.str.streqlnt(&self.buffer, "help"))
{
libk.io.kputs("================ Help ================\n");
libk.io.kputs("shutdown/exit -> shutdown RatiOS\n");
libk.io.kputs("reboot -> reboot RatiOS\n");
libk.io.kputs("journal -> prints the kernel logs\n");
libk.io.kputs("stack -> prints the stack trace\n");
libk.io.kputs("panic -> trigger a kernel panic\n");
libk.io.kputs("stfu -> shutdown the keyboard\n");
libk.io.kputs("clear -> clears the shell\n");
libk.io.kputs("================ Help ================\n");
}
else if (libk.str.streqlnt(&self.buffer, "clear"))
drivers.vga.scroll_buffer_clear(drivers.vga.Color.BLACK)
else if (libk.str.streqlnt(&self.buffer, "maldavid"))
libk.io.kputs("t'es mauvais\n")
else if (libk.str.streqlnt(&self.buffer, "help"))
{
libk.io.kputs("================ Help ================\n");
libk.io.kputs("shutdown/exit -> shutdown RatiOS\n");
libk.io.kputs("reboot -> reboot RatiOS\n");
libk.io.kputs("journal -> prints the kernel logs\n");
libk.io.kputs("stack -> prints the stack trace\n");
libk.io.kputs("panic -> trigger a kernel panic\n");
libk.io.kputs("stfu -> shutdown the keyboard\n");
libk.io.kputs("clear -> clears the shell\n");
libk.io.kputs("================ Help ================\n");
}
else if (libk.str.streqlnt(&self.buffer, "clear"))
drivers.vga.scroll_buffer_clear(drivers.vga.Color.BLACK)
else if (libk.str.streqlnt(&self.buffer, "vvas"))
libk.io.kputs("t'es mauvais\n")
else
libk.io.kprintf("command not found: {}, type help for help\n", .{ &self.buffer });
}
Expand Down

0 comments on commit f734edb

Please sign in to comment.