GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
pwd-wrappers.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2023-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_pwd_wrappers_h)
27 #define octave_pwd_wrappers_h 1
28 
29 #include <sys/types.h>
30 
31 #if defined __cplusplus
32 extern "C" {
33 #endif
34 
35 struct passwd;
36 
37 // We can't include <pwd.h> without the risk of overwriting function names
38 // with preprocessor deinitions. Define a struct that can hold the needed
39 // fields, and use a function to convert from struct passwd to it.
41 {
42  char *pw_name;
43  char *pw_passwd;
44  uid_t pw_uid;
45  gid_t pw_gid;
46  char *pw_gecos;
47  char *pw_dir;
48  char *pw_shell;
49 };
50 
51 extern OCTAVE_API struct passwd *octave_getpwent_wrapper (void);
52 
53 extern OCTAVE_API struct passwd *octave_getpwuid_wrapper (uid_t uid);
54 
55 extern OCTAVE_API struct passwd *octave_getpwnam_wrapper (const char *nam);
56 
57 extern OCTAVE_API void octave_setpwent_wrapper (void);
58 
59 extern OCTAVE_API void octave_endpwent_wrapper (void);
60 
61 extern OCTAVE_API void octave_endpwent_wrapper (void);
62 
63 extern OCTAVE_API void
64 octave_from_passwd (const struct passwd *pw,
65  struct octave_passwd_wrapper *oct_pw);
66 
67 #if defined __cplusplus
68 }
69 #endif
70 
71 #endif
#define OCTAVE_API
Definition: main.cc:55
void octave_setpwent_wrapper(void)
Definition: pwd-wrappers.c:70
struct passwd * octave_getpwnam_wrapper(const char *nam)
Definition: pwd-wrappers.c:59
void octave_endpwent_wrapper(void)
Definition: pwd-wrappers.c:78
struct passwd * octave_getpwent_wrapper(void)
Definition: pwd-wrappers.c:39
struct passwd * octave_getpwuid_wrapper(uid_t uid)
Definition: pwd-wrappers.c:48
void octave_from_passwd(const struct passwd *pw, struct octave_passwd_wrapper *oct_pw)
Definition: pwd-wrappers.c:86