aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/other/env.c
blob: cf3dfb015e271472e0ee46882ebdf06ec21b0f84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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 <other/env.h>
#include <std/string.h>

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;
}