aboutsummaryrefslogtreecommitdiff
path: root/dla2csv.c
diff options
context:
space:
mode:
Diffstat (limited to 'dla2csv.c')
-rw-r--r--dla2csv.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/dla2csv.c b/dla2csv.c
index 4910f7e..79de16a 100644
--- a/dla2csv.c
+++ b/dla2csv.c
@@ -53,11 +53,11 @@ void atari_perror(char *msg) {
so call disable_break() at startup, then wrap disk I/O in
enable_break() and disable_break(). */
void enable_break() {
- OS.pokmsk = POKEY_WRITE.irqen = POKEY_READ.irqst | 0x80;
+ OS.pokmsk = POKEY_WRITE.irqen = (OS.pokmsk | 0x80);
}
void disable_break() {
- OS.pokmsk = POKEY_WRITE.irqen = POKEY_READ.irqst & 0x7f;
+ OS.pokmsk = POKEY_WRITE.irqen = (OS.pokmsk & 0x7f);
}
void init_console(void) {
@@ -207,6 +207,7 @@ int prompt_yn(char *prompt, int default_y) {
opens the file. */
FILE *prompt_filename(const char *name, const char *mode) {
FILE *f = NULL;
+
putchar('\n');
while(f == NULL) {
printf("%s file: ", name);
@@ -220,22 +221,27 @@ FILE *prompt_filename(const char *name, const char *mode) {
}
continue;
}
+
#ifdef __ATARI__
/* if the user enters a single digit, show directory of that drive. */
if(isdigit(stringbuf[0])) {
show_dir(stringbuf[0]);
continue;
}
- /* if there's no device spec (D: or D1: etc), prepend D: */
+
+ /* if user entered a filename with no device spec (D: or D1: etc),
+ prepend D: */
if(!strchr(stringbuf, ':')) {
memmove(stringbuf+2, stringbuf, strlen(stringbuf) + 1);
stringbuf[0] = 'D';
stringbuf[1] = ':';
}
#endif
+
enable_break();
f = fopen(stringbuf, mode);
disable_break();
+
if(!f) PERROR(stringbuf);
}
return f;
@@ -244,6 +250,7 @@ FILE *prompt_filename(const char *name, const char *mode) {
/* Prompt for and read EOL type, retry if needed. Will not return
until a valid number was entered. */
char *prompt_eol(void) {
+ static int default_eoltype = 0;
int i;
putchar('\n');
@@ -254,17 +261,18 @@ char *prompt_eol(void) {
i = -1;
while(i == -1) {
- printf("Line ending type[1]? ");
+ printf("Line ending type[%d]? ", default_eoltype + 1);
fflush(stdout);
readstring();
if(stringbuf[0] == '\n') {
- i = 0;
+ i = default_eoltype;
} else {
i = stringbuf[0] - 49; /* ASCII 1-3 => 0-2 */
if(i < 0 || i > 2)
i = -1;
}
}
+ default_eoltype = i;
return eoltypes[i][1];
}