CoolPotOS/apps/init/init.c

34 lines
612 B
C
Raw Normal View History

2024-08-30 16:12:44 +08:00
#include "../include/syscall.h"
2024-07-14 00:54:27 +08:00
2024-08-31 01:23:06 +08:00
int gets(char *buf) {
int index = 0;
char c;
while ((c = syscall_getc()) != '\n') {
if (c == '\b') {
if (index > 0) {
index--;
syscall_print("\b \b");
}
} else {
buf[index++] = c;
syscall_putchar(c);
}
}
buf[index] = '\0';
syscall_putchar(c);
return index;
}
2024-08-14 21:58:29 +08:00
void hlt(){
while (1);
2024-07-30 22:50:03 +08:00
}
2024-07-14 00:54:27 +08:00
int main(){
2024-08-31 01:23:06 +08:00
syscall_print("Debug info\n");
//char* info;
//gets(info);
//syscall_print(info);
2024-08-30 16:12:44 +08:00
//put_char('A');
2024-08-14 21:58:29 +08:00
hlt();
2024-07-14 00:54:27 +08:00
return 0;
}