]> code.delx.au - gnu-emacs/blobdiff - src/dosfns.c
Remove eval-when-compile.
[gnu-emacs] / src / dosfns.c
index 857d16bd9b21babe1c0e0eae5a7404dac886770e..3c1fd8f764b46322546cc9b6744ecd6883b465e1 100644 (file)
@@ -409,6 +409,8 @@ static char *vga_colors[16] = {
   "lightred", "lightmagenta", "yellow", "white"
 };
 
+extern char unspecified_fg[], unspecified_bg[];
+
 /* Given a color name, return its index, or -1 if not found.  Note
    that this only performs case-insensitive comparison against the
    standard names.  For anything more sophisticated, like matching
@@ -424,7 +426,10 @@ msdos_stdcolor_idx (const char *name)
     if (strcasecmp (name, vga_colors[i]) == 0)
       return i;
 
-  return FACE_TTY_DEFAULT_COLOR;
+  return
+    strcmp (name, unspecified_fg) == 0 ? FACE_TTY_DEFAULT_FG_COLOR
+    : strcmp (name, unspecified_bg) == 0 ? FACE_TTY_DEFAULT_BG_COLOR
+    : FACE_TTY_DEFAULT_COLOR;
 }
 
 /* Given a color index, return its standard name.  */
@@ -433,9 +438,14 @@ msdos_stdcolor_name (int idx)
 {
   extern Lisp_Object Qunspecified;
 
-  if (idx < 0 || idx >= sizeof (vga_colors) / sizeof (vga_colors[0]))
+  if (idx == FACE_TTY_DEFAULT_FG_COLOR)
+    return build_string (unspecified_fg);
+  else if (idx == FACE_TTY_DEFAULT_BG_COLOR)
+    return build_string (unspecified_bg);
+  else if (idx >= 0 && idx < sizeof (vga_colors) / sizeof (vga_colors[0]))
+    return build_string (vga_colors[idx]);
+  else
     return Qunspecified;       /* meaning the default */
-  return build_string (vga_colors[idx]);
 }
 
 /* Support for features that are available when we run in a DOS box