]> code.citadel.org Git - citadel.git/blob - citadel/migratenet.c
* migratenet.c: added (not even close to being finished)
[citadel.git] / citadel / migratenet.c
1 /*
2  * $Id$
3  * 
4  * 5.80 to 5.90 migration utility for network files
5  *
6  */
7
8 #include <stdlib.h>
9 #include <unistd.h>
10 #include <stdio.h>
11 #include <string.h>
12 #include "citadel.h"
13 #include "ipc.h"
14 #include "tools.h"
15
16 extern struct config config;
17
18 void logoff(int code)
19 {
20         exit(code);
21 }
22
23 int main(int argc, char **argv)
24 {
25         char buf[SIZ];
26         char hostbuf[SIZ];
27         char portbuf[SIZ];
28
29         printf("\n\n\n\n\n"
30 "This utility migrates your network settings (room sharing with other\n"
31 "Citadel systems) from 5.80 to 5.90.  You should only do this ONCE.  It\n"
32 "will ERASE your 5.80 configuration files when it is finished, and it will\n"
33 "ERASE any 5.90 configuration files that you have already set up.\n\n"
34 "Are you sure you want to do this? ");
35
36         gets(buf);
37         if (tolower(buf[0]) != 'y') exit(0);
38
39         get_config();
40
41         attach_to_server(argc, argv, hostbuf, portbuf);
42         serv_gets(buf);
43         printf("%s\n", &buf[4]);
44         if ((buf[0]!='2')&&(strncmp(buf,"551",3))) {
45                 fprintf(stderr,"%s: %s\n",argv[0],&buf[4]);
46                 logoff(atoi(buf));
47         }
48
49         printf("%s\n", buf);
50         serv_puts(buf);
51         serv_gets(buf);
52         fprintf(stderr, "%s\n", &buf[4]);
53         if (buf[0] != '2') {
54                 exit(2);
55         }
56
57
58         printf("FIXME not finished yet\n");
59 }