1/* $NetBSD: edit_file.h,v 1.3 2020/03/18 19:05:21 christos Exp $ */ 2 3#ifndef _EDIT_FILE_H_INCLUDED_ 4#define _EDIT_FILE_H_INCLUDED_ 5 6/*++ 7/* NAME 8/* edit_file 3h 9/* SUMMARY 10/* simple cooperative file updating protocol 11/* SYNOPSIS 12/* #include <edit_file.h> 13/* DESCRIPTION 14/* .nf 15 16 /* 17 * Utility library. 18 */ 19#include <vstream.h> 20 21 /* 22 * External interface. 23 */ 24typedef struct { 25 /* Private. */ 26 char *final_path; 27 mode_t final_mode; 28 /* Public. */ 29 char *tmp_path; 30 VSTREAM *tmp_fp; 31} EDIT_FILE; 32 33#define EDIT_FILE_SUFFIX ".tmp" 34 35extern EDIT_FILE *edit_file_open(const char *, int, mode_t); 36extern int WARN_UNUSED_RESULT edit_file_close(EDIT_FILE *); 37extern void edit_file_cleanup(EDIT_FILE *); 38 39/* LICENSE 40/* .ad 41/* .fi 42/* The Secure Mailer license must be distributed with this software. 43/* AUTHOR(S) 44/* Wietse Venema 45/* IBM T.J. Watson Research 46/* P.O. Box 704 47/* Yorktown Heights, NY 10598, USA 48/* 49/* Wietse Venema 50/* Google, Inc. 51/* 111 8th Avenue 52/* New York, NY 10011, USA 53/*--*/ 54 55#endif 56