]> gitweb.factorcode.org Git - factor.git/blob - vm/os-genunix.cpp
Fix conflict
[factor.git] / vm / os-genunix.cpp
1 #include "master.hpp"
2
3 namespace factor
4 {
5
6 void factorvm::c_to_factor_toplevel(cell quot)
7 {
8         c_to_factor(quot,this);
9 }
10
11 void init_signals()
12 {
13         unix_init_signals();
14 }
15
16 void early_init() { }
17
18 #define SUFFIX ".image"
19 #define SUFFIX_LEN 6
20
21 const char *default_image_path()
22 {
23         const char *path = vm_executable_path();
24
25         if(!path)
26                 return "factor.image";
27
28         /* We can't call strlen() here because with gcc 4.1.2 this
29         causes an internal compiler error. */
30         int len = 0;
31         const char *iter = path;
32         while(*iter) { len++; iter++; }
33
34         char *new_path = (char *)safe_malloc(PATH_MAX + SUFFIX_LEN + 1);
35         memcpy(new_path,path,len + 1);
36         memcpy(new_path + len,SUFFIX,SUFFIX_LEN + 1);
37         return new_path;
38 }
39
40 }