diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-12-24 07:38:37 +0000 |
---|---|---|
committer | <> | 2015-02-02 12:02:29 +0000 |
commit | 482840e61f86ca321838a91e902c41d40c098bbb (patch) | |
tree | 01ea2e242fd2792d19fe192476601587901db794 /djgpp/getpwnam.c | |
download | gettext-tarball-482840e61f86ca321838a91e902c41d40c098bbb.tar.gz |
Imported from /home/lorry/working-area/delta_gettext-tarball/gettext-0.19.4.tar.xz.gettext-0.19.4
Diffstat (limited to 'djgpp/getpwnam.c')
-rw-r--r-- | djgpp/getpwnam.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/djgpp/getpwnam.c b/djgpp/getpwnam.c new file mode 100644 index 0000000..81b48ff --- /dev/null +++ b/djgpp/getpwnam.c @@ -0,0 +1,40 @@ +/* + libc of DJGPP 2.03 does not offer a pw_gecos entry, + so this version from DJGPP 2.04 CVS tree is supplied. + This file will become superflous and will be removed + from the distribution as soon as DJGPP 2.04 has been + released. +*/ + +/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ +/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ +#include "djpwd.h" +#include <unistd.h> +#include <stdlib.h> +#include <string.h> + +static char passwd[] = ""; +static char slash [] = "/"; +static char shell [] = "sh"; + +struct passwd * +getpwnam(const char *name) +{ + static struct passwd rv; + rv.pw_name = getlogin(); + if (strcmp(rv.pw_name, name) != 0) + return 0; + rv.pw_uid = getuid(); + rv.pw_gid = getgid(); + rv.pw_dir = getenv("HOME"); + if (rv.pw_dir == 0) + rv.pw_dir = slash; + rv.pw_shell = getenv("SHELL"); + if (rv.pw_shell == 0) + rv.pw_shell = getenv("COMSPEC"); + if (rv.pw_shell == 0) + rv.pw_shell = shell; + rv.pw_gecos = getlogin(); + rv.pw_passwd = passwd; + return &rv; +} |