This repository has been archived on 2025-02-27. You can view files and clone it, but cannot push or open issues or pull requests.
portland-os/src/user/init/init.c
2021-01-24 12:00:11 -05:00

29 lines
608 B
C

#include <knob/file.h>
#include <knob/task.h>
#define STARTUP_FILE_PATH "sys/startup.rc"
#define CMD_BUF_LEN 1024
char cmdbuf[CMD_BUF_LEN];
void main() {
struct file *f = open_file(STARTUP_FILE_PATH);
if (!f) {
_system_log("Could not open " STARTUP_FILE_PATH ".\n");
return;
}
while (read_line_from_file(f, cmdbuf, CMD_BUF_LEN - 1)) {
if (cmdbuf[0] == '#')
continue;
//syslogf(run_command(cmdbuf)
// ? "[init] Started %s."
// : "[init] Could not run %s."
//, cmdbuf);
run_command(cmdbuf, 0);
}
close_file(f);
_system_log("Done starting startup tasks.");
}