if (strlen(value[i]) >= sizeof(buf)) continue;
_xudc_get_codeset(locale,charset_str,codeset,num_codeset)char *locale;char *charset_str;int  **codeset;int  *num_codeset;{    XLCdRec lcdrec;    XLCd     lcd;    XLCdPublicRec xlcdp;    XPointer rdb;    int num = 0,count,num_ret=0,i,*ret;    char **value,buf[128],*ptr;    _xudc_utyderror = 0;    _xudc_utyerror = 0;    if((locale == NULL) || (charset_str == NULL)){        _xudc_utyerror = 5;        _xudc_utyderror = 1;	_xudc_utyerrno = 0x04 ;        return(_XUDC_ERROR);    }    if(codeset == NULL){        _xudc_utyerror = 5;        _xudc_utyderror = 2;	_xudc_utyerrno = 0x04 ;        return(_XUDC_ERROR);    }    /*    create XLCd     */    xlcdp.pub.siname = locale;    lcdrec.core = (XLCdCore)&xlcdp;    lcd = &lcdrec;        /* create X RDB (X NLS DB) */    rdb = _XlcCreateLocaleDataBase(lcd);    if(rdb == NULL){        _xudc_utyerror = 1;	_xudc_utyerrno = 0x15 ;        return(_XUDC_ERROR);    }    for(num=0;;num++){        /* XLC_FONTSET */        sprintf(buf, "fs%d.font.primary", num);        _XlcGetLocaleDataBase(lcd, "XLC_FONTSET", buf, &value, &count);        if(count < 1){            break ;        }        for(i=0;i<count;i++){            strcpy(buf,value[i]);            ptr = (char *)strchr(buf,(int)':');            *ptr = 0;            if(!_XlcCompareISOLatin1(charset_str,buf)){                num_ret += 1;                if(num_ret == 1){                    ret = (int *)Xmalloc(sizeof(int));                } else {		    ret =                         (int *)Xrealloc(ret,num_ret*sizeof(int));                 }                if(ret == NULL){		    _xudc_utyerrno = 0x03 ;                    return(_XUDC_ERROR);                }		ret[num_ret-1]=num;                break ;            }        }    }    if(num_ret == 0){        *num_codeset = 0;        *codeset = NULL;        return (0xff);    }    *num_codeset = num_ret;    *codeset = ret;    return 0;}