1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 22:28:06 +11:00

Make tools/emul *BSD-friendly

This commit is contained in:
Virgil Dupras 2019-07-11 21:21:54 -04:00
parent 8cc5bbb110
commit 252d71f1b8
4 changed files with 10 additions and 9 deletions

View File

@ -1,8 +1,8 @@
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <dirent.h> #include <dirent.h>
#include <string.h> #include <string.h>
#include <fnmatch.h> #include <fnmatch.h>
#include <libgen.h>
#include <sys/stat.h> #include <sys/stat.h>
#define BLKSIZE 0x100 #define BLKSIZE 0x100
@ -106,7 +106,7 @@ int spitdir(char *path, char *prefix, char *pattern)
} }
} else { } else {
if (pattern) { if (pattern) {
if (fnmatch(pattern, ep->d_name, FNM_EXTMATCH) != 0) { if (fnmatch(pattern, ep->d_name, 0) != 0) {
continue; continue;
} }
} }

View File

@ -26,11 +26,11 @@ $(TARGETS):
$(CC) $< libz80/libz80.o -o $@ $(CC) $< libz80/libz80.o -o $@
libz80/libz80.o: libz80/z80.c libz80/libz80.o: libz80/z80.c
make -C libz80/codegen opcodes $(MAKE) -C libz80/codegen opcodes
$(CC) -Wall -ansi -g -c -o libz80/libz80.o libz80/z80.c $(CC) -Wall -ansi -g -c -o libz80/libz80.o libz80/z80.c
$(CFSPACK): $(CFSPACK):
make -C ../cfspack $(MAKE) -C ../cfspack
$(SHELLAPPS): $(ZASMBIN) $(SHELLAPPS): $(ZASMBIN)
$(ZASMSH) $(KERNEL) $(APPS) shell/user.h < $(APPS)/$(notdir $@)/glue.asm > $@ $(ZASMSH) $(KERNEL) $(APPS) shell/user.h < $(APPS)/$(notdir $@)/glue.asm > $@

View File

@ -52,11 +52,11 @@ static uint8_t io_read(int unused, uint16_t addr)
{ {
addr &= 0xff; addr &= 0xff;
if (addr == STDIO_PORT) { if (addr == STDIO_PORT) {
uint8_t c = getchar(); int c = getchar();
if (c == EOF) { if (c == EOF) {
running = 0; running = 0;
} }
return c; return (uint8_t)c;
} else if (addr == FS_DATA_PORT) { } else if (addr == FS_DATA_PORT) {
if (fsdev_addr_lvl != 0) { if (fsdev_addr_lvl != 0) {
fprintf(stderr, "Reading FSDEV in the middle of an addr op (%d)\n", fsdev_ptr); fprintf(stderr, "Reading FSDEV in the middle of an addr op (%d)\n", fsdev_ptr);

View File

@ -1,13 +1,14 @@
#!/bin/bash #!/bin/sh
# wrapper around ./emul/zasm/zasm that prepares includes CFS prior to call # wrapper around ./emul/zasm/zasm that prepares includes CFS prior to call
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" DIR=$(dirname $(readlink -f "$0"))
ZASMBIN="${DIR}/emul/zasm/zasm" ZASMBIN="${DIR}/emul/zasm/zasm"
CFSPACK="${DIR}/cfspack/cfspack" CFSPACK="${DIR}/cfspack/cfspack"
INCCFS=$(mktemp) INCCFS=$(mktemp)
for p in "$@"; do for p in "$@"; do
"${CFSPACK}" "${p}" "*.+(asm|h)" >> "${INCCFS}" "${CFSPACK}" "${p}" "*.h" >> "${INCCFS}"
"${CFSPACK}" "${p}" "*.asm" >> "${INCCFS}"
done done
"${ZASMBIN}" "${INCCFS}" "${ZASMBIN}" "${INCCFS}"