source: trunk/third/gettext/djgpp/getpwnam.c @ 18200

Revision 18200, 1023 bytes checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18199, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2   libc of DJGPP 2.03 does not offer a pw_gecos entry,
3   so this version from DJGPP 2.04 CVS tree is supplied.
4   This file will become superflous and will be removed
5   from the  distribution as soon as DJGPP 2.04 has been
6   released.
7*/
8
9/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
10/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
11#include "djpwd.h"
12#include <unistd.h>
13#include <stdlib.h>
14#include <string.h>
15
16static char passwd[] = "";
17static char slash [] = "/";
18static char shell [] = "sh";
19
20struct passwd *
21getpwnam(const char *name)
22{
23  static struct passwd rv;
24  rv.pw_name = getlogin();
25  if (strcmp(rv.pw_name, name) != 0)
26    return 0;
27  rv.pw_uid = getuid();
28  rv.pw_gid = getgid();
29  rv.pw_dir = getenv("HOME");
30  if (rv.pw_dir == 0)
31    rv.pw_dir = slash;
32  rv.pw_shell = getenv("SHELL");
33  if (rv.pw_shell == 0)
34    rv.pw_shell = getenv("COMSPEC");
35  if (rv.pw_shell == 0)
36    rv.pw_shell = shell;
37  rv.pw_gecos = getlogin();
38  rv.pw_passwd = passwd;
39  return &rv;
40}
Note: See TracBrowser for help on using the repository browser.