1*946379e7Schristos /* 2*946379e7Schristos libc of DJGPP 2.03 does not offer a pw_gecos entry, 3*946379e7Schristos so this version from DJGPP 2.04 CVS tree is supplied. 4*946379e7Schristos This file will become superflous and will be removed 5*946379e7Schristos from the distribution as soon as DJGPP 2.04 has been 6*946379e7Schristos released. 7*946379e7Schristos */ 8*946379e7Schristos 9*946379e7Schristos /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ 10*946379e7Schristos /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ 11*946379e7Schristos #include "djpwd.h" 12*946379e7Schristos #include <unistd.h> 13*946379e7Schristos #include <stdlib.h> 14*946379e7Schristos #include <string.h> 15*946379e7Schristos 16*946379e7Schristos static char passwd[] = ""; 17*946379e7Schristos static char slash [] = "/"; 18*946379e7Schristos static char shell [] = "sh"; 19*946379e7Schristos 20*946379e7Schristos struct passwd * getpwnam(const char * name)21*946379e7Schristosgetpwnam(const char *name) 22*946379e7Schristos { 23*946379e7Schristos static struct passwd rv; 24*946379e7Schristos rv.pw_name = getlogin(); 25*946379e7Schristos if (strcmp(rv.pw_name, name) != 0) 26*946379e7Schristos return 0; 27*946379e7Schristos rv.pw_uid = getuid(); 28*946379e7Schristos rv.pw_gid = getgid(); 29*946379e7Schristos rv.pw_dir = getenv("HOME"); 30*946379e7Schristos if (rv.pw_dir == 0) 31*946379e7Schristos rv.pw_dir = slash; 32*946379e7Schristos rv.pw_shell = getenv("SHELL"); 33*946379e7Schristos if (rv.pw_shell == 0) 34*946379e7Schristos rv.pw_shell = getenv("COMSPEC"); 35*946379e7Schristos if (rv.pw_shell == 0) 36*946379e7Schristos rv.pw_shell = shell; 37*946379e7Schristos rv.pw_gecos = getlogin(); 38*946379e7Schristos rv.pw_passwd = passwd; 39*946379e7Schristos return &rv; 40*946379e7Schristos } 41