pwdin/pwdin.h
2025-05-03 00:05:11 +02:00

26 lines
730 B
C

#include <stddef.h>
#include <stdio.h>
#define TAB 9
/**
* Reads password from stdin.
*
* @param mask Character used instead of typed character. (e.g. "*").
* If mask is 0 nothing will be printed.
* @param prompt Prompt to be printed before input.
* @param reveal_key ASCII key of key needed to reveal password in the terminal (e.g. 9 [TAB])
* @param write_zero Whether the unused part of the buffer should be zeroed upon return.
* @param _buffer Pointer to buffer where char array get's copied to.
* @param fd Out stream.
*
* @return Length of the password
*/
size_t pwdin_getpass(const char* prompt,
char mask,
char reveal_key,
int write_zero,
char* _buffer,
size_t _buffer_size);