Retry only for https protocol
[elinks.git] / src / util / secsave.h
blobe1e38305c295f1782cdd11613e8cf4f8b7b836e0
1 /** Secure file saving handling
2 * @file */
4 #ifndef EL__UTIL_SECSAVE_H
5 #define EL__UTIL_SECSAVE_H
7 #include <stdio.h>
8 #include <sys/types.h> /* mode_t */
10 struct terminal;
12 enum secsave_errno {
13 SS_ERR_NONE = 0,
14 SS_ERR_DISABLED, /**< secsave is disabled. */
15 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
17 /* see err field in struct secure_save_info */
18 SS_ERR_OPEN_READ,
19 SS_ERR_OPEN_WRITE,
20 SS_ERR_STAT,
21 SS_ERR_ACCESS,
22 SS_ERR_MKSTEMP,
23 SS_ERR_RENAME,
24 SS_ERR_OTHER,
27 extern enum secsave_errno secsave_errno; /**< internal secsave error number */
29 struct secure_save_info {
30 FILE *fp; /**< file stream pointer */
31 unsigned char *file_name; /**< final file name */
32 unsigned char *tmp_file_name; /**< temporary file name */
33 int err; /**< set to non-zero value in case of error */
34 int secure_save; /**< use secure save for this file */
37 struct secure_save_info *secure_open(unsigned char *);
39 int secure_close(struct secure_save_info *);
41 int secure_fputs(struct secure_save_info *, const char *);
42 int secure_fputc(struct secure_save_info *, int);
44 int secure_fprintf(struct secure_save_info *, const char *, ...);
46 unsigned char *secsave_strerror(enum secsave_errno, struct terminal *);
48 #endif