factor/vm/os-genunix.c

36 lines
656 B
C
Raw Normal View History

2007-09-20 18:09:08 -04:00
#include "master.h"
void c_to_factor_toplevel(CELL quot)
{
c_to_factor(quot);
}
void init_signals(void)
{
unix_init_signals();
}
void early_init(void) { }
#define SUFFIX ".image"
2008-02-04 13:58:38 -05:00
#define SUFFIX_LEN 6
2007-09-20 18:09:08 -04:00
const char *default_image_path(void)
{
const char *path = vm_executable_path();
if(!path)
return "factor.image";
2008-02-04 13:58:38 -05:00
/* We can't call strlen() here because with gcc 4.1.2 this
causes an internal compiler error. */
int len = 0;
const char *iter = path;
while(*iter) { len++; iter++; }
char *new_path = safe_malloc(PATH_MAX + SUFFIX_LEN + 1);
memcpy(new_path,path,len + 1);
memcpy(new_path + len,SUFFIX,SUFFIX_LEN + 1);
2007-09-20 18:09:08 -04:00
return new_path;
}