Unify hexval functions; fix % in printf string
authorH. Peter Anvin <hpa@zytor.com>
Wed, 6 Jun 2007 01:18:02 +0000 (18:18 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 6 Jun 2007 01:18:02 +0000 (18:18 -0700)
com32/modules/menu.h
com32/modules/printmsg.c
com32/modules/readconfig.c

index e6fcbcd..933df43 100644 (file)
@@ -119,6 +119,10 @@ static inline int my_isspace(char c)
   return (unsigned char)c <= ' ';
 }
 
+int my_isxdigit(char c);
+unsigned int hexval(char c);
+unsigned int hexval2(const char *p);
+
 int menu_main(int argc, char *argv[]);
 void console_prepare(void);
 void console_cleanup(void);
index 107a1d0..80e5231 100644 (file)
 
 int (*draw_background)(const char *filename);
 
-static int hexval(int c)
-{
-  if (c >= '0' && c <= '9')
-    return c-'0';
-
-  c |= 0x20;
-  if (c >= 'a' && c <= 'f')
-    return c-'a'+10;
-
-  return 0;
-}
-
 static int draw_message_file(const char *filename)
 {
   FILE *f;
@@ -49,7 +37,7 @@ static int draw_message_file(const char *filename)
     return -1;
 
   /* Clear screen, hide cursor, default attribute */
-  printf("\033e\033%@\033)0\033(B\3#%03d\033[?25l\033[2J\033[H",
+  printf("\033e\033%%@\033)0\033(B\3#%03d\033[?25l\033[2J\033[H",
         message_base_color+0x07);
 
   while (!eof && (ch = getc(f)) != EOF) {
index a2f9cfd..c9453a4 100644 (file)
@@ -312,7 +312,7 @@ dup_word(char **p)
   return dp;
 }
 
-static int my_isxdigit(char c)
+int my_isxdigit(char c)
 {
   unsigned int uc = c;
 
@@ -320,7 +320,7 @@ static int my_isxdigit(char c)
     ((uc|0x20)-'a') < 6;
 }
 
-static unsigned int hexval(char c)
+unsigned int hexval(char c)
 {
   unsigned char uc = c | 0x20;
   unsigned int v;
@@ -332,7 +332,7 @@ static unsigned int hexval(char c)
   return uc-'a'+10;
 }
 
-static unsigned int hexval2(const char *p)
+unsigned int hexval2(const char *p)
 {
   return (hexval(p[0]) << 4)+hexval(p[1]);
 }