3
0

pwd_.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* vi: set sw=4 ts=4: */
  2. /* Copyright (C) 1991,92,95,96,97,98,99,2001 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. /*
  17. * POSIX Standard: 9.2.2 User Database Access <pwd.h>
  18. */
  19. #if !defined CONFIG_USE_BB_PWD_GRP
  20. #include <pwd.h>
  21. #else
  22. #ifndef _PWD_H
  23. #define _PWD_H 1
  24. #include <sys/types.h>
  25. #include <features.h>
  26. #include <stdio.h>
  27. /* The passwd structure. */
  28. struct passwd
  29. {
  30. char *pw_name; /* Username. */
  31. char *pw_passwd; /* Password. */
  32. uid_t pw_uid; /* User ID. */
  33. gid_t pw_gid; /* Group ID. */
  34. char *pw_gecos; /* Real name. */
  35. char *pw_dir; /* Home directory. */
  36. char *pw_shell; /* Shell program. */
  37. };
  38. /* Rewind the password-file stream. */
  39. extern void setpwent (void);
  40. /* Close the password-file stream. */
  41. extern void endpwent (void);
  42. /* Read an entry from the password-file stream, opening it if necessary. */
  43. extern struct passwd *getpwent (void);
  44. /* Read an entry from STREAM. */
  45. extern struct passwd *fgetpwent (FILE *__stream);
  46. /* Write the given entry onto the given stream. */
  47. extern int putpwent (__const struct passwd *__restrict __p,
  48. FILE *__restrict __f);
  49. /* Search for an entry with a matching user ID. */
  50. extern struct passwd *getpwuid (uid_t __uid);
  51. /* Search for an entry with a matching username. */
  52. extern struct passwd *getpwnam (__const char *__name);
  53. /* Reentrant versions of some of the functions above.
  54. PLEASE NOTE: the `getpwent_r' function is not (yet) standardized.
  55. The interface may change in later versions of this library. But
  56. the interface is designed following the principals used for the
  57. other reentrant functions so the chances are good this is what the
  58. POSIX people would choose. */
  59. extern int getpwent_r (struct passwd *__restrict __resultbuf,
  60. char *__restrict __buffer, size_t __buflen,
  61. struct passwd **__restrict __result);
  62. extern int getpwuid_r (uid_t __uid,
  63. struct passwd *__restrict __resultbuf,
  64. char *__restrict __buffer, size_t __buflen,
  65. struct passwd **__restrict __result);
  66. extern int getpwnam_r (__const char *__restrict __name,
  67. struct passwd *__restrict __resultbuf,
  68. char *__restrict __buffer, size_t __buflen,
  69. struct passwd **__restrict __result);
  70. /* Read an entry from STREAM. This function is not standardized and
  71. probably never will. */
  72. extern int fgetpwent_r (FILE *__restrict __stream,
  73. struct passwd *__restrict __resultbuf,
  74. char *__restrict __buffer, size_t __buflen,
  75. struct passwd **__restrict __result);
  76. /* Re-construct the password-file line for the given uid
  77. in the given buffer. This knows the format that the caller
  78. will expect, but this need not be the format of the password file. */
  79. extern int getpw (uid_t __uid, char *__buffer);
  80. #endif /* pwd.h */
  81. #endif