]> code.citadel.org Git - citadel.git/blob - webcit/serv_func.c
started to add wholist
[citadel.git] / webcit / serv_func.c
1 #include <stdlib.h>
2 #include <unistd.h>
3 #include <stdio.h>
4 #include "webcit.h"
5
6 struct serv_info serv_info;
7
8 /*
9  * get info about the server we've connected to
10  */
11 void get_serv_info() {
12         char buf[256];
13         int a;
14
15         serv_printf("IDEN %d|%d|%d|%s|%s",
16                 DEVELOPER_ID,
17                 CLIENT_ID,
18                 CLIENT_VERSION,
19                 SERVER,
20                 ""              /* FIX find out where the user is */
21                 );
22         serv_gets(buf);
23
24         serv_puts("INFO");
25         serv_gets(buf);
26         if (buf[0]!='1') return;
27
28         a = 0;
29         while(serv_gets(buf), strcmp(buf,"000")) {
30             switch(a) {
31                 case 0:         serv_info.serv_pid = atoi(buf);
32                                 break;
33                 case 1:         strcpy(serv_info.serv_nodename,buf);
34                                 break;
35                 case 2:         strcpy(serv_info.serv_humannode,buf);
36                                 break;
37                 case 3:         strcpy(serv_info.serv_fqdn,buf);
38                                 break;
39                 case 4:         strcpy(serv_info.serv_software,buf);
40                                 break;
41                 case 5:         serv_info.serv_rev_level = atoi(buf);
42                                 break;
43                 case 6:         strcpy(serv_info.serv_bbs_city,buf);
44                                 break;
45                 case 7:         strcpy(serv_info.serv_sysadm,buf);
46                                 break;
47                 case 9:         strcpy(serv_info.serv_moreprompt,buf);
48                                 break;
49                 }
50             ++a;
51             }
52         }
53