1 /* utils.h: some useful helper functions 2 Copyright (c) 1999-2012 Philip Kendall 3 4 $Id: utils.h 4738 2012-10-03 13:15:31Z fredm $ 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License along 17 with this program; if not, write to the Free Software Foundation, Inc., 18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 20 Author contact information: 21 22 E-mail: philip-fuse@shadowmagic.org.uk 23 24 */ 25 26 #ifndef FUSE_UTILS_H 27 #define FUSE_UTILS_H 28 29 #include <libspectrum.h> 30 31 #include "compat.h" 32 33 typedef struct utils_file { 34 35 unsigned char *buffer; 36 size_t length; 37 38 } utils_file; 39 40 int utils_open_file( const char *filename, int autoload, 41 libspectrum_id_t *type ); 42 int utils_open_snap( void ); 43 int utils_read_auxiliary_file( const char *filename, utils_file *file, 44 utils_aux_type type ); 45 46 int utils_read_file( const char *filename, utils_file *file ); 47 int utils_read_fd( compat_fd fd, const char *filename, utils_file *file ); 48 void utils_close_file( utils_file *file ); 49 50 int utils_write_file( const char *filename, const unsigned char *buffer, 51 size_t length ); 52 int utils_make_temp_file( int *fd, char *tempfilename, const char *filename, 53 const char *template ); 54 55 int utils_find_file_path( const char *filename, char *path, 56 utils_aux_type type ); 57 58 int utils_read_screen( const char *filename, utils_file *screen ); 59 60 char* utils_safe_strdup( const char *src ); 61 62 void utils_networking_init( void ); 63 void utils_networking_end( void ); 64 65 #endif /* #ifndef FUSE_UTILS_H */ 66