Mailing list header changes (fuck you Google)
[citadel.git] / ctdlsh / export.c
1 /*
2  * (c) 2009-2014 by Art Cancro and citadel.org
3  * This program is released under the terms of the GNU General Public License v3.
4  */
5
6 #include "ctdlsh.h"
7
8 int cmd_export(int server_socket, char *cmdbuf)
9 {
10         char buf[1024];
11         char export_file_name[1024];
12
13         strcpy(export_file_name, &cmdbuf[7]);
14         if (strlen(export_file_name) == 0) {
15                 strncpy(export_file_name, readline("Enter export file name: "), sizeof export_file_name);
16         }
17
18         sock_printf(server_socket, "MIGR export\n");
19         sock_getln(server_socket, buf, sizeof buf);
20
21         if (buf[0] != '1') {
22                 fprintf(stderr, "%s\n", &buf[4]);
23                 return (cmdret_error);
24         }
25
26         while (sock_getln(server_socket, buf, sizeof buf), strcmp(buf, "000")) {
27
28                 if (!strncmp(buf, "<progress>", 10)) {
29                         fprintf(stderr, "%s\n", buf);
30                 }
31         }
32
33
34
35         return (cmdret_ok);
36 }