diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-07-31 20:16:25 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-07-31 20:16:25 +0200 |
commit | 261e3190929acd3e8e00507894789a5575fb815f (patch) | |
tree | 8d877d68090967ed4231c457dabed6d64d8bc002 /sys/src/cmd/auth/lib/answer.c | |
parent | a75f4de5c9f1782b3a7e0a9648e24b360031a0d5 (diff) |
auth: various cleanups, use common readcons() from libauthsrv, zero keys after use
Diffstat (limited to 'sys/src/cmd/auth/lib/answer.c')
-rw-r--r-- | sys/src/cmd/auth/lib/answer.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/src/cmd/auth/lib/answer.c b/sys/src/cmd/auth/lib/answer.c new file mode 100644 index 000000000..856923e43 --- /dev/null +++ b/sys/src/cmd/auth/lib/answer.c @@ -0,0 +1,18 @@ +#include <u.h> +#include <libc.h> +#include <bio.h> +#include <authsrv.h> +#include "authcmdlib.h" + +int +answer(char *q) +{ + char pr[128]; + int y; + + snprint(pr, sizeof(pr), "%s [y/n]", q); + q = readcons(pr, nil, 0); + y = q != nil && (*q == 'y' || *q == 'Y'); + free(q); + return y; +} |