2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2008, 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-2008
49 #define getpwuid(uid) ((void)(uid), w32_getpw())
51 #define sysdep_init() ((void)0)
55 print_usage(char *program_name)
57 printf("Usage: %s [OPTION]...[COUNTRY [PASSWORD]]\n"
58 " -2 FILE Append log of session to FILE\n"
59 " -k Kill connection\n"
61 " -h display this help and exit\n"
62 " -v display version information and exit\n",
67 main(int argc, char **argv)
70 char *auxfname = NULL;
81 while ((opt = getopt(argc, argv, "2:kuhv")) != EOF) {
90 utf8 = eight_bit_clean = 1;
96 printf("%s\n\n%s", version, legal);
108 country = getenv("COUNTRY");
112 passwd = getenv("PLAYER");
113 port = getenv("EMPIREPORT");
116 host = getenv("EMPIREHOST");
119 uname = getenv("LOGNAME");
123 pwd = getpwuid(getuid());
125 fprintf(stderr, "You don't exist. Go away\n");
128 uname = pwd->pw_name;
132 if (auxfname && (auxfp = fopen(auxfname, "a")) == NULL) {
133 fprintf(stderr, "Unable to open %s for append\n", auxfname);
139 sock = tcp_connect(host, port);
141 if (!login(sock, uname, country, passwd, send_kill, utf8))