diff --git a/src/host_mli.c b/src/host_mli.c index 6cc1119..28cce65 100644 --- a/src/host_mli.c +++ b/src/host_mli.c @@ -924,7 +924,6 @@ static int mli_get_mark(unsigned dcb, struct file_entry *file) { static int mli_set_mark(unsigned dcb, struct file_entry *file) { - off_t eof = 0; word16 terr = 0; word32 position = get_memory24_c(dcb + 2, 0); @@ -933,7 +932,6 @@ static int mli_set_mark(unsigned dcb, struct file_entry *file) { default: return invalidRefNum; case file_directory: - eof = file->eof; break; case file_regular: terr = file_eof(file); @@ -1107,21 +1105,22 @@ static int mli_set_prefix(unsigned dcb, char *name, char *path) { return saved_prefix ? -2 : -1; } - int l; - struct stat st; + unsigned type; + word16 terr; - if (stat(path, &st) < 0) - return host_map_errno_path(errno, path); - - if (!S_ISDIR(st.st_mode)) { - return badStoreType; + type = host_storage_type(path, &terr); + switch(type) { + case 0x0f: + case 0x0d: + break; + case 0: return terr; + default: return badStoreType; } - /* /HOST/ was previously stripped... add it back. */ name = host_gc_append_path("/HOST", name); - l = strlen(name); + int l = strlen(name); /* trim trailing / */ while (l > 1 && name[l-1] == '/') --l; name[l] = 0; @@ -1472,6 +1471,7 @@ void host_mli_head() { } fputs("\n", stderr); + fflush(stderr); host_gc_free(); diff --git a/src/unix_host_common.c b/src/unix_host_common.c index 84295d7..0df5b91 100644 --- a/src/unix_host_common.c +++ b/src/unix_host_common.c @@ -1,10 +1,12 @@ #define _BSD_SOURCE -#include -#include -#include #include +#include +#include +#include +#include +#include #if defined(__APPLE__) #include diff --git a/src/win32_host_common.c b/src/win32_host_common.c index 6eb39d4..1b3e016 100644 --- a/src/win32_host_common.c +++ b/src/win32_host_common.c @@ -2,6 +2,10 @@ #define _WIN32_WINNT 0x0600 // vista+ #include +#include +#include +#include + #include "defc.h" #include "gsos.h" @@ -530,7 +534,7 @@ word32 host_set_file_info(const char *path, struct file_info *fi) { static int qsort_callback(const void *a, const void *b) { - return stricmp(*(const char **)a, *(const char **)b); + return strcasecmp(*(const char **)a, *(const char **)b); } unsigned host_scan_directory(const char *path, char ***out, size_t *entries, unsigned p8) {