This commit is contained in:
Devine Lu Linvega 2024-09-19 14:14:05 -07:00
parent 93125457a6
commit 9530e7b13a
3 changed files with 8 additions and 8 deletions

View File

@ -217,7 +217,7 @@ is_dir_path(char *p)
{ {
char c; char c;
int saw_slash = 0; int saw_slash = 0;
while (c = *p++) while((c = *p++))
saw_slash = c == DIR_SEP_CHAR; saw_slash = c == DIR_SEP_CHAR;
return saw_slash; return saw_slash;
} }
@ -235,7 +235,7 @@ ensure_parent_dirs(char *p)
int ok = 1; int ok = 1;
char c, *s = p; char c, *s = p;
for(; ok && (c = *p); p++) { for(; ok && (c = *p); p++) {
if (c == DIR_SEP_CHAR) { if(c == DIR_SEP_CHAR) {
*p = '\0'; *p = '\0';
ok = dir_exists(s) || mkdir(s); ok = dir_exists(s) || mkdir(s);
*p = c; *p = c;
@ -252,7 +252,7 @@ file_write(UxnFile *c, void *src, Uint16 len, Uint8 flags)
ensure_parent_dirs(c->current_filename); ensure_parent_dirs(c->current_filename);
if(c->state != FILE_WRITE && c->state != DIR_WRITE) { if(c->state != FILE_WRITE && c->state != DIR_WRITE) {
reset(c); reset(c);
if (is_dir_path(c->current_filename)) if(is_dir_path(c->current_filename))
c->state = DIR_WRITE; c->state = DIR_WRITE;
else if((c->f = fopen(c->current_filename, (flags & 0x01) ? "ab" : "wb")) != NULL) else if((c->f = fopen(c->current_filename, (flags & 0x01) ? "ab" : "wb")) != NULL)
c->state = FILE_WRITE; c->state = FILE_WRITE;
@ -261,7 +261,7 @@ file_write(UxnFile *c, void *src, Uint16 len, Uint8 flags)
if((ret = fwrite(src, 1, len, c->f)) > 0 && fflush(c->f) != 0) if((ret = fwrite(src, 1, len, c->f)) > 0 && fflush(c->f) != 0)
ret = 0; ret = 0;
} }
if (c->state == DIR_WRITE) { if(c->state == DIR_WRITE) {
ret = dir_exists(c->current_filename); ret = dir_exists(c->current_filename);
} }
return ret; return ret;
@ -271,7 +271,7 @@ static Uint16
stat_fill(Uint8 *dest, Uint16 len, char c) stat_fill(Uint8 *dest, Uint16 len, char c)
{ {
Uint16 i; Uint16 i;
for (i = 0; i < len; i++) for(i = 0; i < len; i++)
*(dest++) = c; *(dest++) = c;
return len; return len;
} }
@ -281,7 +281,7 @@ stat_size(Uint8 *dest, Uint16 len, off_t size)
{ {
Uint16 i; Uint16 i;
dest += len - 1; dest += len - 1;
for (i = 0; i < len; i++) { for(i = 0; i < len; i++) {
*(dest--) = '0' + (Uint8)(size & 0xf); *(dest--) = '0' + (Uint8)(size & 0xf);
size = size >> 4; size = size >> 4;
} }

View File

@ -271,7 +271,7 @@ main(int argc, char **argv)
int i = 1; int i = 1;
char *rom; char *rom;
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') { if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
fprintf(stdout, "Uxn11 - Varvara Emulator, 29 Aug 2024.\n"); fprintf(stdout, "Uxn11 - Varvara Emulator, 19 Sep 2024.\n");
exit(0); exit(0);
} }
rom = i == argc ? "boot.rom" : argv[i++]; rom = i == argc ? "boot.rom" : argv[i++];

View File

@ -69,7 +69,7 @@ main(int argc, char **argv)
int i = 1; int i = 1;
char *rom; char *rom;
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') { if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
fprintf(stdout, "Uxncli - Console Varvara Emulator, 29 Aug 2024.\n"); fprintf(stdout, "Uxn11(cli) - Varvara Emulator, 19 Sep 2024.\n");
exit(0); exit(0);
} }
rom = i == argc ? "boot.rom" : argv[i++]; rom = i == argc ? "boot.rom" : argv[i++];