1 /* Copyright (C) 2000-2004 Thomas Bopp, Thorsten Hampel, Ludger Merkens
2 * Copyright (C) 2003-2010 Martin Baehr
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * $Id: debug.pike.in,v 1.1 2009/09/28 14:19:52 nicke Exp $
20 #include "/usr/local/lib/steam/server/include/classes.h"
30 conn->send_command(14, 0);
35 mapping options = ([ ]);
37 mapping init(array argv)
39 mapping options = ([ ]);
41 array opt=Getopt.find_all_options(argv,aggregate(
42 ({"host",Getopt.HAS_ARG,({"-h","--host"})}),
43 ({"user",Getopt.HAS_ARG,({"-u","--user"})}),
44 ({"port",Getopt.HAS_ARG,({"-p","--port"})}),
47 foreach(opt, array option)
49 options[option[0]]=option[1];
52 options->host="127.0.0.1";
58 options->port=(int)options->port;
60 string server_path = "/usr/local/lib/steam";
62 master()->add_include_path(server_path+"/server/include");
63 master()->add_program_path(server_path+"/server/");
64 master()->add_program_path(server_path+"/conf/");
65 master()->add_program_path(server_path+"/spm/");
66 master()->add_program_path(server_path+"/server/net/coal/");
68 conn = ((program)"client_base.pike")();
70 int start_time = time();
72 werror("Connecting to sTeam server...\n");
73 while ( !conn->connect_server(options->host, options->port) )
75 if ( time() - start_time > 120 )
77 throw (({" Couldn't connect to server. Please check steam.log for details! \n", backtrace()}));
79 werror("Failed to connect... still trying ... (server running ?)\n");
84 if(lower_case(options->user) == "guest")
90 //readln->set_echo( 0 );
93 pw = Input.read_password( sprintf("Password for %s@%s", options->user,
94 options->host), "steam" );
95 //pw=readln->read(sprintf("passwd for %s@%s: ", options->user, options->host));
97 while((err = catch(conn->login(options->user, pw, 1))) && --tries);
98 //readln->set_echo( 1 );
102 werror("Failed to log in!\nWrong Password!\n");
109 int main(int argc, array argv)
112 object _Server=conn->SteamObj(0);