summaryrefslogtreecommitdiff
path: root/src/user/init/init.c
blob: 860c45fae6933c6168e592c8ac302384432b7cb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#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.");
}