From 1d82075f02560614a8c60eec3ed116934e23d7c3 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Thu, 20 Jan 2005 00:29:11 +0000
Subject: [PATCH] Support the incorrect (but seen in public) "ESC[MB abc" and
 "ESC[MF abc" format... this means that a legal "ESC[MB " sequence will be
 missing the B at the start.

---
 src/conio/cterm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/conio/cterm.c b/src/conio/cterm.c
index 76f4d1ad6d..440c892d56 100644
--- a/src/conio/cterm.c
+++ b/src/conio/cterm.c
@@ -51,7 +51,7 @@ const char *octave="C#D#EF#G#A#B";
 
 /* Characters allowed in music strings... if one that is NOT in here is
  * found, CTerm leaves music capture mode and tosses the buffer away */
-const char musicchars="abcdefgABCDEFGpPnN0123456789.-+#oOtOlLmMsS<> ";
+const char *musicchars="aAbBcCdDeEfFgGlLmMnNoOpPsStT0123456789.-+#<> ";
 const uint note_frequency[]={	/* Hz*1000 */
 /* Octave 0 (Note 1) */
 	 65406
@@ -185,7 +185,10 @@ void play_music(void)
 	int		dotted=0;
 	int		notenum;
 
-	for(p=cterm.musicbuf;*p;p++) {
+	p=cterm.musicbuf;
+	if((*p=='B' || *p=='F') && *(p+1)==' ')
+		p++;
+	for(;*p;p++) {
 		notenum=0;
 		switch(toupper(*p)) {
 			case 'M':
-- 
GitLab