4
* Copyright Ericsson AB 2002-2009. All Rights Reserved.
6
* The contents of this file are subject to the Erlang Public License,
7
* Version 1.1, (the "License"); you may not use this file except in
8
* compliance with the License. You should have received a copy of the
9
* Erlang Public License along with this software. If not, it can be
10
* retrieved online at http://www.erlang.org/.
12
* Software distributed under the License is distributed on an "AS IS"
13
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
* the License for the specific language governing rights and limitations
30
* XXX This is a temporary dummy to make sys.c happy until we'll rewrite it.
32
unsigned preloaded_size_ring0 = 1;
33
unsigned char preloaded_ring0[1] = {0};
35
Preload pre_loaded[] = {
36
{"ring0", 1, preloaded_ring0},
41
main(int argc, char** argv)
50
char* progname = argv[0];
55
if (argc > 0 && argv[0][0] == '-') {
61
if ((fp = fopen(argv[0], "r")) == NULL) {
65
/* Needs to be called before any memory allocation */
68
while (fgets(sbuf, sizeof sbuf, fp)) {
70
continue; /* Comment */
71
} else if (sbuf[0] == 'e' && strncmp("exec", sbuf, 4) == 0) {
72
continue; /* Comment ;-) */
73
} else if ((eq = strchr(sbuf, '=')) != NULL) {
75
char* p = strchr(sbuf, '\n');
80
val = erts_read_env(sbuf);
83
erts_sys_putenv(sbuf, eq - &sbuf[0]);
85
erts_free_read_env(val);
86
} else if (sbuf[0] == ':' && '0' <= sbuf[1] && sbuf[1] <= '9') {
87
int load_size = atoi(sbuf+1);
90
bin = malloc(load_size);
91
if (fread(bin, 1, load_size, fp) != load_size) {
94
bins[bin_num].p = bin;
95
bins[bin_num].sz = load_size;
97
} else if (strcmp(sbuf, "--end--\n") == 0) {
108
val = erts_read_env("ERLBREAKHANDLER");
110
init_break_handler();
112
erts_free_read_env(val);
114
if ((rval = erts_load_module(NULL, 0, NIL, &mod, bins[0].p, bins[0].sz)) < 0) {
115
fprintf(stderr, "%s: Load of initial module failed: %d\n",
119
erts_first_process(mod, bins[1].p, bins[1].sz, argc, argv);
125
fprintf(stderr, "%s: bad line: %s\n", progname, sbuf);