Update for --socket option
[m6w6/libmemcached] / libmemcached / options / parser.yy
index 8e87230ade8c10e534d2d3c8db618ea31c3948c3..66428b8997cc4af8908607ff831e0ea920c05ba1 100644 (file)
@@ -46,6 +46,8 @@
 #include <libmemcached/options/symbol.h>
 #include <libmemcached/options/scanner.h>
 
+#include <iostream>
+
 #pragma GCC diagnostic ignored "-Wold-style-cast"
 
 int conf_lex(YYSTYPE* lvalp, void* scanner);
@@ -69,6 +71,7 @@ inline void config_error(Context *context, yyscan_t *scanner, const char *error)
 %token CONFIGURE_FILE
 %token EMPTY_LINE
 %token SERVER
+%token SOCKET
 %token SERVERS
 %token SERVERS_OPTION
 %token UNKNOWN_OPTION
@@ -212,6 +215,13 @@ expression:
             }
             context->unset_server();
           }
+        | SOCKET string
+          {
+            if (memcached_failed(context->rc= memcached_server_add_unix_socket(context->memc, $2.c_str)))
+            {
+              parser_abort(context, NULL);
+            }
+          }
         | CONFIGURE_FILE string
           {
             memcached_set_configuration_file(context->memc, $2.c_str, $2.size);