aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dict.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dict.c')
-rw-r--r--lib/dict.c59
1 files changed, 19 insertions, 40 deletions
diff --git a/lib/dict.c b/lib/dict.c
index d86923a9..06d76992 100644
--- a/lib/dict.c
+++ b/lib/dict.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -20,32 +20,16 @@
*
***************************************************************************/
-#include "setup.h"
+#include "curl_setup.h"
#ifndef CURL_DISABLE_DICT
-/* -- WIN32 approved -- */
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#ifdef WIN32
-#include <time.h>
-#include <io.h>
-#else
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
@@ -64,9 +48,6 @@
#include <sys/select.h>
#endif
-
-#endif
-
#include "urldata.h"
#include <curl/curl.h>
#include "transfer.h"
@@ -76,14 +57,10 @@
#include "strequal.h"
#include "dict.h"
#include "rawstr.h"
-
-#define _MPRINTF_REPLACE /* use our functions only */
-#include <curl/mprintf.h>
-
+#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
-
/*
* Forward declarations.
*/
@@ -105,10 +82,13 @@ const struct Curl_handler Curl_handler_dict = {
ZERO_NULL, /* doing */
ZERO_NULL, /* proto_getsock */
ZERO_NULL, /* doing_getsock */
+ ZERO_NULL, /* domore_getsock */
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
+ ZERO_NULL, /* readwrite */
PORT_DICT, /* defport */
- PROT_DICT /* protocol */
+ CURLPROTO_DICT, /* protocol */
+ PROTOPT_NONE | PROTOPT_NOURLQUERY /* flags */
};
static char *unescape_word(struct SessionHandle *data, const char *inputbuff)
@@ -117,7 +97,7 @@ static char *unescape_word(struct SessionHandle *data, const char *inputbuff)
char *dictp;
char *ptr;
int len;
- char byte;
+ char ch;
int olen=0;
newp = curl_easy_unescape(data, inputbuff, 0, &len);
@@ -129,18 +109,17 @@ static char *unescape_word(struct SessionHandle *data, const char *inputbuff)
/* According to RFC2229 section 2.2, these letters need to be escaped with
\[letter] */
for(ptr = newp;
- (byte = *ptr) != 0;
+ (ch = *ptr) != 0;
ptr++) {
- if((byte <= 32) || (byte == 127) ||
- (byte == '\'') || (byte == '\"') || (byte == '\\')) {
+ if((ch <= 32) || (ch == 127) ||
+ (ch == '\'') || (ch == '\"') || (ch == '\\')) {
dictp[olen++] = '\\';
}
- dictp[olen++] = byte;
+ dictp[olen++] = ch;
}
dictp[olen]=0;
-
- free(newp);
}
+ free(newp);
return dictp;
}
@@ -188,7 +167,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
}
if((word == NULL) || (*word == (char)0)) {
- infof(data, "lookup word is missing");
+ infof(data, "lookup word is missing\n");
word=(char *)"default";
}
if((database == NULL) || (*database == (char)0)) {
@@ -242,7 +221,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
}
if((word == NULL) || (*word == (char)0)) {
- infof(data, "lookup word is missing");
+ infof(data, "lookup word is missing\n");
word=(char *)"default";
}
if((database == NULL) || (*database == (char)0)) {
@@ -278,7 +257,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
int i;
ppath++;
- for (i = 0; ppath[i]; i++) {
+ for(i = 0; ppath[i]; i++) {
if(ppath[i] == ':')
ppath[i] = ' ';
}