home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue6 / SDL.ZIP / !gcc / include / unixlib / h / pwd < prev    next >
Encoding:
Text File  |  2006-09-17  |  4.2 KB  |  154 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/pwd.h,v $
  4.  * $Date: 2004/10/17 16:24:43 $
  5.  * $Revision: 1.8 $
  6.  * $State: Exp $
  7.  * $Author: joty $
  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 <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. #if defined __USE_SVID || defined __USE_GNU
  28. #define __need_FILE
  29. #include <stdio.h>
  30. #endif
  31.  
  32. #if !defined __gid_t_defined
  33. typedef __gid_t gid_t;
  34. #define __gid_t_defined
  35. #endif
  36.  
  37. #if !defined __uid_t_defined
  38. typedef __uid_t uid_t;
  39. #define __uid_t_defined
  40. #endif
  41.  
  42. __BEGIN_DECLS
  43.  
  44. struct passwd
  45. {
  46.   char    *pw_name;  /* Username.  */
  47.   char    *pw_passwd;  /* Password.  */
  48.   __uid_t pw_uid;  /* User ID.  */
  49.   __gid_t pw_gid;  /* Group ID.  */
  50.   char    *pw_gecos;  /* Real name.  */
  51.   char    *pw_dir;  /* Home directory.  */
  52.   char    *pw_shell;  /* Shell program.  */
  53.  
  54. };
  55.  
  56. /* Search for an entry with a matching user ID.
  57.    This function is a cancellation point.  */
  58. extern struct passwd *getpwuid (__uid_t __uid) __wur;
  59.  
  60. /* Search for an entry with a matching username.
  61.    This function is a cancellation point.  */
  62. extern struct passwd *getpwnam (const char *__name) __nonnull ((1)) __wur;
  63.  
  64. #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN_EXTENDED
  65. /* System V functions.  */
  66.  
  67. /* Rewind the password-file stream.
  68.    This function is a cancellation point.  */
  69. extern void setpwent (void);
  70.  
  71. /* Close the password-file stream.
  72.    This function is a cancellation point.  */
  73. extern void endpwent (void);
  74.  
  75. /* Read an entry from the password-file stream, opening it if necessary.
  76.    This function is a cancellation point.  */
  77. extern struct passwd *getpwent (void) __wur;
  78. #endif
  79.  
  80. #ifdef  __USE_SVID
  81. /* Read an entry from stream.
  82.    This function is a cancellation point.  */
  83. extern struct passwd *fgetpwent (FILE *__stream) __nonnull ((1)) __wur;
  84.  
  85. extern int putpwent (const struct passwd *__restrict __p,
  86.              FILE *__restrict __stream) __nonnull ((1, 2)) __wur;
  87. #endif
  88.  
  89. #if defined __USE_POSIX || defined __USE_MISC
  90.  
  91. # if defined __USE_SVID || defined __USE_MISC
  92. /* Read an entry from the password-file stream, opening it if
  93.    necessary (re-entrant version).
  94.    This function is a cancellation point.  */
  95. extern int getpwent_r (struct passwd *__restrict __result_buf,
  96.                char *__restrict __buffer,
  97.                size_t __buflen,
  98.                struct passwd **__restrict __result)
  99.      __nonnull ((1, 2, 4));
  100. #endif
  101.  
  102. #ifdef __USE_SVID
  103. /* Read an entry from stream (re-entrant version).
  104.    This function is a cancellation point.  */
  105. extern int fgetpwent_r (FILE *__restrict __stream,
  106.             struct passwd *__restrict __result_buf,
  107.             char *__restrict __buffer,
  108.             size_t __buflen,
  109.             struct passwd **__restrict __result)
  110.      __nonnull ((1, 2, 3, 5));
  111. #endif
  112.  
  113. /* POSIX functions.  */
  114.  
  115. /* Search for an entry with a matching user ID (re-entrant version).
  116.    This function is a cancellation point.  */
  117. extern int getpwuid_r (__uid_t __uid,
  118.                struct passwd *__restrict __resbuf,
  119.                char *__restrict __buffer,
  120.                size_t __buflen,
  121.                struct passwd **__restrict __result)
  122.      __nonnull ((2, 3, 5));
  123.  
  124. /* Search for an entry with a matching username (re-entrant version).
  125.    This function is a cancellation point.  */
  126. extern int getpwnam_r (const char *__restrict __name,
  127.                struct passwd *__restrict __result_buf,
  128.                char *__restrict __buffer,
  129.                size_t __buflen,
  130.                struct passwd **__restrict __result)
  131.      __nonnull ((1, 2, 3, 5));
  132.  
  133. #endif /* POSIX || MISC */
  134.  
  135. #ifdef __USE_GNU
  136. /* Re-construct the password-file line for the given uid in the
  137.    given buffer.
  138.    This function is a cancellation point.  */
  139. extern int getpw (__uid_t __uid, char *__buf);
  140. #endif
  141.  
  142. #ifdef __UNIXLIB_INTERNALS
  143. /* UnixLib pwd implementation function.  */
  144. extern struct passwd *__pwdread (FILE *__stream, struct passwd *__ppwd,
  145.                  char *__buf, size_t __buflen);
  146.  
  147. /* Default values for passwd struct. */
  148. extern struct passwd *__pwddefault (void);
  149. #endif
  150.  
  151. __END_DECLS
  152.  
  153. #endif
  154.