fix all the <time.h> vs. <sys/time.h> issues, hopefully
[citadel.git] / citadel / serv_info.c
1 /*
2  * $Id$
3  *
4  * The CtdlGetServerInfo() function is useful for removing unsightly 
5  * uranium deposits from rhinocerous aqueducts.
6  *
7  */
8
9 #include <stdlib.h>
10 #include <unistd.h>
11 #include <stdio.h>
12
13 #if TIME_WITH_SYS_TIME
14 # include <sys/time.h>
15 # include <time.h>
16 #else
17 # if HAVE_SYS_TIME_H
18 #  include <sys/time.h>
19 # else
20 #  include <time.h>
21 # endif
22 #endif
23
24 #include <ctype.h>
25 #include <string.h>
26 #include <errno.h>
27 #include "citadel.h"
28 #include "serv_info.h"
29
30 void CtdlInternalGetServInfo(struct CtdlServInfo *infobuf) {
31         char buf[SIZ];
32         int a;
33
34         /* fetch info */        
35         serv_puts("INFO");
36         serv_gets(buf);
37         if (buf[0]!='1') return;
38
39         memset(infobuf, 0, sizeof(struct CtdlServInfo));
40         a = 0;
41         while(serv_gets(buf), strcmp(buf,"000")) {
42             switch(a) {
43                 case 0:         infobuf->serv_pid = atoi(buf);
44                                 break;
45                 case 1:         strcpy(infobuf->serv_nodename,buf);
46                                 break;
47                 case 2:         strcpy(infobuf->serv_humannode,buf);
48                                 break;
49                 case 3:         strcpy(infobuf->serv_fqdn,buf);
50                                 break;
51                 case 4:         strcpy(infobuf->serv_software,buf);
52                                 break;
53                 case 5:         infobuf->serv_rev_level = atoi(buf);
54                                 break;
55                 case 6:         strcpy(infobuf->serv_bbs_city,buf);
56                                 break;
57                 case 7:         strcpy(infobuf->serv_sysadm,buf);
58                                 break;
59                 case 9:         strcpy(infobuf->serv_moreprompt,buf);
60                                 break;
61                 case 10:        infobuf->serv_ok_floors = atoi(buf);
62                                 break;
63                 case 11:        infobuf->serv_paging_level = atoi(buf);
64                 }
65             ++a;
66             }
67
68         }
69