Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4972 → Rev 4973

/programs/develop/libraries/menuetlibc/src/libc/posix/pwd/Makefile
0,0 → 1,3
THIS_SRCS = getpwnam.c getpwuid.c pwent.c
 
include $(MENUET_LIBC_TOPDIR)/Make.rules
/programs/develop/libraries/menuetlibc/src/libc/posix/pwd/getpwnam.c
0,0 → 1,27
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <pwd.h>
#include <unistd.h>
#include <stdlib.h>
 
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;
return &rv;
}
/programs/develop/libraries/menuetlibc/src/libc/posix/pwd/getpwuid.c
0,0 → 1,27
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <pwd.h>
#include <unistd.h>
#include <stdlib.h>
 
static char slash[] = "/";
static char shell[] = "sh";
 
struct passwd *
getpwuid(uid_t uid)
{
static struct passwd rv;
rv.pw_uid = getuid();
if (uid != rv.pw_uid)
return 0;
rv.pw_name = getlogin();
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;
return &rv;
}
/programs/develop/libraries/menuetlibc/src/libc/posix/pwd/pwent.c
0,0 → 1,28
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <pwd.h>
#include <unistd.h>
 
static int count=0;
 
void
setpwent(void)
{
count=0;
}
 
struct passwd *
getpwent(void)
{
if (count == 0)
{
count++;
return getpwuid(getuid());
}
return 0;
}
 
void
endpwent(void)
{
count=0;
}