From 294b585994da4427ac98a8353ff41aed5f301d54 Mon Sep 17 00:00:00 2001 From: pk33 Date: Fri, 1 Nov 2024 23:51:15 +0100 Subject: Import and fix old code --- include/musl/pwd.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 include/musl/pwd.h (limited to 'include/musl/pwd.h') diff --git a/include/musl/pwd.h b/include/musl/pwd.h new file mode 100644 index 0000000..4f470b5 --- /dev/null +++ b/include/musl/pwd.h @@ -0,0 +1,50 @@ +#ifndef _PWD_H +#define _PWD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t +#define __NEED_uid_t +#define __NEED_gid_t + +#ifdef _GNU_SOURCE +#define __NEED_FILE +#endif + +#include + +struct passwd { + char *pw_name; + char *pw_passwd; + uid_t pw_uid; + gid_t pw_gid; + char *pw_gecos; + char *pw_dir; + char *pw_shell; +}; + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void setpwent (void); +void endpwent (void); +struct passwd *getpwent (void); +#endif + +struct passwd *getpwuid (uid_t); +struct passwd *getpwnam (const char *); +int getpwuid_r (uid_t, struct passwd *, char *, size_t, struct passwd **); +int getpwnam_r (const char *, struct passwd *, char *, size_t, struct passwd **); + +#ifdef _GNU_SOURCE +struct passwd *fgetpwent(FILE *); +int putpwent(const struct passwd *, FILE *); +#endif + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3