diff options
author | Dirk Meyer <dinoex@FreeBSD.org> | 2025-04-12 17:03:37 +0200 |
---|---|---|
committer | Dirk Meyer <dinoex@FreeBSD.org> | 2025-04-12 17:03:37 +0200 |
commit | 0d3ad926cfcd8bb9d4c66052368f7c929495bdd7 (patch) | |
tree | e59ac8b3f623340f9afa86e24e7438a959153f28 /emulators/stonx/files/patch-main.c | |
parent | mail/thunderbird: update to 137.0.2 (rc1) (diff) |
emulators/stonx: Build with free EmuTOS
support localized ROMS
add printer support
preserve stonxrc on updates
fix sound
Diffstat (limited to 'emulators/stonx/files/patch-main.c')
-rw-r--r-- | emulators/stonx/files/patch-main.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/emulators/stonx/files/patch-main.c b/emulators/stonx/files/patch-main.c new file mode 100644 index 000000000000..5b8f304681bd --- /dev/null +++ b/emulators/stonx/files/patch-main.c @@ -0,0 +1,103 @@ +--- main.c.orig 2004-08-15 13:39:01 UTC ++++ main.c +@@ -62,6 +62,10 @@ extern char *parallel_dev; + extern char *serial_dev; + #endif + extern char *parallel_dev; ++#if LPPIPES ++extern char *auxpipe; ++extern char *prnpipe; ++#endif + int got_drive=0; + int chunky=0; + int timer_a=0; +@@ -221,6 +225,22 @@ void process_args (int argc, char *argv[], int is_rc) + error("para needs a device as argument (/dev/lp0 for example)\n"); + parallel_dev = strdup(argv[++i]); + } ++#if LPPIPES ++ else if (EQ(x,"auxpipe")) ++ { ++ if (i == argc-1) ++ error("auxpipe needs a pipe as argument ('cat > ~tmp/pipe.aux' for example)\n"); ++ auxpipe = strdup(argv[++i]); ++ fprintf(stderr, "auxpipe: %s\n", auxpipe); ++ } ++ else if (EQ(x,"prnpipe")) ++ { ++ if (i == argc-1) ++ error("prnpipe needs a pipe as argument ('lp' for example)\n"); ++ prnpipe = strdup(argv[++i]); ++ fprintf(stderr, "prnpipe: %s\n", prnpipe); ++ } ++#endif + else if (EQ(x,"noaudio")) + { + audio=0; +@@ -328,6 +348,12 @@ void process_args (int argc, char *argv[], int is_rc) + #if MODEM1 + " -serial <file> Use <file> as the serial port device\n" + #endif ++#if LPPIPES ++ " -prnpipe <pipe> print through GEMDOS(PRN:) to unix pipe\n" ++ " 'lp' for example\n" ++ " -auxpipe <pipe> print through GEMDOS(AUX:) to unix pipe\n" ++ " 'cat > ~/tmp/pipe.aux' for example (need quotes)\n" ++#endif + #if MONITOR + " -monitor Start in Monitor\n" + #endif +@@ -358,6 +384,44 @@ void process_args (int argc, char *argv[], int is_rc) + } + } + ++int readstrtok(FILE *fp, char *dest, char *home, int max) ++{ ++ char ch = EOF, qc = 0; ++ int i = 0; ++ ++ /* if quoted argument, copy full quote ++ expand ~ to home path */ ++ while (i < max && (ch = fgetc(fp)) != EOF) { ++ if (ch == '\'' || ch == '"') { ++ if (!qc) { ++ qc = ch; ++ continue; ++ } else { ++ break; ++ } ++ } else if (ch == '~' && home) { ++ int n = 0; ++ while (i < max && home[n]) ++ dest[i++] = home[n++]; ++ } else { ++ if (!qc) ++ if (ch == ' ' || ch == '\t') ++ ch = '\n'; ++ if (ch == '\n') { ++ if (!i) ++ continue; ++ break; ++ } ++ dest[i++] = ch; ++ } ++ } ++ dest[i]='\0'; ++ /* fprintf (stderr, "<%s>\n", dest); */ ++ if (ch == EOF) ++ return EOF; ++ return 0; ++} ++ + void process_stonxrc(void) + { + char *home; +@@ -391,7 +455,7 @@ void process_stonxrc(void) + int i,c=1; + char *args[1024]; + for (i=1;i<1024;i++) args[i] = (char*)malloc(sizeof(char)*256); +- while (fscanf(rc,"%s",args[c]) != EOF) { ++ while (readstrtok(rc, args[c], home, 256) != EOF) { + if (args[c][0] == '#' && + strcmp(args[c],"#ifmachine") && strcmp(args[c],"#fi")) { + int ch; |