Changeset 2159 for pjproject/trunk/pjlib/src/pj/os_core_unix.c
- Timestamp:
- Jul 19, 2008 5:53:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/os_core_unix.c
r2039 r2159 1690 1690 PJ_DEF(pj_status_t) pj_term_set_color(pj_color_t color) 1691 1691 { 1692 PJ_UNUSED_ARG(color); 1693 return PJ_EINVALIDOP; 1692 /* put bright prefix to ansi_color */ 1693 char ansi_color[12] = "\033[01;3"; 1694 1695 if (color & PJ_TERM_COLOR_BRIGHT) { 1696 color ^= PJ_TERM_COLOR_BRIGHT; 1697 } else { 1698 strcpy(ansi_color, "\033[00;3"); 1699 } 1700 1701 switch (color) { 1702 case 0: 1703 /* black color */ 1704 strcat(ansi_color, "0m"); 1705 break; 1706 case PJ_TERM_COLOR_R: 1707 /* red color */ 1708 strcat(ansi_color, "1m"); 1709 break; 1710 case PJ_TERM_COLOR_G: 1711 /* green color */ 1712 strcat(ansi_color, "2m"); 1713 break; 1714 case PJ_TERM_COLOR_B: 1715 /* blue color */ 1716 strcat(ansi_color, "4m"); 1717 break; 1718 case PJ_TERM_COLOR_R | PJ_TERM_COLOR_G: 1719 /* yellow color */ 1720 strcat(ansi_color, "3m"); 1721 break; 1722 case PJ_TERM_COLOR_R | PJ_TERM_COLOR_B: 1723 /* magenta color */ 1724 strcat(ansi_color, "5m"); 1725 break; 1726 case PJ_TERM_COLOR_G | PJ_TERM_COLOR_B: 1727 /* cyan color */ 1728 strcat(ansi_color, "6m"); 1729 break; 1730 case PJ_TERM_COLOR_R | PJ_TERM_COLOR_G | PJ_TERM_COLOR_B: 1731 /* white color */ 1732 strcat(ansi_color, "7m"); 1733 break; 1734 default: 1735 /* default console color */ 1736 strcpy(ansi_color, "\033[00m"); 1737 break; 1738 } 1739 1740 fputs(ansi_color, stdout); 1741 1742 return PJ_SUCCESS; 1694 1743 } 1695 1744
Note: See TracChangeset
for help on using the changeset viewer.