home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !unixlib / source / clib / h / pwd < prev    next >
Encoding:
Text File  |  2004-09-05  |  3.3 KB  |  120 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/pwd.h,v $
  4.  * $Date: 2004/04/12 13:03:37 $
  5.  * $Revision: 1.7 $
  6.  * $State: Exp $
  7.  * $Author: nick $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. /* POSIX Standard 9.2.2 User Database Access <pwd.h>.  */
  12.  
  13. #ifndef __PWD_H
  14. #define __PWD_H 1
  15.  
  16. #ifndef __UNIXLIB_FEATURES
  17. #include <unixlib/features.h>
  18. #endif
  19.  
  20. #ifndef __UNIXLIB_TYPES_H
  21. #include <unixlib/types.h>
  22. #endif
  23.  
  24. #define __need_size_t
  25. #include <stddef.h>
  26.  
  27. #define __need_FILE
  28. #include <stdio.h>
  29.  
  30. #if !defined __gid_t_defined
  31. typedef __gid_t gid_t;
  32. #define __gid_t_defined
  33. #endif
  34.  
  35. #if !defined __uid_t_defined
  36. typedef __uid_t uid_t;
  37. #define __uid_t_defined
  38. #endif
  39.  
  40. __BEGIN_DECLS
  41.  
  42. struct passwd
  43. {
  44.   char    *pw_name;  /* Username.  */
  45.   char    *pw_passwd;  /* Password.  */
  46.   __uid_t pw_uid;  /* User ID.  */
  47.   __gid_t pw_gid;  /* Group ID.  */
  48.   char    *pw_gecos;  /* Real name.  */
  49.   char    *pw_dir;  /* Home directory.  */
  50.   char    *pw_shell;  /* Shell program.  */
  51.  
  52. };
  53.  
  54. /* System V functions.  */
  55.  
  56. /* Rewind the password-file stream.  */
  57. extern void setpwent (void) __THROW;
  58.  
  59. /* Close the password-file stream.  */
  60. extern void endpwent (void) __THROW;
  61.  
  62. /* Read an entry from the password-file stream, opening it if necessary.  */
  63. extern struct passwd *getpwent (void) __THROW;
  64.  
  65. /* Read an entry from the password-file stream, opening it if
  66.    necessary (re-entrant version).  */
  67. extern int getpwent_r (struct passwd *__restrict __result_buf,
  68.                char *__restrict __buffer, size_t __buflen,
  69.                struct passwd **__restrict __result) __THROW;
  70.  
  71. /* Read an entry from stream.  */
  72. extern struct passwd *fgetpwent (FILE *__stream) __THROW;
  73.  
  74. /* Read an entry from stream (re-entrant version).  */
  75. extern int fgetpwent_r (FILE *__restrict __stream,
  76.             struct passwd *__restrict __result_buf,
  77.             char *__restrict __buffer, size_t __buflen,
  78.             struct passwd **__restrict __result) __THROW;
  79.  
  80. extern int putpwent (const struct passwd *__restrict __p,
  81.              FILE *__restrict __stream) __THROW;
  82.  
  83. /* POSIX functions.  */
  84.  
  85. /* Search for an entry with a matching user ID.  */
  86. extern struct passwd *getpwuid (__uid_t __uid) __THROW;
  87.  
  88. /* Search for an entry with a matching user ID (re-entrant version).  */
  89. extern int getpwuid_r (__uid_t __uid, struct passwd *__restrict __resbuf,
  90.                char *__restrict __buffer,
  91.                size_t __buflen,
  92.                struct passwd **__restrict __result) __THROW;
  93.  
  94. /* Search for an entry with a matching username.  */
  95. extern struct passwd *getpwnam (const char *__name) __THROW;
  96.  
  97. /* Search for an entry with a matching username (re-entrant version).  */
  98. extern int getpwnam_r (const char *__restrict __name,
  99.                struct passwd *__restrict __result_buf,
  100.                char *__restrict __buffer, size_t __buflen,
  101.                struct passwd **__restrict __result) __THROW;
  102.  
  103.  
  104. /* Re-construct the password-file line for the given uid in the
  105.    given buffer.  */
  106. extern int getpw (__uid_t __uid, char *__buf) __THROW;
  107.  
  108. #ifdef __UNIXLIB_INTERNALS
  109. /* UnixLib pwd implementation function.  */
  110. extern struct passwd *__pwdread (FILE *__stream, struct passwd *__ppwd,
  111.                  char *__buf, size_t __buflen);
  112.  
  113. /* Default values for passwd struct. */
  114. extern struct passwd *__pwddefault (void);
  115. #endif
  116.  
  117. __END_DECLS
  118.  
  119. #endif
  120.