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.12 2002/08/14 16:02:08 jonasw Exp $ + // $Id: Terminfo.pmod,v 1.13 2003/12/10 15:19:46 jonasw 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:641:    MUTEX       static private string dir;    static private mapping(string:object(Terminfo)) cache = ([]);    static private int complete_index=0;       void create(string|void dirname)    {    if (!dirname)    { -  foreach (({"/usr/share/lib/terminfo", "/usr/share/termcap", +  foreach (({"/usr/share/lib/terminfo", "/usr/share/terminfo", +  "/usr/share/termcap",    "/usr/lib/terminfo", "/usr/share/misc/terminfo"}), string dn)    {    .Stat s = file_stat(dn);    if (s && s->type=="dir")    {    dirname = dn;    break;    }    }    if (!dirname) {
pike.git/lib/modules/Stdio.pmod/Terminfo.pmod:699:       object(Terminfo) load(string term)    {    object(Terminfo) ti;       if (!strlen(term))    return 0;    LOCK;    if (!(ti = cache[term]))    { -  if (file_stat(dir+term[..0]+"/"+term)) +  if (file_stat(dir+term[..0]+"/"+term)) { +  // Traditional Terminfo layout.    ti = Terminfo(dir+term[..0]+"/"+term); -  +  } else if (file_stat(sprintf("%s%02x/%s", dir, term[0], term))) { +  // MacOS X Terminfo layout. +  ti = Terminfo(sprintf("%s%02x/%s", dir, term[0], term)); +  }    if (ti)    cache[term] = ti;    }    UNLOCK;    return ti;    }       object(Terminfo) `[](string name)    {    return load(name);