Commit c068d5cb by malcolm

cleaned up and beautified

parent 0ac748eb
Showing with 6 additions and 4 deletions
......@@ -19,7 +19,7 @@ void terminal_writeint(int n)
terminal_writestring(f);
}
void io_process(char* s)
void io_process(char* s, int ss)
{
terminal_putchar('\n');
if(strncmp(s,"echo ",5)==0)
......@@ -35,7 +35,7 @@ void io_process(char* s)
}
else if(strncmp(s,"hex ",4)==0)
{
terminal_hexstring(s+4,16);
terminal_hexstring(s+4,ss-4);
terminal_putchar('\n');
}
else if(strncmp(s,"push ",5)==0)
......@@ -97,12 +97,13 @@ void kbd_irq()
char in = scan_map[a];
if(in == '\n')//enter pressed
{
io_process(kb_buf);
io_process(kb_buf, kb_buf_size);
for(int i=0;i<kb_buf_size;i++)
{
kb_buf[i]='\0';
}
kb_buf_size=0;
terminal_writestring("> ");
}
else if(in=='\b')
{
......
......@@ -42,7 +42,7 @@ void kernel_main(multiboot_info* mbt, uint32_t magic)
serial_writestring("Hello, kernel World!\n");
terminal_writestring("Hello, kernel World!\n");
terminal_writestring("> ");
// Abort if magic is not correct.
if (magic != 0x2badb002)
{
......
......@@ -38,3 +38,4 @@ void terminal_putchar(char c);
void terminal_writestring(const char* data);
void terminal_movecursor(size_t x, size_t y);
void terminal_adjustcursor(int x, int y);
void terminal_hexstring(void* s, uint32_t n);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment