udev_libc_wrapper.c revision 1aa1e24848903d11780db1ade355be73ad61a937
/*
* udev_libc_wrapper - wrapping of functions missing in a specific libc
* or not working in a statically compiled binary
*
* Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
* Copyright (C) 2005 Kay Sievers <kay@vrfy.org>
*
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include "udev.h"
#ifdef __KLIBC__
#define __OWN_USERDB_PARSER__
#endif
#ifdef __GLIBC__
#define __OWN_STRLCPYCAT__
#endif
#ifdef USE_STATIC
#define __OWN_USERDB_PARSER__
#endif
#ifdef __OWN_STRLCPYCAT__
{
char *q = dst;
const char *p = src;
char ch;
while ((ch = *p++)) {
*q++ = ch;
bytes++;
}
/* If size == 0 there is no space for a final null... */
if (size)
*q = '\0';
return bytes;
}
{
char *q = dst;
const char *p = src;
char ch;
q++;
bytes++;
}
while ((ch = *p++)) {
*q++ = ch;
bytes++;
}
*q = '\0';
return bytes;
}
#endif /* __OWN_STRLCPYCAT__ */
#ifndef __OWN_USERDB_PARSER__
#include <pwd.h>
#include <grp.h>
{
else
return uid;
}
{
else
return gid;
}
#else /* __OWN_USERDB_PARSER__ */
#define PASSWD_FILE "/etc/passwd"
#define GROUP_FILE "/etc/group"
/* return the id of a passwd style line, selected by the users name */
{
unsigned long id = 0;
char *buf;
char *bufline;
char *pos;
char *name;
char *idstr;
char *tail;
return 0;
}
/* loop through the whole file */
cur = 0;
continue;
/* get name */
continue;
/* skip pass */
continue;
/* get id */
continue;
if (tail[0] != '\0') {
id = 0;
} else
break;
}
}
return id;
}
{
unsigned long id;
}
{
unsigned long id;
}
#endif /* __OWN_USERDB_PARSER__ */