aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--env.cpp7
-rw-r--r--env_universal.cpp16
-rw-r--r--env_universal_common.cpp96
-rw-r--r--env_universal_common.h33
-rw-r--r--fish.xcodeproj/project.pbxproj2
5 files changed, 9 insertions, 145 deletions
diff --git a/env.cpp b/env.cpp
index 69e0dd11..21e0adee 100644
--- a/env.cpp
+++ b/env.cpp
@@ -345,13 +345,6 @@ static void universal_callback(fish_message_type_t type,
str=L"SET";
break;
}
-
- case ERASE:
- {
- str=L"ERASE";
- break;
- }
-
default:
break;
}
diff --git a/env_universal.cpp b/env_universal.cpp
index 2d2bf304..eb23aff1 100644
--- a/env_universal.cpp
+++ b/env_universal.cpp
@@ -46,11 +46,6 @@
static bool s_env_univeral_inited = false;
static void (*external_callback)(fish_message_type_t type, const wchar_t *name, const wchar_t *val);
-/**
- Flag set to 1 when a barrier reply is recieved
-*/
-static int barrier_reply = 0;
-
void env_universal_barrier();
/**
@@ -58,15 +53,8 @@ void env_universal_barrier();
*/
static void callback(fish_message_type_t type, const wchar_t *name, const wchar_t *val)
{
- if (type == BARRIER_REPLY)
- {
- barrier_reply = 1;
- }
- else
- {
- if (external_callback)
- external_callback(type, name, val);
- }
+ if (external_callback)
+ external_callback(type, name, val);
}
void env_universal_init(void (*cb)(fish_message_type_t type, const wchar_t *name, const wchar_t *val))
diff --git a/env_universal_common.cpp b/env_universal_common.cpp
index 0b73782d..baf94a19 100644
--- a/env_universal_common.cpp
+++ b/env_universal_common.cpp
@@ -7,32 +7,12 @@
*/
#include "config.h"
+#include "env_universal_common.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <wchar.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
#include <sys/un.h>
#include <arpa/inet.h>
-#include <pwd.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <wctype.h>
-
-#include <errno.h>
-#include <locale.h>
-#include <dirent.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
+
#include <sys/mman.h>
-#include <map>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
@@ -44,7 +24,6 @@
#include "common.h"
#include "wutil.h"
#include "utf8.h"
-#include "env_universal_common.h"
#include "path.h"
#include "iothread.h"
@@ -477,24 +456,6 @@ message_t *create_message(fish_message_type_t type,
break;
}
- case ERASE:
- {
- set_body(msg, ERASE_MBS, " ", key, "\n", NULL);
- break;
- }
-
- case BARRIER:
- {
- set_body(msg, BARRIER_MBS, "\n", NULL);
- break;
- }
-
- case BARRIER_REPLY:
- {
- set_body(msg, BARRIER_REPLY_MBS, "\n", NULL);
- break;
- }
-
default:
{
debug(0, L"create_message: Unknown message type");
@@ -540,20 +501,6 @@ connection_t::connection_t(int input_fd) :
{
}
-void connection_destroy(connection_t *c)
-{
- /*
- A connection need not always be open - we only try to close it
- if it is open.
- */
- if (c->fd >= 0)
- {
- if (close(c->fd))
- {
- wperror(L"close");
- }
- }
-}
env_universal_t::env_universal_t(const wcstring &path) : explicit_vars_path(path), tried_renaming(false), last_read_file(kInvalidFileID)
{
@@ -1201,45 +1148,6 @@ void env_universal_t::parse_message_internal(wchar_t *msg, connection_t *src, ca
debug(1, PARSE_ERR, msg);
}
}
- else if (match(msg, ERASE_STR))
- {
- wchar_t *name, *tmp;
-
- name = msg+wcslen(ERASE_STR);
- while (wcschr(L"\t ", *name))
- name++;
-
- tmp = name;
- while (iswalnum(*tmp) || *tmp == L'_')
- tmp++;
-
- *tmp = 0;
-
- if (!wcslen(name))
- {
- debug(1, PARSE_ERR, msg);
- }
-
- this->remove_internal(name, false);
- if (callbacks != NULL)
- {
- callbacks->push_back(callback_data_t(ERASE, name, wcstring()));
- }
- }
- else if (match(msg, BARRIER_STR))
- {
- message_t *msg = create_message(BARRIER_REPLY, 0, 0);
- msg->count = 1;
- src->unsent.push(msg);
- try_send_all(src);
- }
- else if (match(msg, BARRIER_REPLY_STR))
- {
- if (callbacks != NULL)
- {
- callbacks->push_back(callback_data_t(BARRIER_REPLY, wcstring(), wcstring()));
- }
- }
else
{
debug(1, PARSE_ERR, msg);
diff --git a/env_universal_common.h b/env_universal_common.h
index 1dcf6ed4..19e56986 100644
--- a/env_universal_common.h
+++ b/env_universal_common.h
@@ -5,6 +5,7 @@
#include <queue>
#include <string>
#include <set>
+#include "wutil.h"
#include "util.h"
#include "env.h"
@@ -19,40 +20,16 @@
#define SET_EXPORT_STR L"SET_EXPORT"
/**
- The erase command
-*/
-#define ERASE_STR L"ERASE"
-
-/**
- The barrier command
-*/
-#define BARRIER_STR L"BARRIER"
-
-/**
- The barrier_reply command
-*/
-#define BARRIER_REPLY_STR L"BARRIER_REPLY"
-
-
-/**
- The filename to use for univeral variables. The username is appended
-*/
-#define SOCK_FILENAME "fishd.socket."
-
-/**
- The different types of commands that can be sent between client/server
+ The different types of messages found in the fishd file
*/
typedef enum
{
SET,
- SET_EXPORT,
- ERASE,
- BARRIER,
- BARRIER_REPLY,
+ SET_EXPORT
} fish_message_type_t;
/**
- The size of the buffer used for reading from the socket
+ The size of the buffer used for reading from the file
*/
#define ENV_UNIVERSAL_BUFFER_SIZE 1024
@@ -67,7 +44,7 @@ typedef struct
int count;
/**
- Message body. The message must be allocated using enough memory to actually contain the message.
+ Message body.
*/
std::string body;
diff --git a/fish.xcodeproj/project.pbxproj b/fish.xcodeproj/project.pbxproj
index aecda2bd..32ba442b 100644
--- a/fish.xcodeproj/project.pbxproj
+++ b/fish.xcodeproj/project.pbxproj
@@ -406,7 +406,6 @@
D0A0853F13B3ACEE0099B651 /* fish_indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fish_indent.cpp; sourceTree = "<group>"; };
D0A0854113B3ACEE0099B651 /* fish_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fish_tests.cpp; sourceTree = "<group>"; };
D0A0854213B3ACEE0099B651 /* fish.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fish.cpp; sourceTree = "<group>"; };
- D0A0854313B3ACEE0099B651 /* fishd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fishd.cpp; sourceTree = "<group>"; };
D0A0854413B3ACEE0099B651 /* function.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = function.cpp; sourceTree = "<group>"; };
D0A0854713B3ACEE0099B651 /* highlight.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = highlight.cpp; sourceTree = "<group>"; };
D0A0854813B3ACEE0099B651 /* history.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = history.cpp; sourceTree = "<group>"; };
@@ -600,7 +599,6 @@
D0A0853F13B3ACEE0099B651 /* fish_indent.cpp */,
D0A0854113B3ACEE0099B651 /* fish_tests.cpp */,
D0A0854213B3ACEE0099B651 /* fish.cpp */,
- D0A0854313B3ACEE0099B651 /* fishd.cpp */,
D00F63F019137E9D00FCCDEC /* fish_version.cpp */,
D0A0851113B3ACEE0099B651 /* highlight.h */,
D0A0854713B3ACEE0099B651 /* highlight.cpp */,