Blame djgpp/getpwnam.c

Packit Bot 06c835
/*
Packit Bot 06c835
   libc of DJGPP 2.03 does not offer a pw_gecos entry,
Packit Bot 06c835
   so this version from DJGPP 2.04 CVS tree is supplied.
Packit Bot 06c835
   This file will become superflous and will be removed
Packit Bot 06c835
   from the  distribution as soon as DJGPP 2.04 has been
Packit Bot 06c835
   released.
Packit Bot 06c835
*/
Packit Bot 06c835
Packit Bot 06c835
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
Packit Bot 06c835
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
Packit Bot 06c835
#include "djpwd.h"
Packit Bot 06c835
#include <unistd.h>
Packit Bot 06c835
#include <stdlib.h>
Packit Bot 06c835
#include <string.h>
Packit Bot 06c835
Packit Bot 06c835
static char passwd[] = "";
Packit Bot 06c835
static char slash [] = "/";
Packit Bot 06c835
static char shell [] = "sh";
Packit Bot 06c835
Packit Bot 06c835
struct passwd *
Packit Bot 06c835
getpwnam(const char *name)
Packit Bot 06c835
{
Packit Bot 06c835
  static struct passwd rv;
Packit Bot 06c835
  rv.pw_name = getlogin();
Packit Bot 06c835
  if (strcmp(rv.pw_name, name) != 0)
Packit Bot 06c835
    return 0;
Packit Bot 06c835
  rv.pw_uid = getuid();
Packit Bot 06c835
  rv.pw_gid = getgid();
Packit Bot 06c835
  rv.pw_dir = getenv("HOME");
Packit Bot 06c835
  if (rv.pw_dir == 0)
Packit Bot 06c835
    rv.pw_dir = slash;
Packit Bot 06c835
  rv.pw_shell = getenv("SHELL");
Packit Bot 06c835
  if (rv.pw_shell == 0)
Packit Bot 06c835
    rv.pw_shell = getenv("COMSPEC");
Packit Bot 06c835
  if (rv.pw_shell == 0)
Packit Bot 06c835
    rv.pw_shell = shell;
Packit Bot 06c835
  rv.pw_gecos = getlogin();
Packit Bot 06c835
  rv.pw_passwd = passwd;
Packit Bot 06c835
  return &rv;
Packit Bot 06c835
}