cmenu: refactor beep function
authorPierre-Alexandre Meyer <pierre@mouraf.org>
Sat, 29 Aug 2009 05:14:10 +0000 (22:14 -0700)
committerPierre-Alexandre Meyer <pierre@mouraf.org>
Tue, 1 Sep 2009 18:43:38 +0000 (11:43 -0700)
Use \007 to make the system beep. Note "\007" works, but not '\007'.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
com32/cmenu/libmenu/com32io.c
com32/cmenu/libmenu/com32io.h

index 7daf67a..f59baeb 100644 (file)
@@ -105,14 +105,6 @@ unsigned char sleep(unsigned int msec)
     return REG_AH(outreg);
 }
 
-void beep()
-{
-    REG_AH(inreg) = 0x0E;
-    REG_AL(inreg) = 0x07;
-    REG_BH(inreg) = 0;
-    __intcall(0x10, &inreg, &outreg);
-}
-
 void scrollupwindow(char top, char left, char bot, char right, char attr,
                    char numlines)
 {
index 1d27cfb..a73b9f3 100644 (file)
 
 #define CSI "\e["
 
+/* Beep: "" are required, not '' */
+static inline beep()
+{
+       return fputs("\007", stdout);
+}
+
 /* BIOS Assisted output routines */
 
 void cswprint(const char *str, char attr, char left);
@@ -107,8 +113,6 @@ static inline char getvideomode(void)       // Get the current video mode
 
 unsigned char sleep(unsigned int msec);        // Sleep for specified time
 
-void beep();                   // A Bell
-
 unsigned char checkkbdbuf();   // Check to see if there is kbd buffer is non-empty?
 
 static inline void clearkbdbuf()       // Clear the kbd buffer (how many chars removed?)