48c701022e621bf98b85bf0c100b6a6db42874b7
[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 #include <time.h>
13 #include <ctype.h>
14 #include <string.h>
15 #include <errno.h>
16 #include "citadel.h"
17 #include "serv_info.h"
18
19 void CtdlInternalGetServInfo(struct CtdlServInfo *infobuf) {
20         char buf[SIZ];
21         int a;
22
23         /* fetch info */        
24         serv_puts("INFO");
25         serv_gets(buf);
26         if (buf[0]!='1') return;
27
28         memset(infobuf, 0, sizeof(struct CtdlServInfo));
29         a = 0;
30         while(serv_gets(buf), strcmp(buf,"000")) {
31             switch(a) {
32                 case 0:         infobuf->serv_pid = atoi(buf);
33                                 break;
34                 case 1:         strcpy(infobuf->serv_nodename,buf);
35                                 break;
36                 case 2:         strcpy(infobuf->serv_humannode,buf);
37                                 break;
38                 case 3:         strcpy(infobuf->serv_fqdn,buf);
39                                 break;
40                 case 4:         strcpy(infobuf->serv_software,buf);
41                                 break;
42                 case 5:         infobuf->serv_rev_level = atoi(buf);
43                                 break;
44                 case 6:         strcpy(infobuf->serv_bbs_city,buf);
45                                 break;
46                 case 7:         strcpy(infobuf->serv_sysadm,buf);
47                                 break;
48                 case 9:         strcpy(infobuf->serv_moreprompt,buf);
49                                 break;
50                 case 10:        infobuf->serv_ok_floors = atoi(buf);
51                                 break;
52                 case 11:        infobuf->serv_paging_level = atoi(buf);
53                 }
54             ++a;
55             }
56
57         }
58