almost got the term emu working and shell
This commit is contained in:
@@ -1,5 +1,44 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void term();
|
||||
|
||||
int ptys;
|
||||
int ptym;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
ptym = pty(&ptys);
|
||||
|
||||
if (fork() == 0) {
|
||||
close(ptym);
|
||||
dup2(ptys, 0);
|
||||
dup2(0, 1);
|
||||
dup2(0, 2);
|
||||
|
||||
exec("/rocksh.elf");
|
||||
}
|
||||
|
||||
close(ptys);
|
||||
dup2(ptym, 0);
|
||||
dup2(0, 1);
|
||||
dup2(0, 2);
|
||||
|
||||
term();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void term() {
|
||||
int vga_fd = open("/dev/tvga");
|
||||
if (vga_fd == -1) return;
|
||||
|
||||
while (1) {
|
||||
char c;
|
||||
int rd = read(0, &c, 1);
|
||||
if (rd > 0) {
|
||||
write(vga_fd, &c, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user