From dd2140ebe5d43d51dbb29683e389583f142a7ef5 Mon Sep 17 00:00:00 2001 From: "E. C. Masloch" Date: Thu, 1 Aug 2024 20:52:39 +0200 Subject: [PATCH 1/2] do not display any lone Carriage Returns In combination with SWITCHES=/N in fdconfig.sys this commit makes it so only proper CR LF linebreaks are displayed, for instance when piping dosemu2 output to a file. SWITCHES=/F will set SkipConfigSeconds so that config.c SkipLine will display a string reading "\r%79s\r" to delete the prompt that it has displayed. This overwriting should not be needed for SkipConfigSeconds=0 however. Refer to subsequent commit. --- kernel/initdisk.c | 2 +- kernel/main.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/initdisk.c b/kernel/initdisk.c index 05242f45..58ab90c3 100644 --- a/kernel/initdisk.c +++ b/kernel/initdisk.c @@ -618,7 +618,7 @@ void DosDefinePartition(struct DriveParamS *driveParam, ExtPri = "Ext"; num = extendedPartNo; } - printf("\r%c: HD%d, %s[%2d]", 'A' + nUnits, + printf("%c: HD%d, %s[%2d]", 'A' + nUnits, (driveParam->driveno & 0x7f) + 1, ExtPri, num); printCHS(", CHS= ", &chs); diff --git a/kernel/main.c b/kernel/main.c index dc7a1c55..53ef250e 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -440,15 +440,15 @@ STATIC VOID signon() if (InitKernelConfig.Verbose < 0) { #ifdef CUSTOM_BRANDING - printf("\n\r" CUSTOM_BRANDING "\n\n"); + printf("\n" CUSTOM_BRANDING "\n\n"); #else - printf("\n\r%S\n\n", MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release))); + printf("\n%S\n\n", MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release))); #endif } else { #ifdef CUSTOM_BRANDING - printf("\n\r" CUSTOM_BRANDING "\n\n%s", copyright); + printf("\n" CUSTOM_BRANDING "\n\n%s", copyright); #else - printf("\r%S" + printf("\n%S" "Kernel compatibility %d.%d - " #if defined(__BORLANDC__) "BORLANDC" From 00ec582c05322ffa931347fee91b111bd1642d96 Mon Sep 17 00:00:00 2001 From: "E. C. Masloch" Date: Thu, 1 Aug 2024 20:58:03 +0200 Subject: [PATCH 2/2] config: only overwrite skip config prompt if it was displayed This allows to boot with SWITCHES=/F without any lone CRs. --- kernel/config.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/config.c b/kernel/config.c index 701ef09f..27e8ac7e 100644 --- a/kernel/config.c +++ b/kernel/config.c @@ -1085,14 +1085,15 @@ STATIC BOOL SkipLine(char *pLine) { short key; COUNT i; + signed char originalskipconfigseconds = InitKernelConfig.SkipConfigSeconds; - if (InitKernelConfig.SkipConfigSeconds >= 0) + if (originalskipconfigseconds >= 0) { - if (InitKernelConfig.SkipConfigSeconds > 0) + if (originalskipconfigseconds > 0) printf("Press F8 to trace or F5 to skip CONFIG.SYS/AUTOEXEC.BAT"); - key = GetBiosKey(InitKernelConfig.SkipConfigSeconds); /* wait 2 seconds */ + key = GetBiosKey(originalskipconfigseconds); /* wait 2 seconds */ InitKernelConfig.SkipConfigSeconds = -1; @@ -1105,7 +1106,8 @@ STATIC BOOL SkipLine(char *pLine) singleStep = TRUE; } - printf("\r%79s\r", ""); /* clear line */ + if (originalskipconfigseconds > 0) + printf("\r%79s\r", ""); /* clear line */ if (SkipAllConfig) printf("Skipping CONFIG.SYS/AUTOEXEC.BAT\n");