2005-02-07 05:51:09 -08:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
2004-11-24 19:37:45 -08:00
|
|
|
#include "e.h"
|
|
|
|
|
|
|
|
/* externally accessible functions */
|
2006-09-22 12:55:11 -07:00
|
|
|
EAPI const char *
|
2004-11-24 19:37:45 -08:00
|
|
|
e_user_homedir_get(void)
|
|
|
|
{
|
|
|
|
char *homedir;
|
2006-07-15 09:29:14 -07:00
|
|
|
int len;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
|
|
|
homedir = getenv("HOME");
|
2006-09-22 12:55:11 -07:00
|
|
|
if (!homedir) return "/tmp";
|
2006-07-15 09:29:14 -07:00
|
|
|
len = strlen(homedir);
|
|
|
|
while ((len > 1) && (homedir[len - 1] == '/'))
|
|
|
|
{
|
|
|
|
homedir[len - 1] = 0;
|
|
|
|
len--;
|
|
|
|
}
|
2006-09-22 12:55:11 -07:00
|
|
|
return homedir;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|