build system refresh
This commit is contained in:
74
programs/rockterm/main.c
Normal file
74
programs/rockterm/main.c
Normal file
@@ -0,0 +1,74 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/video.h>
|
||||
|
||||
typedef struct {
|
||||
|
||||
} font_t;
|
||||
|
||||
void term_write_char(char c);
|
||||
void render_char_at(char c, int x, int y);
|
||||
|
||||
int spawn_shell();
|
||||
|
||||
int ptys;
|
||||
int ptym;
|
||||
|
||||
void* fb;
|
||||
fb_info_t fb_info;
|
||||
|
||||
int terminal_col = 0;
|
||||
int terminal_row = 0;
|
||||
|
||||
font_t* terminal_font = NULL;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
int vga_fd = open("/dev/vga");
|
||||
if (vga_fd == -1) return 1;
|
||||
|
||||
int kbd_fd = open("/dev/kbd");
|
||||
if (kbd_fd == -1) return 1;
|
||||
|
||||
int res = ioctl(vga_fd, FBIOGET_INFO, &fb_info);
|
||||
if (!res) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
mmap(vga_fd);
|
||||
|
||||
// if (!spawn_shell()) {
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void render_char_at(char c, int x, int y) {
|
||||
if (!terminal_font) return;
|
||||
}
|
||||
|
||||
void term_write_char(char c) {
|
||||
|
||||
}
|
||||
|
||||
int spawn_shell() {
|
||||
ptym = pty(&ptys);
|
||||
|
||||
if (fork() == 0) {
|
||||
close(ptym);
|
||||
dup2(ptys, 0);
|
||||
dup2(0, 1);
|
||||
dup2(0, 2);
|
||||
|
||||
if (!exec("/usr/bin/rocksh")) return 0;
|
||||
}
|
||||
|
||||
close(ptys);
|
||||
dup2(ptym, 0);
|
||||
dup2(0, 1);
|
||||
dup2(0, 2);
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user