128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
+
-
+
+
+
+
-
+
-
+
+
-
+
-
+
-
+
|
*(ushort *)start = ENET_HOST_TO_NET_16(p - start);
enet_packet_resize(packet, p - start);
return packet;
}
#ifdef STANDALONE
void
void localservertoclient(uchar *buf, int len) {};
localservertoclient(uchar *buf, int len)
{
}
void
fatal(char *s, char *o)
fatal(OFString *s, OFString *o)
{
cleanupserver();
printf("servererror: %s\n", s);
[OFStdOut writeFormat:@"servererror: %@\n", s];
exit(1);
}
};
void *
alloc(int s)
{
void *b = calloc(1, s);
if (!b)
fatal("no memory!");
fatal(@"no memory!");
return b;
};
}
int
main(int argc, char *argv[])
{
int uprate = 0, maxcl = 4;
char *sdesc = "", *ip = "", *master = NULL, *passwd = "";
|
179
180
181
182
183
184
185
186
187
188
189
190
|
184
185
186
187
188
189
190
191
192
193
194
195
|
-
+
|
break;
default:
printf("WARNING: unknown commandline option\n");
};
};
if (enet_initialize() < 0)
fatal("Unable to initialise network module");
fatal(@"Unable to initialise network module");
initserver(true, uprate, sdesc, ip, master, @(passwd), maxcl);
return 0;
}
#endif
|