1 /* Part of publib. 2 3 Copyright (c) 1994-2006 Lars Wirzenius. All rights reserved. 4 5 Redistribution and use in source and binary forms, with or without 6 modification, are permitted provided that the following conditions 7 are met: 8 9 1. Redistributions of source code must retain the above copyright 10 notice, this list of conditions and the following disclaimer. 11 12 2. Redistributions in binary form must reproduce the above 13 copyright notice, this list of conditions and the following 14 disclaimer in the documentation and/or other materials provided 15 with the distribution. 16 17 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 18 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 /* 30 * files.h -- utility functions for files 31 * 32 * Part of publib. 33 * "@(#)publib-files:$Id: files.h,v 1.2 1996/11/05 21:15:47 liw Exp $" 34 */ 35 36 #ifndef __publib_files_h 37 #define __publib_files_h 38 39 #include <stdio.h> /* need FILE, size_t */ 40 41 FILE *xfopen(const char *__filename, const char *__mode); 42 void xfclose(FILE *__fp); 43 void xfseek(FILE *__fp, long __offset, int __origin); 44 45 char *getaline(FILE *__fp); 46 char *xgetaline(FILE *__fp); 47 48 void fassert(FILE *__fp); 49 50 51 int file_read(const char *, void **, size_t *); 52 int file_read_open(FILE *, void **, size_t *); 53 int file_save(const char *, void *, size_t, int); 54 int file_write(const char *, void *, size_t); 55 56 #if 0 57 58 /**/int copy_file(const char *__oldname, const char *__newname); 59 /**/int fcopy_file(FILE *__oldfile, FILE *__newfile); 60 61 /**/int move_file(const char *__oldname, const char *__newname); 62 /**/int fmove_file(FILE *__oldfile, FILE *__newfile); 63 64 /**/char *make_backup_file(const char *__fname); 65 66 /**/int eprintf(const char *, ...); 67 /**/int eprintf_register(void); 68 69 /**/int snprintf(char *, size_t, const char *, ...); 70 71 #endif 72 73 #endif 74