revert part of the dev-files.c changes
FossilOrigin-Name: 7d6327d42772249a797eb44f0d5fb90217f2e9e7de2530a9d890a0166665520c
This commit is contained in:
parent
dfd0a38e53
commit
0bec9c3d98
1 changed files with 10 additions and 2 deletions
|
@ -59,9 +59,17 @@ V file_open(NgaState *vm) {
|
||||||
CELL name = stack_pop(vm);
|
CELL name = stack_pop(vm);
|
||||||
char *modes[] = {"rb", "w", "a", "rb+"};
|
char *modes[] = {"rb", "w", "a", "rb+"};
|
||||||
char *request = string_extract(vm, name);
|
char *request = string_extract(vm, name);
|
||||||
FILE *file = (slot > 0) ? fopen(request, modes[mode]) : NULL;
|
if (slot > 0) {
|
||||||
vm->OpenFileHandles[slot] = (file != NULL) ? file : 0;
|
vm->OpenFileHandles[slot] = fopen(request, modes[mode]);
|
||||||
|
}
|
||||||
|
if (vm->OpenFileHandles[slot] == NULL) {
|
||||||
|
vm->OpenFileHandles[slot] = 0;
|
||||||
|
slot = 0;
|
||||||
|
}
|
||||||
stack_push(vm, slot);
|
stack_push(vm, slot);
|
||||||
|
// FILE *file = (slot > 0) ? fopen(request, modes[mode]) : NULL;
|
||||||
|
// vm->OpenFileHandles[slot] = (file != NULL) ? file : 0;
|
||||||
|
// stack_push(vm, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------
|
/*---------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue