~ubuntu-branches/ubuntu/hardy/steam/hardy

« back to all changes in this revision

Viewing changes to server/net/base/readline.pike

  • Committer: Bazaar Package Importer
  • Author(s): Alain Schroeder
  • Date: 2006-11-21 16:03:12 UTC
  • mfrom: (2.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061121160312-nf96y6nihzsyd2uv
Tags: 2.2.31-3
Add patch to prevent inconsistent data after shutdown.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *  along with this program; if not, write to the Free Software
15
15
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 * 
17
 
 * $Id: readline.pike,v 1.1.1.1 2005/02/23 14:47:21 cvs Exp $
 
17
 * $Id: readline.pike,v 1.1.1.1 2006/03/27 12:40:18 exodusd Exp $
18
18
 */
19
19
 
20
 
constant cvs_version="$Id: readline.pike,v 1.1.1.1 2005/02/23 14:47:21 cvs Exp $";
21
 
 
22
 
 
23
 
inherit Stdio.File;
 
20
constant cvs_version="$Id: readline.pike,v 1.1.1.1 2006/03/27 12:40:18 exodusd Exp $";
24
21
 
25
22
#include <macros.h>
26
23
 
 
24
static object _fd;
 
25
 
27
26
/**
28
27
 * Process an incomming command. Called for each CR-LF Line.
29
28
 *  
90
89
91
90
  if( readln->readline )
92
91
  { 
93
 
    readln->readline->write("-\n", 1);
94
 
    process_command("connect"); 
95
 
    // initialize the command loop
96
 
    // if we don't do this here, then the initial messages would have to
97
 
    // be sent from create and init_readline would mess them up
98
 
    return;
 
92
      werror("Readline initialized !\n");
 
93
      readln->readline->set_echo(1);
 
94
      readln->readline->write("-\n", 1);
 
95
      process_command("connect"); 
 
96
      // initialize the command loop
 
97
      // if we don't do this here, then the initial messages would have to
 
98
      // be sent from create and init_readline would mess them up
 
99
      return;
99
100
  }
100
101
  n++;
101
102
  if( n < 100 )
132
133
 
133
134
void create(object f)
134
135
{
135
 
  ::assign(f);
136
 
  readln = Protocols.TELNET.Readline(this_object(), read_callback, 0, 0, 0);
137
 
  init_readline();
 
136
    _fd = f;
 
137
    readln = Protocols.TELNET.Readline(f, read_callback, 0, 0, 0);
 
138
    init_readline();
138
139
}
139
140
 
140
141
/**
145
146
 */
146
147
string|int get_ip()
147
148
{
148
 
    string addr = query_address();
149
 
    LOG("query_adress() returns " + addr);
 
149
    string addr = _fd->query_address();
150
150
    string ip = 0;
151
151
    if ( stringp(addr) )
152
152
        sscanf(addr, "%s %*d", ip);