From 0cc9b20c15460213e488bf5e70963b941482f628 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Tue, 14 Jan 2025 16:06:02 -0600 Subject: Add source. --- sdk/other/env.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 sdk/other/env.c (limited to 'sdk/other/env.c') diff --git a/sdk/other/env.c b/sdk/other/env.c new file mode 100644 index 0000000..cf3dfb0 --- /dev/null +++ b/sdk/other/env.c @@ -0,0 +1,36 @@ +/* + * Common values found in process environment space. + * $Id$ + * Copyright (c) 1997 by Tycho Softworks. + * See conditions of distribution and reuse see product license. + */ + +#include +#include + +char *homedir(void) +{ + char *env = getenv("HOME"); + + if(!env) + env = "/"; + + return env; +} + +char *language(void) +{ + static char lbuf[32] = "default"; + + char *env = getenv("LANG"); + + if(env) + { + strncpy(lbuf, env, 31); + lbuf[31] = 0; + strtok(lbuf, "._"); + } + return lbuf; +} + + -- cgit v1.2.3-54-g00ecf