utils/color.c
char* strclr(int clr, char* str, ...) 
{
    /* String buffers */
    static char output[MAXMSG];
    char string[MAXMSG];

    /* Read args */
    va_list args;
    va_start(args, str);
    vsprintf(string, str, args);
    va_end(args);

    /* Handle colors */
    switch(clr) 
    {
        case 0:
            sprintf(output, "%s%s%s", CLR_NORM, string, CLR_RESET);
            break;
        case 1:
            sprintf(output, "%s%s%s", CLR_GREEN, string, CLR_RESET);
            break;
        case 2:
            sprintf(output, "%s%s%s", CLR_RED, string, CLR_RESET);
            break;
        case 3:
            sprintf(output, "%s%s%s", CLR_YELLOW, string, CLR_RESET);
            break;
        case 4:
            sprintf(output, "%s%s%s", CLR_BLUE, string, CLR_RESET);
            break;
        case 5:
            sprintf(output, "%s%s%s", CLR_NAGENTA, string, CLR_RESET);
            break;
        case 6:
            sprintf(output, "%s%s%s", CLR_CYAN, string, CLR_RESET);
            break;
        case 7:
            sprintf(output, "%s%s%s", CLR_WHITE, string, CLR_RESET);
            break;
        default:
            return NULL;
    }

    /* Return output */
    return output;
}
/*
 * strclr - Colorize string. Function takes color value and string 
 * and returns colorized string as char pointer. First argument clr 
 * is color value (if it is invalid, function retunrs NULL) and second 
 * is string with va_list of arguments which one we want to colorize.
 */
Colorize string. Function takes color value and string
and returns colorized string as char pointer. First argument clr
is color value (if it is invalid, function retunrs NULL) and second
is string with va_list of arguments which one we want to colorize.
Colorize string . Function takes color value and string and returns colorized string as char pointer . First argument clr is color value ( if it is invalid function retunrs NULL ) and second is string with va_list of arguments which one we want to colorize .
char* strclr(int clr, char* str, ...) 
{
    static char output[MAXMSG];
    char string[MAXMSG];
    va_list args;
    va_start(args, str);
    vsprintf(string, str, args);
    va_end(args);
    switch(clr) 
    {
        case 0:
            sprintf(output, "%s%s%s", CLR_NORM, string, CLR_RESET);
            break;
        case 1:
            sprintf(output, "%s%s%s", CLR_GREEN, string, CLR_RESET);
            break;
        case 2:
            sprintf(output, "%s%s%s", CLR_RED, string, CLR_RESET);
            break;
        case 3:
            sprintf(output, "%s%s%s", CLR_YELLOW, string, CLR_RESET);
            break;
        case 4:
            sprintf(output, "%s%s%s", CLR_BLUE, string, CLR_RESET);
            break;
        case 5:
            sprintf(output, "%s%s%s", CLR_NAGENTA, string, CLR_RESET);
            break;
        case 6:
            sprintf(output, "%s%s%s", CLR_CYAN, string, CLR_RESET);
            break;
        case 7:
            sprintf(output, "%s%s%s", CLR_WHITE, string, CLR_RESET);
            break;
        default:
            return NULL;
    }
    return output;
}
char * strclr ( int clr , char * str , ... ) { static char output [ MAXMSG ] ; char string [ MAXMSG ] ; va_list args ; va_start ( args , str ) ; vsprintf ( string , str , args ) ; va_end ( args ) ; switch ( clr ) { case 0 : sprintf ( output , " " , CLR_NORM , string , CLR_RESET ) ; break ; case 1 : sprintf ( output , " " , CLR_GREEN , string , CLR_RESET ) ; break ; case 2 : sprintf ( output , " " , CLR_RED , string , CLR_RESET ) ; break ; case 3 : sprintf ( output , " " , CLR_YELLOW , string , CLR_RESET ) ; break ; case 4 : sprintf ( output , " " , CLR_BLUE , string , CLR_RESET ) ; break ; case 5 : sprintf ( output , " " , CLR_NAGENTA , string , CLR_RESET ) ; break ; case 6 : sprintf ( output , " " , CLR_CYAN , string , CLR_RESET ) ; break ; case 7 : sprintf ( output , " " , CLR_WHITE , string , CLR_RESET ) ; break ; default : return NULL ; } return output ; }
strclr - Colorize string.
strclr - Colorize string .
/* String buffers */ /* Read args */ /* Handle colors */ /* Return output */