From 0cc9b20c15460213e488bf5e70963b941482f628 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Tue, 14 Jan 2025 16:06:02 -0600 Subject: Add source. --- sdk/other/files.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sdk/other/files.h (limited to 'sdk/other/files.h') diff --git a/sdk/other/files.h b/sdk/other/files.h new file mode 100644 index 0000000..7e9f421 --- /dev/null +++ b/sdk/other/files.h @@ -0,0 +1,52 @@ +/* + * Portable support for file manipulation and access related functions. + * $Id$ + * Copyright (c) 1997 by Tycho Softworks. + * For conditions of distribution and reuse see product license. + */ + +#ifndef __OTHER_FILES_H__ +#define __OTHER_FILES_H__ + +#ifndef __STD_FILES_H__ +#include +#endif + +#define isdir(fpath) isftype(fpath, S_IFDIR) +#define isfile(fpath) isftype(fpath, S_IFREG) +#define islink(fpath) isftype(fpath, S_IFLNK) +#define isfifo(fpath) isftype(fpath, S_IFIFO) +#define pathfname(fn) basename(fn) +#define rewind(fd) lseek(fd, (off_t)0, SEEK_SET) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __NAMESPACE +#define isnewfile __NAMESPACE(isnewfile) +#define isftype __NAMESPACE(isftype) +#define ispath __NAMESPACE(ispath) +#define isroot __NAMESPACE(isroot) +#define fncat __NAMESPACE(fncat) +#define search __NAMESPACE(search) +#define basename __NAMESPACE(basename) +#define dirname __NAMESPACE(dirname) +#define extfname __NAMESPACE(extfname) +#endif + +bool isnewfile(const char *from, const char *to); +bool isftype(const char *fpath, int ftype); +bool ispath(const char *fpath); +bool isroot(const char *fpath); +char *fncat(char *prefix, const char *suffix); +char *search(const char *path, const char *fname); +char *basename(const char *path); +char *dirname(char *path); +char *extfname(const char *path); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3-54-g00ecf