grafthistory: support curl
[elinks/elinks-j605.git] / src / util / secsave.h
blob001c14605e3c651c992ee2a704d1bfca431111f8
1 /* Secure file saving handling */
3 #ifndef EL__UTIL_SECSAVE_H
4 #define EL__UTIL_SECSAVE_H
6 #include <stdio.h>
7 #include <sys/types.h> /* mode_t */
9 enum secsave_errno {
10 SS_ERR_NONE = 0,
11 SS_ERR_DISABLED, /* secsave is disabled. */
12 SS_ERR_OUT_OF_MEM, /* memory allocation failure */
14 /* see err field in struct secure_save_info */
15 SS_ERR_OPEN_READ,
16 SS_ERR_OPEN_WRITE,
17 SS_ERR_STAT,
18 SS_ERR_ACCESS,
19 SS_ERR_MKSTEMP,
20 SS_ERR_RENAME,
21 SS_ERR_OTHER,
24 extern enum secsave_errno secsave_errno; /* internal secsave error number */
26 struct secure_save_info {
27 FILE *fp; /* file stream pointer */
28 unsigned char *file_name; /* final file name */
29 unsigned char *tmp_file_name; /* temporary file name */
30 int err; /* set to non-zero value in case of error */
31 int secure_save; /* use secure save for this file */
34 struct secure_save_info *secure_open(unsigned char *);
36 int secure_close(struct secure_save_info *);
38 int secure_fputs(struct secure_save_info *, const char *);
39 int secure_fputc(struct secure_save_info *, int);
41 int secure_fprintf(struct secure_save_info *, const char *, ...);
43 #endif