Changeset 903:1602a69ee439 for color.c
- Timestamp:
- 1999-07-06 15:42:25 (9 years ago)
- Branch:
- mutt-1-0-stable
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
color.c
r703 r903 154 154 155 155 #ifdef USE_SLANG_CURSES 156 static char * get_color_name (int val)156 static char *get_color_name (char *dest, size_t destlen, int val) 157 157 { 158 158 static char * missing[3] = {"brown", "lightgray", ""}; … … 162 162 { 163 163 case COLOR_YELLOW: 164 return (missing[0]); 164 strfcpy (dest, missing[0], destlen); 165 return dest; 165 166 166 167 case COLOR_WHITE: 167 return (missing[1]); 168 strfcpy (dest, missing[1], destlen); 169 return dest; 168 170 169 171 case COLOR_DEFAULT: 170 return (missing[2]); 172 strfcpy (dest, missing[2], destlen); 173 return dest; 171 174 } 172 175 … … 174 177 { 175 178 if (Colors[i].value == val) 176 return (Colors[i].name); 177 } 178 return (Colors[0].name); 179 { 180 strfcpy (dest, Colors[i].name, destlen); 181 return dest; 182 } 183 } 184 185 /* Sigh. If we got this far, the color is of the form 'colorN' 186 * Slang can handle this itself, so just return 'colorN' 187 */ 188 189 snprintf (dest, destlen, "color%d", val); 190 return dest; 179 191 } 180 192 #endif … … 184 196 COLOR_LIST *p = ColorList; 185 197 int i; 198 199 #if defined (USE_SLANG_CURSES) 200 char fgc[SHORT_STRING], bgc[SHORT_STRING]; 201 #endif 186 202 187 203 /* check to see if this color is already allocated to save space */ … … 224 240 #if defined (USE_SLANG_CURSES) 225 241 if (fg == COLOR_DEFAULT || bg == COLOR_DEFAULT) 226 SLtt_set_color (i, NULL, get_color_name (fg ), get_color_name (bg));242 SLtt_set_color (i, NULL, get_color_name (fgc, sizeof (fgc), fg), get_color_name (bgc, sizeof (bgc), bg)); 227 243 else 228 244 #elif defined (HAVE_USE_DEFAULT_COLORS)
