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) {
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();

View File

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

View File

@ -2,6 +2,10 @@
#define _WIN32_WINNT 0x0600 // vista+
#include <Windows.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#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) {