1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-04-26 20:18:04 +00:00

SCP: Updated to current.

This commit is contained in:
Richard Cornwell
2020-12-22 20:38:45 -05:00
parent 7abc0c57f0
commit d132e80982
9 changed files with 412 additions and 342 deletions

View File

@@ -44,6 +44,7 @@
sim_fwrite - endian independent write (formerly fxwrite)
sim_fseek - conditionally extended (>32b) seek (
sim_fseeko - extended seek (>32b if available)
sim_can_seek - test for seekable (regular file)
sim_fsize - get file size
sim_fsize_name - get file size of named file
sim_fsize_ex - get file size as a t_offset
@@ -235,6 +236,16 @@ uint32 sim_fsize (FILE *fp)
return (uint32)(sim_fsize_ex (fp));
}
t_bool sim_can_seek (FILE *fp)
{
struct stat statb;
if ((0 != fstat (fileno (fp), &statb)) ||
(0 == (statb.st_mode & S_IFREG)))
return FALSE;
return TRUE;
}
/* OS-dependent routines */
/* Optimized file open */
@@ -557,7 +568,7 @@ if ((stbuf.st_mode & S_IFIFO)) {
return -1;
}
#if defined (__linux__) || defined (__APPLE__)
#if defined (__linux__) || defined (__APPLE__) || defined (__CYGWIN__) || defined (__FreeBSD__)
#include <sys/mman.h>
struct SHMEM {