source: MondoRescue/branches/2.2.9/mindi-busybox/libpwdgrp/pwd_grp_internal.c@ 2725

Last change on this file since 2725 was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File size: 1.5 KB
RevLine 
[1765]1/* vi: set sw=4 ts=4: */
[2725]2/* Copyright (C) 2003 Manuel Novoa III
[821]3 *
[2725]4 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
[821]5 */
6
[2725]7/* Nov 6, 2003 Initial version.
[821]8 *
[2725]9 * NOTE: This implementation is quite strict about requiring all
[821]10 * field seperators. It also does not allow leading whitespace
11 * except when processing the numeric fields. glibc is more
12 * lenient. See the various glibc difference comments below.
13 *
[2725]14 * TODO:
[821]15 * Move to dynamic allocation of (currently statically allocated)
16 * buffers; especially for the group-related functions since
17 * large group member lists will cause error returns.
18 */
19
20#ifndef GETXXKEY_R_FUNC
21#error GETXXKEY_R_FUNC is not defined!
22#endif
23
[1765]24int GETXXKEY_R_FUNC(GETXXKEY_R_KEYTYPE key,
25 GETXXKEY_R_ENTTYPE *__restrict resultbuf,
26 char *__restrict buffer, size_t buflen,
27 GETXXKEY_R_ENTTYPE **__restrict result)
[821]28{
29 FILE *stream;
30 int rv;
31
32 *result = NULL;
33
[2725]34 stream = fopen_for_read(GETXXKEY_R_PATHNAME);
[1765]35 if (!stream)
36 return errno;
37 while (1) {
38 rv = bb__pgsreader(GETXXKEY_R_PARSER, resultbuf, buffer, buflen, stream);
39 if (!rv) {
[2725]40 if (GETXXKEY_R_TEST(resultbuf)) { /* found key? */
[1765]41 *result = resultbuf;
[821]42 break;
43 }
[1765]44 } else {
[2725]45 if (rv == ENOENT) { /* EOF encountered */
[1765]46 rv = 0;
47 }
48 break;
49 }
[821]50 }
[1765]51 fclose(stream);
[821]52
53 return rv;
54}
55
56#undef GETXXKEY_R_FUNC
57#undef GETXXKEY_R_PARSER
58#undef GETXXKEY_R_ENTTYPE
59#undef GETXXKEY_R_TEST
[1765]60#undef GETXXKEY_R_KEYTYPE
61#undef GETXXKEY_R_PATHNAME
Note: See TracBrowser for help on using the repository browser.