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

version» Context lines:

pike.git/lib/modules/Stdio.pmod/Readline.pike:1: - // $Id: Readline.pike,v 1.5 1999/03/23 15:25:23 marcus Exp $ + // $Id: Readline.pike,v 1.6 1999/03/23 18:01:48 marcus Exp $      class OutputController   {    static private object outfd, term;    static private int xpos = 0, columns = 0;    static private mapping oldattrs = 0;       void disable()    {    catch{
pike.git/lib/modules/Stdio.pmod/Readline.pike:227:    static private int enabled = -1;    static private function(:int) close_callback = 0;    static private string prefix="";    static private mapping(int:function|mapping(string:function)) bindings=([]);    static private function grab_binding = 0;    static private mapping oldattrs = 0;       void destroy()    {    catch{ infd->set_blocking(); }; +  catch{ infd->tcsetattr((["ECHO":1,"ICANON":1])); };    catch{ if(oldattrs) infd->tcsetattr((["ECHO":0,"ICANON":0,"VEOF":0,    "VEOL":0,"VLNEXT":0])&oldattrs); }; -  catch{ infd->tcsetattr((["ECHO":1,"ICANON":1])); }; +     }       static private string process_input(string s)    {    int i;       for (i=0; i<sizeof(s); i++)    {    if (!enabled)    return s[i..];
pike.git/lib/modules/Stdio.pmod/Readline.pike:339:    string data = prefix;    prefix = "";    enabled = 1;    for (;;)    {    prefix = process_input(data);    if (!enabled)    return;    data = prefix+infd->read(1024, 1);    prefix = ""; +  if(!data || !sizeof(data)) { +  disable(); +  return;    }    } -  +  }       void set_close_callback(function (:int) ccb)    {    close_callback = ccb;    }       void nullbindings()    {    bindings = ([]);    }