Files
mop3/init/init.c
kamkow1 342f39b748
All checks were successful
Build ISO image / build-and-deploy (push) Successful in 40s
Build documentation / build-and-deploy (push) Successful in 26s
Use static buffers for mprintf and debug_printf, cut down on library dependencies
2026-04-03 20:49:07 +02:00

47 lines
808 B
C

#include <debugconsole.h>
#include <kb.h>
#include <limits.h>
#include <process.h>
#include <stddef.h>
#include <stdint.h>
#include <streams.h>
#include <string.h>
#include <terminal.h>
#define RECV_MAX (1024 * 16)
static int ce_pgid;
void receiver (void* arg) {
(void)arg;
char recv[RECV_MAX];
int n;
for (;;) {
n = stream_read (ce_pgid, STREAM_OUT, (void*)recv, RECV_MAX - 1);
if (n > 0)
terminal_print (recv, n);
else
sched ();
}
}
void app_main (void) {
debug_printf ("Init process is running. Starting user shell...\n");
int ce_pid = exec ("sys", "/ce");
ce_pgid = get_procgroup (ce_pid);
process_spawn (&receiver, NULL);
for (;;) {
int ch = kb_read_key ();
if (ch == 0)
continue;
stream_write (ce_pgid, STREAM_IN, &ch, 1);
}
}