Get OS name from uname()

This implies that OS names have changed. Unix-like OS names are now
capitalized. "macos" is now "Darwin". Windows is now all-lowecase "windows".
"win32" is gone. "win64" was not used in the original code despite a reference
to it.
This commit is contained in:
2019-08-10 00:35:16 +03:00
parent be6a18175f
commit 2ec07684d2
6 changed files with 25 additions and 18 deletions
+3 -14
View File
@@ -63,8 +63,9 @@
#include "flisp.h"
#include "opcodes.h"
#include "argcount.h"
#include "env.h"
#include "opcodes.h"
static char *builtin_names[] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -2622,19 +2623,7 @@ static void lisp_init(size_t initial_heapsize)
setc(symbol("procedure?"), builtin(OP_FUNCTIONP));
setc(symbol("top-level-bound?"), builtin(OP_BOUNDP));
#ifdef LINUX
set(symbol("*os-name*"), symbol("linux"));
#elif defined(_WIN32)
set(symbol("*os-name*"), symbol("win32"));
#elif defined(MACOSX)
set(symbol("*os-name*"), symbol("macos"));
#elif defined(OPENBSD)
set(symbol("*os-name*"), symbol("openbsd"));
#elif defined(FREEBSD)
set(symbol("*os-name*"), symbol("freebsd"));
#else
set(symbol("*os-name*"), symbol("unknown"));
#endif
set(symbol("*os-name*"), symbol(env_get_os_name()));
the_empty_vector = tagptr(alloc_words(1), TAG_VECTOR);
vector_setsize(the_empty_vector, 0);