version 1.4, 2010/05/14 18:56:21 |
version 1.5, 2012/03/17 21:45:25 |
|
|
attributes_tostring(u_char attr) |
attributes_tostring(u_char attr) |
{ |
{ |
static char buf[128]; |
static char buf[128]; |
|
size_t len; |
|
|
if (attr == 0) |
if (attr == 0) |
return ("none"); |
return ("none"); |
|
|
buf[0] = '\0'; |
len = xsnprintf(buf, sizeof buf, "%s%s%s%s%s%s%s", |
if (attr & GRID_ATTR_BRIGHT) |
attr & GRID_ATTR_BRIGHT ? "bright," : "", |
strlcat(buf, "bright,", sizeof (buf)); |
attr & GRID_ATTR_DIM ? "dim," : "", |
if (attr & GRID_ATTR_DIM) |
attr & GRID_ATTR_UNDERSCORE ? "underscore," : "", |
strlcat(buf, "dim,", sizeof (buf)); |
attr & GRID_ATTR_BLINK ? "blink," : "", |
if (attr & GRID_ATTR_UNDERSCORE) |
attr & GRID_ATTR_REVERSE ? "reverse," : "", |
strlcat(buf, "underscore,", sizeof (buf)); |
attr & GRID_ATTR_HIDDEN ? "hidden," : "", |
if (attr & GRID_ATTR_BLINK) |
attr & GRID_ATTR_ITALICS ? "italics," : ""); |
strlcat(buf, "blink,", sizeof (buf)); |
if (len > 0) |
if (attr & GRID_ATTR_REVERSE) |
buf[len - 1] = '\0'; |
strlcat(buf, "reverse,", sizeof (buf)); |
|
if (attr & GRID_ATTR_HIDDEN) |
|
strlcat(buf, "hidden,", sizeof (buf)); |
|
if (attr & GRID_ATTR_ITALICS) |
|
strlcat(buf, "italics,", sizeof (buf)); |
|
if (*buf != '\0') |
|
*(strrchr(buf, ',')) = '\0'; |
|
|
|
return (buf); |
return (buf); |
} |
} |