51 broke -E logic completely, rewise it
[tfcrypt.git] / getpasswd.h
1 /*
2  * tfcrypt -- high security Threefish encryption tool.
3  *
4  * tfcrypt is copyrighted:
5  * Copyright (C) 2012-2019 Andrey Rys. All rights reserved.
6  *
7  * tfcrypt is licensed to you under the terms of std. MIT/X11 license:
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27  */
28
29 #ifndef _GETPASSWD_H
30 #define _GETPASSWD_H
31
32 #define GETP_NOECHO 1
33 #define GETP_NOINTERP 2
34 #define GETP_WAITFILL 4
35
36 struct getpasswd_state;
37 struct termios;
38
39 typedef int (*getpasswd_filt)(struct getpasswd_state *, char, size_t);
40
41 struct getpasswd_state {
42         char *passwd;
43         size_t pwlen;
44         const char *echo;
45         char maskchar;
46         getpasswd_filt charfilter;
47         int fd;
48         int efd;
49         int error;
50         struct termios *sanetty;
51         int flags;
52         size_t retn;
53 };
54
55 size_t xgetpasswd(struct getpasswd_state *getps);
56
57 #endif