]> git.ipfire.org Git - thirdparty/bash.git/blame - lib/tilde/shell.c
Imported from ../bash-2.05.tar.gz.
[thirdparty/bash.git] / lib / tilde / shell.c
CommitLineData
b72432fd
JA
1/* shell.c -- tilde utility functions that are normally provided by
2 bash when readline is linked as part of the shell. */
3
4/* Copyright (C) 1998 Free Software Foundation, Inc.
5
6 This file is part of the GNU Tilde Library.
7
8 The GNU Tilde Library is free software; you can redistribute it
9 and/or modify it under the terms of the GNU General Public License
bb70624e 10 as published by the Free Software Foundation; either version 2, or
b72432fd
JA
11 (at your option) any later version.
12
13 The GNU Tilde Library is distributed in the hope that it will be
14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 The GNU General Public License is often shipped with GNU software, and
19 is generally kept in a file called COPYING or LICENSE. If you do not
20 have a copy of the license, write to the Free Software Foundation,
bb70624e 21 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
b72432fd
JA
22
23#if defined (HAVE_CONFIG_H)
24# include <config.h>
25#endif
26
27#if defined (HAVE_UNISTD_H)
28# ifdef _MINIX
29# include <sys/types.h>
30# endif
31# include <unistd.h>
32#endif /* HAVE_UNISTD_H */
33
34#if defined (HAVE_STDLIB_H)
35# include <stdlib.h>
36#else
37# include "ansi_stdlib.h"
38#endif /* HAVE_STDLIB_H */
39
40#if defined (HAVE_STRING_H)
41# include <string.h>
42#else
43# include <strings.h>
44#endif /* !HAVE_STRING_H */
45
46#include <pwd.h>
47
48#if !defined (HAVE_GETPW_DECLS)
49extern struct passwd *getpwuid ();
50#endif /* !HAVE_GETPW_DECLS */
51
52char *
53get_env_value (varname)
54 char *varname;
55{
56 return ((char *)getenv (varname));
57}
58
59char *
60get_home_dir ()
61{
62 char *home_dir;
63 struct passwd *entry;
64
65 home_dir = (char *)NULL;
66 entry = getpwuid (getuid ());
67 if (entry)
68 home_dir = entry->pw_dir;
69 return (home_dir);
70}