win32 prefix fix.

This commit is contained in:
Kelvin Sherlock 2018-08-23 15:27:23 -04:00
parent 7b66b3a070
commit 2b38b6bf8d
3 changed files with 21 additions and 15 deletions

View File

@ -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) { static int mli_set_mark(unsigned dcb, struct file_entry *file) {
off_t eof = 0;
word16 terr = 0; word16 terr = 0;
word32 position = get_memory24_c(dcb + 2, 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: default:
return invalidRefNum; return invalidRefNum;
case file_directory: case file_directory:
eof = file->eof;
break; break;
case file_regular: case file_regular:
terr = file_eof(file); terr = file_eof(file);
@ -1107,21 +1105,22 @@ static int mli_set_prefix(unsigned dcb, char *name, char *path) {
return saved_prefix ? -2 : -1; return saved_prefix ? -2 : -1;
} }
int l; unsigned type;
struct stat st; word16 terr;
if (stat(path, &st) < 0) type = host_storage_type(path, &terr);
return host_map_errno_path(errno, path); switch(type) {
case 0x0f:
if (!S_ISDIR(st.st_mode)) { case 0x0d:
return badStoreType; break;
case 0: return terr;
default: return badStoreType;
} }
/* /HOST/ was previously stripped... add it back. */ /* /HOST/ was previously stripped... add it back. */
name = host_gc_append_path("/HOST", name); name = host_gc_append_path("/HOST", name);
l = strlen(name); int l = strlen(name);
/* trim trailing / */ /* trim trailing / */
while (l > 1 && name[l-1] == '/') --l; while (l > 1 && name[l-1] == '/') --l;
name[l] = 0; name[l] = 0;
@ -1472,6 +1471,7 @@ void host_mli_head() {
} }
fputs("\n", stderr); fputs("\n", stderr);
fflush(stderr);
host_gc_free(); host_gc_free();

View File

@ -1,10 +1,12 @@
#define _BSD_SOURCE #define _BSD_SOURCE
#include <time.h>
#include <sys/time.h>
#include <dirent.h>
#include <ctype.h> #include <ctype.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#if defined(__APPLE__) #if defined(__APPLE__)
#include <sys/xattr.h> #include <sys/xattr.h>

View File

@ -2,6 +2,10 @@
#define _WIN32_WINNT 0x0600 // vista+ #define _WIN32_WINNT 0x0600 // vista+
#include <Windows.h> #include <Windows.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "defc.h" #include "defc.h"
#include "gsos.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) { 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) { unsigned host_scan_directory(const char *path, char ***out, size_t *entries, unsigned p8) {