annotate defaults.c @ 2:fba0b6e6cdc7

Added tag ALPHA for changeset ff5e05767bd3
author darius@midget.dons.net.au
date Tue, 23 Oct 2007 10:09:09 +0930
parents ff5e05767bd3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
1 /* $Id: defaults.c,v 1.1.1.1 1997/12/06 05:41:28 darius Exp $ */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
2
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
3 /* defaults.c
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
4 *
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
5 * Kevin P. Smith 6/11/89
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
6 * Bill Dyess 9/29/93 - moved all default settings to resetDefaults
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
7 * from main
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
8 * Bill Dyess 11/8/93 - created expandFilename function
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
9 * Bill Dyess 11/20/93 - added #include capability
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
10 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
11 #include "copyright2.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
12 #include <stdio.h>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
13 #ifdef hpux
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
14 #include <time.h>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
15 #else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
16 #include <sys/time.h>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
17 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
18 #ifdef __STDC__
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
19 #include <stdlib.h>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
20 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
21 #include<ctype.h>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
22 #include<pwd.h>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
23 #include <string.h>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
24 #include <stdlib.h>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
25 #include "Wlib.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
26 #include "defs.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
27 #include "struct.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
28 #include "data.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
29 #include "proto.h"
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
30
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
31 #define MAXLINE 1024
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
32
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
33 /* list of files to search for [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
34 static char *filelist[] = {".paradiserc",".netrekrc",".xtrekrc",NULL};
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
35
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
36 /* Prototypes */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
37 static FILE *findDefaults P((char *home, char **deffile, char *base));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
38
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
39 char *
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
40 expandFilename(filename)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
41 char *filename;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
42 /* expands ~ (home dir) and environment vars in filenames. This is primarily
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
43 for filenames specified in the .xtrekrc file, where the shell never gets
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
44 a chance to expand them. [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
45 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
46 char buf[MAXLINE], *src = filename, *dest = buf, tmpbuf[MAXLINE],
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
47 *tmppntr, *envpntr;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
48 struct passwd *pw;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
49
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
50 if (!src)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
51 return filename;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
52 while (*src) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
53 if (*src == '~') {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
54 src++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
55 if (*src != '/' && *src) { /* ~username */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
56 tmppntr = tmpbuf;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
57 while (isalpha(*src))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
58 *tmppntr++ = *src++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
59 *tmppntr = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
60 pw = getpwnam(tmpbuf);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
61 if (!pw) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
62 fprintf(stderr, "Error: can't find username %s, inserting ~ literally.\n", tmpbuf);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
63 *dest++ = '~';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
64 strcpy(dest, tmpbuf);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
65 } else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
66 strcpy(dest, pw->pw_dir);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
67 } else { /* just ~, insert $HOME */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
68 envpntr = getenv("HOME");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
69 if (envpntr != NULL)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
70 strcpy(dest, envpntr);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
71 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
72 printf("HOME environment variable missing, ignoring ~.\n");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
73 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
74 while (*dest)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
75 dest++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
76 } else if (*src == '$') {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
77 /* copy the shortest env var that matches */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
78 /* if in {}'s, the work is done for us */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
79 src++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
80 if (*src == '{') {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
81 src++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
82 tmppntr = tmpbuf;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
83 while (*src != '}' && *src)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
84 *tmppntr++ = *src;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
85 *tmppntr = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
86 envpntr = getenv(tmpbuf);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
87 if (envpntr)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
88 strcpy(dest, getenv(tmpbuf));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
89 while (*dest)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
90 dest++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
91 } else if (*src) { /* we have to work */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
92 tmppntr = tmpbuf;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
93 *tmppntr++ = *src++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
94 *tmppntr = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
95 while (!getenv(tmpbuf) && *src) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
96 *tmppntr++ = *src++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
97 *tmppntr = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
98 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
99 if (*src)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
100 strcpy(dest, getenv(tmpbuf));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
101 while (*dest)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
102 dest++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
103 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
104 } else if (*src == '\\') { /* escaped char */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
105 src++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
106 if (*src)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
107 *dest++ = *src++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
108 } else { /* just a regular char */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
109 *dest++ = *src++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
110 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
111 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
112 *dest = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
113 dest = (char *) realloc(filename, strlen(buf) + 1);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
114 strcpy(dest, buf);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
115 return dest;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
116 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
117
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
118 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
119 freeDefaults()
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
120 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
121 struct stringlist *tmp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
122 while (defaults) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
123 tmp = defaults;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
124 defaults = defaults->next;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
125 free(tmp->string);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
126 free(tmp->value);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
127 free(tmp);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
128 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
129 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
130
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
131 char *
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
132 initDefaults(deffile)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
133 char *deffile; /* As opposed to defile? */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
134 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
135 FILE *fp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
136 char buf[MAXLINE];
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
137 char *includeFile;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
138 char *home;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
139 char *v, *r;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
140 struct stringlist *new;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
141 int ok, i;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
142 int skip = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
143
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
144 /* if(defaults) freeDefaults(); */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
145 if (!deffile) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
146 deffile = (char *) malloc(256);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
147 home = getenv("HOME");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
148 #ifdef AMIGA
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
149 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
150 This is VERY MISLEADING. Really want to say home="netrek:" but
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
151 that causes other problems. ixemul.library will translate
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
152 "/netrek" into "netrek:" Unless configured not to. Does by
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
153 default. Yuck, what a mess. -JR
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
154 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
155 if (!home)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
156 home = "/netrek";
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
157 #endif /* AMIGA */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
158 for(i = 0;filelist[i];i++) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
159 /* home == NULL means search the current directory [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
160 fp = findDefaults(NULL, &deffile, filelist[i]);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
161 if(fp) break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
162 fp = findDefaults(home, &deffile, filelist[i]);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
163 if(fp) break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
164 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
165 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
166 fp = fopen(deffile, "r");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
167 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
168 #ifdef SYS_RC
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
169 if (!fp) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
170 fp = fopen(SYS_RC, "r");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
171 if (!fp)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
172 return deffile;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
173 printf("Using %s as defaults file.\n", SYS_RC);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
174 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
175 printf("Using %s as defaults file.\n", deffile);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
176 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
177 #else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
178 if (!fp)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
179 return deffile;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
180 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
181 printf("Reading defaults from %s.\n", deffile);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
182 while (fgets(buf, MAXLINE - 1, fp)) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
183 if (skip) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
184 skip = strncmpi(buf, "paradise-include", 16);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
185 continue;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
186 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
187 skip = !strncmpi(buf, "paradise-exclude", 16);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
188 if (skip)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
189 continue;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
190 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
191 /* if (*buf=='#' || *buf==';') continue; */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
192 v = buf;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
193 if (*buf == '#') {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
194 if (strncmpi(buf + 1, "include", 7) == 0) { /* #include statement */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
195 v = buf + 8;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
196 ok = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
197 while (*v == ' ' || *v == '<' || *v == '"') {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
198 if (*v != ' ')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
199 ok = 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
200 v++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
201 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
202 if (!ok)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
203 continue; /* must have " or < before filename */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
204 includeFile = strdup(v);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
205 r = includeFile + strlen(includeFile) - 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
206 *r = 0; /* remove trailing \n */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
207 r--;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
208 ok = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
209 while ((*r == '"' || *r == '>' || *r == ' ') && r > includeFile) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
210 if (*r != ' ')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
211 ok = 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
212 *r = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
213 r--;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
214 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
215 if (!ok || r <= includeFile)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
216 continue; /* if no ending '>' or '"' */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
217 /* or no filename, forget it */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
218 includeFile = expandFilename(includeFile);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
219 initDefaults(includeFile); /* recursively add the file */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
220 free(includeFile);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
221 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
222 continue;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
223 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
224 if (*buf != 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
225 buf[strlen(buf) - 1] = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
226 while (*v != ':' && *v != 0) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
227 v++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
228 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
229 if (*v == 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
230 continue;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
231 *v = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
232 v++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
233 while (*v == ' ' || *v == '\t') {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
234 v++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
235 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
236 if (*v != 0) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
237 new = (struct stringlist *) malloc(sizeof(struct stringlist));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
238 new->next = defaults;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
239 if(defaults)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
240 defaults->prev=new;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
241 new->prev = NULL;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
242 new->string = strdup(buf);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
243 new->value = strdup(v);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
244 new->searched = 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
245 defaults = new;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
246 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
247 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
248 fclose(fp);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
249 return deffile;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
250 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
251
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
252 #if 0
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
253 char *
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
254 strdup(str)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
255 char *str;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
256 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
257 char *s;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
258
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
259 s = (char *) malloc(strlen(str) + 1);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
260 strcpy(s, str);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
261 return (s);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
262 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
263 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
264
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
265 /* changed to search the entire defaults list once instead of as many as
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
266 three times. This is faster unless you have a "default.nickname:" entry
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
267 for almost every default on every server... -JR */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
268
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
269 char *
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
270 getdefault(str)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
271 char *str;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
272 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
273 struct stringlist *slNick=0, *slFlavor=0, *slNorm=0, *sl;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
274 char tempNick[80], tempFlavor[80];
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
275 char *val;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
276
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
277 if (!str)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
278 return NULL;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
279 if (!strlen(str))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
280 return NULL;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
281
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
282 if (defNickName)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
283 sprintf(tempNick, "%s.%s", str, defNickName);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
284
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
285 if (defFlavor)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
286 sprintf(tempFlavor, "%s.%s", str, defFlavor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
287
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
288 for(sl=defaults;sl;sl=sl->next) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
289 if(defNickName && !strcmpi(sl->string, tempNick)) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
290 return sl->value;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
291 /* in case there's ever a reason to keep searching: */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
292 if(!slNick)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
293 slNick=sl;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
294 } else if(defFlavor && !strcmpi(sl->string, tempFlavor)) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
295 if(!slFlavor)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
296 slFlavor = sl;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
297 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
298
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
299 if (!strcmpi(sl->string, str)) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
300 if(!slNorm)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
301 slNorm = sl;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
302 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
303 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
304 if(slNick)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
305 return slNick->value;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
306 if(slFlavor)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
307 return slFlavor->value;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
308 if(slNorm)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
309 return slNorm->value;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
310
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
311 return (NULL);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
312 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
313
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
314 #if NO_STRCMPI && !defined(sgi)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
315 int
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
316 strcmpi(str1, str2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
317 char *str1, *str2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
318 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
319 for (;;) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
320 register char c1 = *str1, c2 = *str2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
321 if (c1 <= 'z' && c1 >= 'a')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
322 c1 += 'A' - 'a';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
323 if (c2 <= 'z' && c2 >= 'a')
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
324 c2 += 'A' - 'a';
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
325 if (c1 != c2)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
326 return (c2 - c1);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
327 if (c1 == 0 || c2 == 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
328 return (0);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
329 str1++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
330 str2++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
331 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
332 return (strcmp(str1, str2));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
333 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
334 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
335
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
336 #if NO_STRNCMPI && !defined(sgi)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
337 int
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
338 strncmpi(str1, str2, len)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
339 char *str1, *str2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
340 int len;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
341 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
342 int i;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
343
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
344 for (i = 0; i < len; i++) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
345 if (tolower(*str1) != tolower(*str2))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
346 return (*str2 - *str1);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
347 if (*str1 == 0 || *str2 == 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
348 return (0);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
349 str1++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
350 str2++;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
351 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
352 return 0;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
353 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
354 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
355
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
356 int
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
357 booleanDefault(def, preferred)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
358 char *def;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
359 int preferred;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
360 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
361 char *str;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
362
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
363 str = getdefault(def);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
364 if (str == NULL)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
365 return (preferred);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
366 if (!strcmpi(str, "on") || !strcmpi(str, "true") || !strcmpi(str, "1")) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
367 return (1);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
368 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
369 return (0);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
370 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
371 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
372
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
373 int
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
374 intDefault(def, preferred)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
375 char *def;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
376 int preferred;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
377 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
378 char *str;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
379
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
380 str = getdefault(def);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
381 if (!str)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
382 return preferred;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
383 return atoi(str);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
384 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
385
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
386 /* gets the default for the given def and returns it if it exists.
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
387 Otherwise returns a fresh copy of the preferred string */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
388 char *
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
389 stringDefault(def, preferred)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
390 char *def;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
391 char *preferred;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
392 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
393 char *str;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
394
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
395 str = getdefault(def);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
396 if (!str)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
397 return strdup(preferred);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
398 return strdup(str);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
399 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
400
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
401 /* no default file given on command line.
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
402 See if serverName is defined. If it exists we look for
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
403 HOME/.xtrekrc-<serverName> and .xtrekrc-<serverName>
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
404 Otherwise we try DEFAULT_SERVER. */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
405 /* modified to accept .paradiserc (or any base filename) 12/21/93 [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
406 /* extended to check for for unadorned base and to return a fp [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
407
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
408 static FILE *
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
409 findDefaults(home, deffile, base)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
410 char *home, **deffile, *base;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
411 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
412 FILE *fp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
413
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
414 /* check base-serverName */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
415 if (serverName) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
416 if (home)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
417 sprintf(*deffile, "%s/%s-%s", home, base, serverName);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
418 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
419 sprintf(*deffile, "%s-%s", base, serverName);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
420 fp = fopen(*deffile, "r");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
421 if (fp)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
422 return fp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
423 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
424 /* check base-DEFAULT_SERVER */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
425 if (home)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
426 sprintf(*deffile, "%s/%s-%s", home, base, DEFAULT_SERVER);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
427 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
428 sprintf(*deffile, "%s-%s", base, DEFAULT_SERVER);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
429 fp = fopen(*deffile, "r");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
430 if (fp)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
431 return fp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
432
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
433 /* check just base */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
434 if (home)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
435 sprintf(*deffile, "%s/%s", home, base);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
436 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
437 strcpy(*deffile, base);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
438 fp = fopen(*deffile, "r");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
439 return fp;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
440 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
441
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
442 /* default ship code, courtesy of Robert Blackburn <blackburn@Virginia.EDU>.
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
443 used by main(), modified to accept 2 letter initials 11/15/91 TC */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
444 /* modified to accept pt/ut's 10/10/93 [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
445
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
446 int
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
447 defaultShip(preferred)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
448 int preferred;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
449 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
450 char *type;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
451
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
452 type = getdefault("defaultship");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
453 if (type == NULL)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
454 return preferred;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
455 if ((strcmpi(type, "scout") == 0) || (strcmpi(type, "SC") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
456 return SCOUT;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
457 else if ((strcmpi(type, "destroyer") == 0) || (strcmpi(type, "DD") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
458 return DESTROYER;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
459 else if ((strcmpi(type, "cruiser") == 0) || (strcmpi(type, "CA") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
460 return CRUISER;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
461 else if ((strcmpi(type, "battleship") == 0) || (strcmpi(type, "BB") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
462 return BATTLESHIP;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
463 else if ((strcmpi(type, "assault") == 0) || (strcmpi(type, "AS") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
464 return ASSAULT;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
465 else if ((strcmpi(type, "starbase") == 0) || (strcmpi(type, "SB") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
466 return STARBASE;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
467 else if ((strcmpi(type, "jumpship") == 0) || (strcmpi(type, "JS") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
468 return JUMPSHIP;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
469 else if ((strcmpi(type, "warbase") == 0) || (strcmpi(type, "WB") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
470 return WARBASE;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
471 else if ((strcmpi(type, "flagship") == 0) || (strcmpi(type, "FL") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
472 return FLAGSHIP;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
473 else if ((strcmpi(type, "lightcruiser") == 0) || (strcmpi(type, "CL") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
474 return LIGHTCRUISER;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
475 else if ((strcmpi(type, "carrier") == 0) || (strcmpi(type, "CV") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
476 return CARRIER;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
477 else if ((strcmpi(type, "patrol") == 0) || (strcmpi(type, "PT") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
478 return PATROL;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
479 else if ((strcmpi(type, "utility") == 0) || (strcmpi(type, "UT") == 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
480 return UTILITY;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
481 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
482 return preferred;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
483 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
484
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
485 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
486 initLogFile()
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
487 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
488 if (logFile && logmess) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
489 logfilehandle = fopen(logFile, "a");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
490 if (!logfilehandle) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
491 fprintf(stderr, "Can't open %s: ", logFile);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
492 perror("");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
493 logFile = NULL;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
494 } else {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
495 printf("Opening %s for logging\n", logFile);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
496 fprintf(logfilehandle, "\n-----------------------------------------------------------------\nStarted logging for server %s at%s\n-----------------------------------------------------------------\n",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
497 serverName, timeString(time(NULL)));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
498 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
499 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
500 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
501
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
502 void
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
503 resetDefaults()
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
504 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
505 char *buf;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
506 #ifdef AUTHORIZE
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
507 if (RSA_Client >= 0)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
508 RSA_Client = booleanDefault("useRSA", RSA_Client);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
509 else
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
510 RSA_Client = (RSA_Client == -2);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
511 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
512
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
513
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
514 showShields = booleanDefault("showshields", showShields);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
515 showStats = booleanDefault("showstats", showStats);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
516 keeppeace = booleanDefault("keeppeace", keeppeace);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
517 reportKills = booleanDefault("reportkills", reportKills);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
518 #if 0
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
519 blk_altbits = booleanDefault("altbitmaps", blk_altbits);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
520 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
521 blk_showStars = booleanDefault("showstars", blk_showStars);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
522 showMySpeed = booleanDefault("showMySpeed", showMySpeed);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
523 showTractorPressor = booleanDefault("showTractorPressor",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
524 showTractorPressor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
525 /* show all tractor/pressor beams, not just your own [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
526 showAllTractorPressor = booleanDefault("showAllTractorPressor",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
527 showAllTractorPressor);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
528 showLock = intDefault("showLock", showLock);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
529 drawgrid = booleanDefault("showgrid", drawgrid);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
530 showgalactic = intDefault("showgalactic", showgalactic);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
531 showlocal = intDefault("showlocal", showlocal);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
532 namemode = booleanDefault("namemode", namemode);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
533
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
534 Dashboard = booleanDefault("newDashboard", Dashboard);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
535 cup_half_full = booleanDefault("newDashboard2", cup_half_full);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
536 if (cup_half_full)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
537 Dashboard = 2;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
538 Dashboard = intDefault("Dashboard", Dashboard);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
539
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
540 unixSoundPath = stringDefault("soundPath", "?");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
541 unixSoundDev = stringDefault("soundDev", "?");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
542
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
543 cloakchars = stringDefault("cloakchars", "??");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
544 cloakcharslen = strlen(cloakchars);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
545
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
546 showPhaser = intDefault("showPhaser", showPhaser);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
547 logmess = booleanDefault("logging", logmess);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
548 logFile = getdefault("logfile");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
549 if(logFile)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
550 logFile=expandFilename(strdup(logFile));
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
551
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
552 initLogFile();
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
553 #ifdef VARY_HULL
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
554 vary_hull = booleanDefault("warnhull", vary_hull);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
555 #endif /* VARY_HULL */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
556
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
557 #ifdef TOOLS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
558 shelltools = booleanDefault("shellTools", shelltools);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
559 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
560 warpStreaks = booleanDefault("warpStreaks", warpStreaks);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
561 use_msgw = booleanDefault("useMsgw", use_msgw);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
562 logPhaserMissed = booleanDefault("logPhaserMissed", logPhaserMissed);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
563 phaserStats = booleanDefault("phaserStats", phaserStats);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
564 jubileePhasers = booleanDefault("jubileePhasers", jubileePhasers);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
565 show_shield_dam = booleanDefault("showShieldDam", show_shield_dam);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
566 updateSpeed = intDefault("udpupdates", updateSpeed);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
567 updateSpeed = intDefault("updatespersecond", updateSpeed);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
568 updateSpeed = intDefault("updatespersec", updateSpeed);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
569 extraBorder = booleanDefault("extraAlertBorder", extraBorder);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
570 if (booleanDefault("galacticfrequent", 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
571 mapmode = GMAP_FREQUENT;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
572 #ifdef CONTINUOUS_MOUSE
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
573 continuousMouse = booleanDefault("continuousMouse", continuousMouse);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
574 if (continuousMouse)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
575 buttonRepeatMask = 1 << W_LBUTTON | 1 << W_RBUTTON | 1 << W_MBUTTON;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
576 clickDelay = intDefault("clickDelay", clickDelay);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
577 if (booleanDefault("continuousMouse.L", 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
578 buttonRepeatMask |= 1 << W_LBUTTON;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
579 if (booleanDefault("continuousMouse.M", 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
580 buttonRepeatMask |= 1 << W_MBUTTON;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
581 if (booleanDefault("continuousMouse.R", 0))
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
582 buttonRepeatMask |= 1 << W_RBUTTON;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
583 if (buttonRepeatMask)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
584 continuousMouse = 1;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
585 #endif /* CONTINUOUS_MOUSE */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
586 autoQuit = intDefault("autoQuit", autoQuit);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
587 if (autoQuit > 199) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
588 autoQuit = 199;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
589 printf("autoQuit reduced to 199\n");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
590 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
591 pigSelf = booleanDefault("pigSelf", pigSelf);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
592 /* info icon shows info in place of the icon bitmap [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
593 infoIcon = booleanDefault("infoIcon", infoIcon);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
594 showGalacticSequence = stringDefault("showGalacticSequence", "012345");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
595 for (buf = showGalacticSequence; *buf; buf++) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
596 if (*buf - '0' > 5) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
597 fprintf(stderr, "Error in showGalacticSequence: %d too high, ignoring\n", *buf);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
598 free(showGalacticSequence);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
599 showGalacticSequence = strdup("012345");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
600 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
601 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
602 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
603 showLocalSequence = stringDefault("showLocalSequence", "01234");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
604 for (buf = showLocalSequence; *buf; buf++) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
605 if (*buf - '0' > 4) {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
606 fprintf(stderr, "Error in showLocalSequence: %d too high, ignoring\n", *buf);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
607 free(showLocalSequence);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
608 showLocalSequence = strdup("01234");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
609 break;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
610 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
611 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
612
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
613 #ifdef ATM
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
614 udpDebug = booleanDefault("udpDebug", udpDebug);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
615 udpClientSend = intDefault("udpClientSend", udpClientSend);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
616 /* note: requires send */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
617 udpClientRecv = intDefault("udpClientReceive", udpClientRecv);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
618 tryUdp = booleanDefault("tryUdp", tryUdp);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
619 udpSequenceChk = booleanDefault("udpSequenceCheck", udpSequenceChk);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
620 #endif /* ATM */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
621
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
622 tryShort = booleanDefault("tryShort", tryShort); /* auto-try S_P [BDyess] */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
623
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
624 /* playerlist settings */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
625 robsort = booleanDefault("robsort", robsort);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
626 sortPlayers = booleanDefault("sortPlayers", sortPlayers);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
627 hideNoKills = booleanDefault("hidenokills", hideNoKills);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
628 showDead = booleanDefault("showDead", showDead);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
629 showPreLogins = booleanDefault("showPreLogins", showPreLogins);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
630 sortOutfitting = booleanDefault("sortOutfitting", sortOutfitting);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
631 timerType = intDefault("timertype", timerType);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
632 #ifdef WIDE_PLIST
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
633 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
634 default: old playerlist (ie, no format string), number shiptype rank
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
635 name kills wins losses ratio offense defense di, number shiptype name
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
636 kills login ratio totalrating di [BDyess]
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
637 */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
638 playerListStart = stringDefault("playerList",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
639 ",nTRNKWLr O D d,nTR N K lrSd");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
640 playerList = playerListStart;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
641 resizePlayerList = booleanDefault("resizePlayerList",resizePlayerList);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
642 #endif /* WIDE_PLIST */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
643
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
644 #ifdef PACKET_LIGHTS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
645 packetLights = booleanDefault("packetLights", packetLights);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
646 #endif /* PACKET_LIGHTS */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
647
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
648 viewBox = booleanDefault("viewBox", viewBox);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
649 sectorNums = booleanDefault("sectorNums", sectorNums);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
650 lockLine = booleanDefault("lockLine", lockLine);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
651 mapSort = booleanDefault("mapSort", mapSort);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
652 autoSetWar = intDefault("autoSetWar", autoSetWar);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
653 tacPlanetInfo = intDefault("tacPlanetInfo", tacPlanetInfo);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
654
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
655 /* metaFork = booleanDefault("metaFork",metaFork); */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
656
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
657 keepInfo = intDefault("keepInfo", keepInfo);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
658
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
659 #ifdef NOWARP
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
660 /* if there are alternatives to message warp, use it anyway? -JR */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
661 warp = booleanDefault("messageWarp", warp);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
662 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
663
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
664 #ifdef CHECK_DROPPED
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
665 reportDroppedPackets = booleanDefault("reportDroppedPackets", reportDroppedPackets);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
666 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
667
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
668 askforUpdate = booleanDefault("askforUpdate", askforUpdate);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
669 lowercaset = booleanDefault("lowercaset", lowercaset);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
670 scrollBeep = booleanDefault("scrollBeep", scrollBeep);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
671 #ifdef SHORT_PACKETS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
672 godToAllOnKills = booleanDefault("godToAllOnKills",godToAllOnKills);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
673 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
674
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
675 autoZoom=intDefault("autoZoom", autoZoom);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
676 autoUnZoom = intDefault("autoUnZoom",autoUnZoom);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
677 autoZoomOverride = intDefault("autoZoomOverride",autoZoomOverride);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
678
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
679 #ifdef BEEPLITE
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
680 {
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
681 DefLite = booleanDefault("DefLite", DefLite);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
682 UseLite = booleanDefault("UseLite", UseLite);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
683
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
684 if (DefLite)
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
685 litedefaults();
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
686
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
687 beep_lite_cycle_time_planet = intDefault("planetCycleTime",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
688 beep_lite_cycle_time_planet);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
689 beep_lite_cycle_time_player = intDefault("playerCycleTime",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
690 beep_lite_cycle_time_player);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
691 }
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
692 #endif /* BEEPLITE */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
693
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
694 #ifdef COW_HAS_IT_WHY_SHOULDNT_WE
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
695 showMapAtMotd = booleanDefault("showMapAtMotd",showMapAtMotd);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
696 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
697
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
698 #ifdef LOCAL_SHIPSTATS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
699 localShipStats=booleanDefault("localShipStats",localShipStats);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
700 statString = stringDefault("statString","DSEWF");
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
701 statHeight = intDefault("statHeight",statHeight);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
702 if(statHeight<4) statHeight=4;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
703 if(statHeight>100) statHeight = 100;
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
704 localStatsX = intDefault("localStatsX", localStatsX);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
705 localStatsY = intDefault("localStatsY", localStatsY);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
706 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
707
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
708 #ifdef SHOW_IND
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
709 showIND = booleanDefault("showIND",showIND);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
710 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
711
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
712 #ifdef HOCKEY
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
713 galacticHockeyLines = booleanDefault("galacticHockeyLines",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
714 galacticHockeyLines);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
715 tacticalHockeyLines = booleanDefault("tacticalHockeyLines",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
716 tacticalHockeyLines);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
717 cleanHockeyGalactic = booleanDefault("cleanHockeyGalactic",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
718 cleanHockeyGalactic);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
719 teamColorHockeyLines = booleanDefault("teamColorHockeyLines",
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
720 teamColorHockeyLines);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
721 #endif /*HOCKEY*/
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
722
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
723 #ifdef AMIGA
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
724 getAmigaDefs();
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
725 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
726
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
727 #ifdef SOUND
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
728 getSoundDefs();
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
729 #endif
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
730
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
731 redrawDelay = intDefault("redrawDelay",redrawDelay);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
732
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
733 initkeymap(-1);
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
734 #ifdef MACROS
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
735 initMacros();
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
736 #endif /* MACROS */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
737
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
738 /*
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
739 sendOptionsPacket();
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
740 *//* There is nothing on the server side that should be controlled by
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
741 xtrekrc variables. */
ff5e05767bd3 Empty changelog
darius
parents:
diff changeset
742 }