Changeset 40

Show
Ignore:
Timestamp:
07/11/04 17:07:05 (4 years ago)
Author:
morris
Message:

only test Unicode

//IGNORE to iconv_open

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wire/trunk/configure

    r34 r40  
    43664366                        LIBS="$LIBS -liconv" 
    43674367 
    4368                         echo "$as_me:$LINENO: checking if iconv understands Unicode and ISO-8859-1" >&5 
    4369 echo $ECHO_N "checking if iconv understands Unicode and ISO-8859-1... $ECHO_C" >&6 
     4368                        echo "$as_me:$LINENO: checking if iconv understands Unicode" >&5 
     4369echo $ECHO_N "checking if iconv understands Unicode... $ECHO_C" >&6 
    43704370                        if test "$cross_compiling" = yes; then 
    43714371  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling 
     
    43854385                                #include <iconv.h> 
    43864386                                int main(void) { 
    4387                                         iconv_t conv = iconv_open("UTF-8", "ISO-8859-1"); 
     4387                                        iconv_t conv = iconv_open("UTF-8", "UTF-8"); 
    43884388                                        if(conv == (iconv_t) -1) 
    43894389                                                return 1; 
  • wire/trunk/configure.in

    r34 r40  
    107107                        LIBS="$LIBS -liconv" 
    108108                         
    109                         AC_MSG_CHECKING([if iconv understands Unicode and ISO-8859-1]) 
     109                        AC_MSG_CHECKING([if iconv understands Unicode]) 
    110110                        AC_TRY_RUN([ 
    111111                                #include <iconv.h> 
    112112                                int main(void) { 
    113                                         iconv_t conv = iconv_open("UTF-8", "ISO-8859-1"); 
     113                                        iconv_t conv = iconv_open("UTF-8", "UTF-8"); 
    114114                                        if(conv == (iconv_t) -1) 
    115115                                                return 1; 
  • wire/trunk/wire/commands.c

    r39 r40  
    1 /* $Id: commands.c,v 1.16 2004/07/11 14:02:05 morris Exp $ */ 
     1/* $Id: commands.c,v 1.17 2004/07/11 15:07:05 morris Exp $ */ 
    22 
    33/* 
     
    12331233        wr_list_node    *node; 
    12341234        wr_user                 *user; 
    1235         unsigned int    length, maxlength = 0; 
     1235        unsigned int    length, max_length = 0; 
    12361236         
    12371237        /* find max string length */ 
     
    12391239        WR_LIST_FOREACH(wr_users, node, user) { 
    12401240                length = strlen(user->nick); 
    1241                 maxlength = length > maxlength ? length : maxlength; 
    1242  
     1241                max_length = length > max_length ? length : max_length; 
     1242                 
    12431243                length = strlen(user->login); 
    1244                 maxlength = length > maxlength ? length : maxlength; 
     1244                max_length = length > max_length ? length : max_length; 
    12451245 
    12461246                length = strlen(user->ip); 
    1247                 maxlength = length > maxlength ? length : maxlength; 
     1247                max_length = length > max_length ? length : max_length; 
    12481248        } 
    12491249 
    12501250        /* print users */ 
    1251         wr_printf_prefix("Users currently online:\n"); 
     1251        wr_printf_prefix("Users currently online: %d\n", max_length); 
    12521252         
    12531253        WR_LIST_FOREACH(wr_users, node, user) 
    1254                 wr_print_user(node->data, maxlength); 
     1254                wr_print_user(node->data, max_length); 
    12551255        WR_LIST_UNLOCK(wr_users); 
    12561256} 
  • wire/trunk/wire/main.c

    r38 r40  
    1 /* $Id: main.c,v 1.16 2004/07/11 13:50:54 morris Exp $ */ 
     1/* $Id: main.c,v 1.17 2004/07/11 15:07:05 morris Exp $ */ 
    22 
    33/* 
     
    9696                         
    9797                        case 'c': 
    98                                 snprintf(charset, sizeof(charset), "%s//TRANSLIT", optarg); 
     98                                snprintf(charset, sizeof(charset), "%s//IGNORE//TRANSLIT", optarg); 
    9999                                break; 
    100100                         
     
    120120        /* default charset */ 
    121121        if(strlen(charset) == 0) 
    122                 snprintf(charset, sizeof(charset), "ISO-8859-1//TRANSLIT"); 
     122                snprintf(charset, sizeof(charset), "ISO-8859-1//IGNORE//TRANSLIT"); 
    123123 
    124124        /* create version string */ 
     
    164164 
    165165        /* init libiconv */ 
    166         wr_conv_from = iconv_open(charset, "UTF-8"); 
    167         wr_conv_to = iconv_open("UTF-8//TRANSLIT", charset); 
     166        wr_conv_from = iconv_open("ISO-8859-1//IGNORE//TRANSLIT", "UTF-8"); 
     167        wr_conv_to = iconv_open("UTF-8//IGNORE//TRANSLIT", "ISO-8859-1"); 
    168168 
    169169        if(wr_conv_from == (iconv_t) -1 || wr_conv_to == (iconv_t) -1) { 
     
    10001000 
    10011001 
    1002 void wr_print_user(wr_user *user, unsigned int maxlength) { 
     1002void wr_print_user(wr_user *user, unsigned int max_length) { 
    10031003        char    *color; 
    10041004         
     
    10181018                user->nick, 
    10191019                "\033[0m", 
    1020                 maxlength - strlen(user->nick) + 1, 
     1020                max_length - strlen(user->nick) + 1, 
    10211021                " ", 
    10221022                user->login, 
    1023                 maxlength - strlen(user->login) + 1, 
     1023                max_length - strlen(user->login) + 1, 
    10241024                " ", 
    10251025                user->ip); 
  • wire/trunk/wire/utility.c

    r33 r40  
    1 /* $Id: utility.c,v 1.7 2004/07/11 04:14:38 morris Exp $ */ 
     1/* $Id: utility.c,v 1.8 2004/07/11 15:07:05 morris Exp $ */ 
    22 
    33/* 
     
    6363 
    6464void wr_text_convert(iconv_t conv, char *inbuffer, size_t *inbytes) { 
    65         char            *i, *o, *outbuffer; 
     65        char            *in, *out, *outbuffer; 
    6666        size_t          outbytes, length; 
    6767 
     
    7474        outbuffer = (char *) malloc(outbytes); 
    7575        memset(outbuffer, 0, outbytes); 
    76         o = outbuffer; 
    77         i = inbuffer; 
     76        out = outbuffer; 
     77        in = inbuffer; 
    7878 
    7979        /* convert */ 
    80         if(iconv(conv, (const char **) &i, inbytes, &o, &outbytes) != -1) { 
     80        if(iconv(conv, (const char **) &in, inbytes, &out, &outbytes) != -1) { 
    8181                /* copy back */ 
    8282                memcpy(inbuffer, outbuffer, length - outbytes);