pike.git / lib / modules / Stdio.pmod / Terminfo.pmod

version» Context lines:

pike.git/lib/modules/Stdio.pmod/Terminfo.pmod:1: - // $Id: Terminfo.pmod,v 1.13 2002/10/25 15:27:04 jonasw Exp $ + // $Id: Terminfo.pmod,v 1.14 2003/01/20 17:44:01 nilsson Exp $   #pike __REAL_VERSION__         #if constant(thread_create)   #define LOCK object m_key = mutex->lock()   #define UNLOCK destruct(m_key)   #define MUTEX static private object(Thread.Mutex) mutex = Thread.Mutex();   #else   #define LOCK   #define UNLOCK
pike.git/lib/modules/Stdio.pmod/Terminfo.pmod:362:    nums = nums[..sizeof(numnames)-1];    mapping(string:int) tmp = mkmapping(numnames[..sizeof(nums)-1], nums);    foreach (numnames[..sizeof(nums)-1], string name)    if (tmp[name]>=0xfffe)    m_delete(tmp, name);    map += tmp;    }    {    string stroffs = swab(f->read(nstr*2));    string strbuf = f->read(sstr); -  if(strlen(strbuf)==sstr-1 && !bug_compat && (nbool&1)) { +  if(sizeof(strbuf)==sstr-1 && !bug_compat && (nbool&1)) {    // Ugh. Someone didn't pad their bool array properly (one suspects).    f->seek(0);    return load_cap(f, 1);    } -  if(strlen(strbuf)!=sstr) +  if(sizeof(strbuf)!=sstr)    return 0;    array(string) strarr = Array.map(array_sscanf(stroffs, "%2c"*nstr),    lambda(int offs, string buf) {    return offs<0xfffe &&    buf[offs..    search(buf, "\0", offs)-1];    }, strbuf+"\0");    if (sizeof(strarr)>sizeof(strnames))    strarr = strarr[..sizeof(strnames)-1];    mapping(string:string) tmp = mkmapping(strnames[..sizeof(strarr)-1],
pike.git/lib/modules/Stdio.pmod/Terminfo.pmod:414:    static private inherit Stdio.File;       static private string buf="";    static private mapping(string:int|object(Termcap)) cache=([]);    static private int complete_index=0;       void create(string|void filename)    {    if (!filename) {    string tce = [string]getenv("TERMCAP"); -  if (tce && strlen(tce) && tce[0]=='/') +  if (tce && sizeof(tce) && tce[0]=='/')    filename = tce;    else    filename = "/etc/termcap";    }    if (!::open(filename, "r"))    error("failed to open termcap file %O\n", filename);    }       static private void rewind(int|void pos)    {
pike.git/lib/modules/Stdio.pmod/Terminfo.pmod:703:    lambda(string name) {    return cache[name] ||    Terminfo(dir+name[..0]+"/"+name);    });    }       object(Terminfo) load(string term)    {    object(Terminfo) ti;    -  if (!strlen(term)) +  if (!sizeof(term))    return 0;    LOCK;    if (!(ti = cache[term]))    {    if (file_stat(dir+term[..0]+"/"+term))    ti = Terminfo(dir+term[..0]+"/"+term);    if (ti)    cache[term] = ti;    }    UNLOCK;