2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See files README, COPYING and CREDITS in the root of the source
23 * tree for related information and legal notices. It is expected
24 * that future projects/authors will amend these files as needed.
28 * main.c: client main function
30 * Known contributors to this file:
33 * Ron Koenderink, 2004-2005
34 * Markus Armbruster, 2005-2009
49 #define getpwuid(uid) ((void)(uid), w32_getpw())
50 #define sysdep_init() w32_sysdep_init()
52 #define sysdep_init() ((void)0)
56 print_usage(char *program_name)
58 printf("Usage: %s [OPTION]...[COUNTRY [PASSWORD]]\n"
59 " -2 FILE Append log of session to FILE\n"
60 " -k Kill connection\n"
62 " -h display this help and exit\n"
63 " -v display version information and exit\n",
68 main(int argc, char **argv)
71 char *auxfname = NULL;
82 while ((opt = getopt(argc, argv, "2:kuhv")) != EOF) {
91 utf8 = eight_bit_clean = 1;
97 printf("%s\n\n%s", version, legal);
100 print_usage(argv[0]);
109 country = getenv("COUNTRY");
113 passwd = getenv("PLAYER");
114 port = getenv("EMPIREPORT");
117 host = getenv("EMPIREHOST");
120 uname = getenv("LOGNAME");
124 pwd = getpwuid(getuid());
126 fprintf(stderr, "You don't exist. Go away\n");
129 uname = pwd->pw_name;
133 if (auxfname && (auxfp = fopen(auxfname, "a")) == NULL) {
134 fprintf(stderr, "Unable to open %s for append\n", auxfname);
140 sock = tcp_connect(host, port);
142 if (!login(sock, uname, country, passwd, send_kill, utf8))