blob: b8536be14d3668a477c003ecbd3563195bf8d70f (
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
30
31
|
#include <knob/user.h>
#include <knob/file.h>
#include <knob/task.h>
void main() {
struct file *f = open_file("SYS/STARTUP.RC");
if (!f) {
tell_user_sz("Could not open SYS/STARTUP.RC\n");
return;
}
char buf[1024];
char *bufp = buf;
while (read_from_file(f, 1, bufp)) {
if (*bufp == '\n') {
if (bufp == buf)
continue;
*bufp = '\0';
try_run_command(buf);
bufp = buf;
}
else
++bufp;
}
if (bufp != buf) {
*bufp = '\0';
try_run_command(buf);
}
close_file(f);
}
|