SCP: Add sim_dir_scan API for general use.

This commit is contained in:
Mark Pizzolato 2018-05-09 13:52:52 -07:00
parent 5ee2944f40
commit b781834f31
2 changed files with 11 additions and 2 deletions

4
scp.c
View file

@ -5786,7 +5786,7 @@ typedef void (*DIR_ENTRY_CALLBACK)(const char *directory,
#if defined (_WIN32)
static t_stat sim_dir_scan (const char *cptr, DIR_ENTRY_CALLBACK entry, void *context)
t_stat sim_dir_scan (const char *cptr, DIR_ENTRY_CALLBACK entry, void *context)
{
HANDLE hFind;
WIN32_FIND_DATAA File;
@ -5841,7 +5841,7 @@ return SCPE_OK;
#endif
#endif /* defined (HAVE_GLOB) */
static t_stat sim_dir_scan (const char *cptr, DIR_ENTRY_CALLBACK entry, void *context)
t_stat sim_dir_scan (const char *cptr, DIR_ENTRY_CALLBACK entry, void *context)
{
#if defined (HAVE_GLOB)
glob_t paths;

9
scp.h
View file

@ -37,6 +37,9 @@
#ifndef SIM_SCP_H_
#define SIM_SCP_H_ 0
#include "sim_fio.h"
#include <sys/stat.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -227,6 +230,12 @@ size_t sim_strlcpy (char *dst, const char *src, size_t size);
#ifndef strcasecmp
#define strcasecmp(str1, str2) sim_strcasecmp ((str1), (str2))
#endif
typedef void (*DIR_ENTRY_CALLBACK)(const char *directory,
const char *filename,
t_offset FileSize,
const struct stat *filestat,
void *context);
t_stat sim_dir_scan (const char *cptr, DIR_ENTRY_CALLBACK entry, void *context);
CONST char *get_sim_opt (int32 opt, CONST char *cptr, t_stat *st);
CONST char *get_sim_sw (CONST char *cptr);
const char *put_switches (char *buf, size_t bufsize, uint32 sw);