#include #include #include void start(const char *cmd) { tell_user_sz(cmd); tell_user_sz(": "); tell_user_sz( try_run_command(cmd) ? "success\n" : "failed\n" ); } #define STARTUP_FILE_PATH "SYS/STARTUP.RC" void main() { struct file *f = open_file(STARTUP_FILE_PATH); if (!f) { tell_user_sz("Could not open " STARTUP_FILE_PATH "\n"); return; } tell_user_sz("[init] Reading from " STARTUP_FILE_PATH ":\n"); char buf[1024]; char *bufp = buf; while (read_from_file(f, 1, bufp)) { if (*bufp == '\n') { if (bufp == buf) continue; *bufp = '\0'; start(buf); bufp = buf; } else ++bufp; } if (bufp != buf) { *bufp = '\0'; start(buf); } close_file(f); tell_user_sz("[init] Done.\n"); }