summaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-conversation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/gnunet-conversation.c')
-rw-r--r--src/conversation/gnunet-conversation.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c
index 20765bbf6..bf044a4f8 100644
--- a/src/conversation/gnunet-conversation.c
+++ b/src/conversation/gnunet-conversation.c
@@ -29,9 +29,6 @@
29#include "gnunet_gnsrecord_lib.h" 29#include "gnunet_gnsrecord_lib.h"
30#include "gnunet_conversation_service.h" 30#include "gnunet_conversation_service.h"
31#include "gnunet_namestore_service.h" 31#include "gnunet_namestore_service.h"
32#ifdef WINDOWS
33#include "../util/gnunet-helper-w32-console.h"
34#endif
35 32
36/** 33/**
37 * Maximum length allowed for the command line input. 34 * Maximum length allowed for the command line input.
@@ -42,13 +39,6 @@
42 39
43#define STRINGIFY(x) (#x) 40#define STRINGIFY(x) (#x)
44 41
45#ifdef WINDOWS
46/**
47 * Helper that reads the console for us.
48 */
49struct GNUNET_HELPER_Handle *stdin_hlp;
50#endif
51
52/** 42/**
53 * Possible states of the phone. 43 * Possible states of the phone.
54 */ 44 */
@@ -1016,13 +1006,6 @@ static void
1016do_stop_task(void *cls) 1006do_stop_task(void *cls)
1017{ 1007{
1018 (void)cls; 1008 (void)cls;
1019#ifdef WINDOWS
1020 if (NULL != stdin_hlp)
1021 {
1022 GNUNET_HELPER_stop(stdin_hlp, GNUNET_NO);
1023 stdin_hlp = NULL;
1024 }
1025#endif
1026 if (NULL != call) 1009 if (NULL != call)
1027 { 1010 {
1028 GNUNET_CONVERSATION_call_stop(call); 1011 GNUNET_CONVERSATION_call_stop(call);
@@ -1090,38 +1073,6 @@ handle_command_string(char *message, size_t str_len)
1090} 1073}
1091 1074
1092 1075
1093#ifdef WINDOWS
1094static int
1095console_reader_chars(void *cls,
1096 void *client,
1097 const struct GNUNET_MessageHeader *message)
1098{
1099 char *chars;
1100 size_t str_size;
1101
1102 (void)cls;
1103 switch (ntohs(message->type))
1104 {
1105 case GNUNET_MESSAGE_TYPE_W32_CONSOLE_HELPER_CHARS:
1106 chars = (char *)&message[1];
1107 str_size = ntohs(message->size) - sizeof(struct GNUNET_MessageHeader);
1108 if (chars[str_size - 1] != '\0')
1109 return GNUNET_SYSERR;
1110 /* FIXME: is it ok that we pass part of a const struct to
1111 * this function that may mangle the contents?
1112 */
1113 handle_command_string(chars, str_size - 1);
1114 break;
1115
1116 default:
1117 GNUNET_break(0);
1118 break;
1119 }
1120 return GNUNET_OK;
1121}
1122#endif
1123
1124
1125/** 1076/**
1126 * Task to handle commands from the terminal. 1077 * Task to handle commands from the terminal.
1127 * 1078 *
@@ -1213,30 +1164,6 @@ run(void *cls,
1213 return; 1164 return;
1214 } 1165 }
1215 id = GNUNET_IDENTITY_connect(cfg, &identity_cb, NULL); 1166 id = GNUNET_IDENTITY_connect(cfg, &identity_cb, NULL);
1216#ifdef WINDOWS
1217 if (stdin_fh == NULL)
1218 {
1219 static char cpid[64];
1220 static char *args[] = { "gnunet-helper-w32-console.exe",
1221 "chars",
1222 XSTRINGIFY(MAX_MESSAGE_LENGTH),
1223 cpid,
1224 NULL };
1225 snprintf(cpid, 64, "%d", GetCurrentProcessId());
1226 stdin_hlp = GNUNET_HELPER_start(GNUNET_NO,
1227 "gnunet-helper-w32-console",
1228 args,
1229 console_reader_chars,
1230 NULL,
1231 NULL);
1232 if (NULL == stdin_hlp)
1233 {
1234 fprintf(stderr, "%s", _("Failed to start gnunet-helper-w32-console\n"));
1235 return;
1236 }
1237 }
1238 else
1239#endif
1240 handle_cmd_task = 1167 handle_cmd_task =
1241 GNUNET_SCHEDULER_add_with_priority(GNUNET_SCHEDULER_PRIORITY_UI, 1168 GNUNET_SCHEDULER_add_with_priority(GNUNET_SCHEDULER_PRIORITY_UI,
1242 &handle_command, 1169 &handle_command,
@@ -1271,21 +1198,12 @@ main(int argc, char *const *argv)
1271 GNUNET_GETOPT_OPTION_END }; 1198 GNUNET_GETOPT_OPTION_END };
1272 int ret; 1199 int ret;
1273 1200
1274#ifndef WINDOWS
1275 int flags; 1201 int flags;
1276 flags = fcntl(0, F_GETFL, 0); 1202 flags = fcntl(0, F_GETFL, 0);
1277 flags |= O_NONBLOCK; 1203 flags |= O_NONBLOCK;
1278 if (0 != fcntl(0, F_SETFL, flags)) 1204 if (0 != fcntl(0, F_SETFL, flags))
1279 GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "fcntl"); 1205 GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "fcntl");
1280 stdin_fh = GNUNET_DISK_get_handle_from_int_fd(0); 1206 stdin_fh = GNUNET_DISK_get_handle_from_int_fd(0);
1281#else
1282 if (FILE_TYPE_CHAR == GetFileType((HANDLE)_get_osfhandle(0)))
1283 {
1284 stdin_fh = NULL;
1285 }
1286 else
1287 stdin_fh = GNUNET_DISK_get_handle_from_int_fd(0);
1288#endif
1289 1207
1290 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args(argc, argv, &argc, &argv)) 1208 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args(argc, argv, &argc, &argv))
1291 return 2; 1209 return 2;