Skip to content

Commit d9a9ed1

Browse files
lib/agetpass.*: agetpass(), agetpass_stdin(): Re-implement as macros
Signed-off-by: Alejandro Colomar <[email protected]>
1 parent 5dad607 commit d9a9ed1

File tree

2 files changed

+8
-27
lines changed

2 files changed

+8
-27
lines changed

lib/agetpass.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/*
2-
* SPDX-FileCopyrightText: 2022-2023, Alejandro Colomar <[email protected]>
3-
* SPDX-License-Identifier: BSD-3-Clause
4-
*/
1+
// SPDX-FileCopyrightText: 2022-2025, Alejandro Colomar <[email protected]>
2+
// SPDX-License-Identifier: BSD-3-Clause
53

64

75
#include <config.h>
@@ -10,7 +8,4 @@
108

119

1210
extern inline void erase_pass(char *pass);
13-
extern inline char *agetpass(const char *prompt);
14-
extern inline char *agetpass_stdin();
15-
1611
extern inline char *agetpass_internal(const char *prompt, int flags);

lib/agetpass.h

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
/*
2-
* SPDX-FileCopyrightText: 2022, Alejandro Colomar <[email protected]>
3-
*
4-
* SPDX-License-Identifier: BSD-3-Clause
5-
*/
1+
// SPDX-FileCopyrightText: 2022-2025, Alejandro Colomar <[email protected]>
2+
// SPDX-License-Identifier: BSD-3-Clause
63

74

85
#ifndef SHADOW_INCLUDE_LIB_AGETPASS_H_
@@ -24,12 +21,12 @@
2421
#endif /* WITH_LIBBSD */
2522

2623

27-
inline void erase_pass(char *pass);
28-
2924
// Similar to getpass(3), but free of its problems.
30-
inline char *agetpass(const char *prompt);
31-
inline char *agetpass_stdin();
25+
#define agetpass(prompt) agetpass_internal(prompt, RPP_REQUIRE_TTY)
26+
#define agetpass_stdin() agetpass_internal(NULL, RPP_STDIN)
27+
3228

29+
inline void erase_pass(char *pass);
3330
ATTR_MALLOC(erase_pass)
3431
inline char *agetpass_internal(const char *prompt, int flags);
3532

@@ -68,17 +65,6 @@ agetpass_internal(const char *prompt, int flags)
6865
return NULL;
6966
}
7067

71-
inline char *
72-
agetpass(const char *prompt)
73-
{
74-
return agetpass_internal(prompt, RPP_REQUIRE_TTY);
75-
}
76-
77-
inline char *
78-
agetpass_stdin()
79-
{
80-
return agetpass_internal(NULL, RPP_STDIN);
81-
}
8268

8369
inline void
8470
erase_pass(char *pass)

0 commit comments

Comments
 (0)