comparison pped/main.c @ 2:2719a89505ba

First entry of Paradise Server 2.9 patch 10 Beta
author darius
date Sat, 06 Dec 1997 04:37:01 +0000
parents
children
comparison
equal deleted inserted replaced
1:4d6502ffaa5e 2:2719a89505ba
1 /*
2 * main.c
3 */
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <signal.h>
8 #include <errno.h>
9 #include <struct.h>
10 #include "common.h"
11 #include "main.h"
12 #include "db.h"
13 #include "interface.h"
14 #include "file.h"
15
16 #undef PLAYERFILE
17 #define PLAYERFILE ".players"
18
19
20 static char *myname;
21 char *playerFile;
22
23 int main(int argc, char *argv[])
24 {
25 myname = argv[0];
26
27 if(argc > 2) {
28 fprintf(stderr, "Usage: %s [playerfile]\n", myname);
29 exit(1);
30 }
31 #ifndef SYSV
32 signal(SIGWINCH, getTTYinfo);
33 #endif
34 if(argc == 2)
35 playerFile = argv[1];
36 else
37 playerFile = PLAYERFILE;
38
39 getTTYinfo();
40 if(ReadIt(playerFile)) exit(1);
41 Interface();
42 exit(0);
43 }
44
45 void err(char *s, ...)
46 {
47 va_list ap;
48 char txt[60];
49
50 va_start(ap, s);
51 vsprintf(txt, s, ap);
52 fprintf(stderr, "%s: %s\n", myname, txt);
53 va_end(ap);
54 }
55
56 void err_sys(char *s, ...)
57 {
58 va_list ap;
59 char txt[60];
60 extern int errno;
61 int es;
62
63 es = errno;
64
65 va_start(ap, s);
66 vsprintf(txt, s, ap);
67 fprintf(stderr, "%s: %s: %s\n", myname, txt, strerror(es));
68 va_end(ap);
69 }
70
71 void GoAway(int type)
72 {
73 if(type)
74 if(!Verify("quit? There are unsaved changes."))
75 return;
76
77 printf("\npped version %s by H. Kehoe\n\n", VERSSTR);
78 exit(0);
79 }
80