Removal of more fishd artifacts and headers

This commit is contained in:
ridiculousfish 2014-06-09 12:07:40 -07:00
parent ecf56606dc
commit ef646f0f78
5 changed files with 8 additions and 144 deletions

View file

@ -345,13 +345,6 @@ static void universal_callback(fish_message_type_t type,
str=L"SET"; str=L"SET";
break; break;
} }
case ERASE:
{
str=L"ERASE";
break;
}
default: default:
break; break;
} }

View file

@ -46,28 +46,16 @@
static bool s_env_univeral_inited = false; static bool s_env_univeral_inited = false;
static void (*external_callback)(fish_message_type_t type, const wchar_t *name, const wchar_t *val); 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(); void env_universal_barrier();
/** /**
Callback function used whenever a new fishd message is recieved Callback function used whenever a new fishd message is recieved
*/ */
static void callback(fish_message_type_t type, const wchar_t *name, const wchar_t *val) 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) if (external_callback)
external_callback(type, name, val); external_callback(type, name, val);
} }
}
void env_universal_init(void (*cb)(fish_message_type_t type, const wchar_t *name, const wchar_t *val)) void env_universal_init(void (*cb)(fish_message_type_t type, const wchar_t *name, const wchar_t *val))
{ {

View file

@ -7,32 +7,12 @@
*/ */
#include "config.h" #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 <sys/un.h>
#include <arpa/inet.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 <sys/mman.h>
#include <map>
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> #include <sys/select.h>
@ -44,7 +24,6 @@
#include "common.h" #include "common.h"
#include "wutil.h" #include "wutil.h"
#include "utf8.h" #include "utf8.h"
#include "env_universal_common.h"
#include "path.h" #include "path.h"
#include "iothread.h" #include "iothread.h"
@ -477,24 +456,6 @@ message_t *create_message(fish_message_type_t type,
break; 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: default:
{ {
debug(0, L"create_message: Unknown message type"); 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) 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); 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 else
{ {
debug(1, PARSE_ERR, msg); debug(1, PARSE_ERR, msg);

View file

@ -5,6 +5,7 @@
#include <queue> #include <queue>
#include <string> #include <string>
#include <set> #include <set>
#include "wutil.h"
#include "util.h" #include "util.h"
#include "env.h" #include "env.h"
@ -19,40 +20,16 @@
#define SET_EXPORT_STR L"SET_EXPORT" #define SET_EXPORT_STR L"SET_EXPORT"
/** /**
The erase command The different types of messages found in the fishd file
*/
#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
*/ */
typedef enum typedef enum
{ {
SET, SET,
SET_EXPORT, SET_EXPORT
ERASE,
BARRIER,
BARRIER_REPLY,
} fish_message_type_t; } 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 #define ENV_UNIVERSAL_BUFFER_SIZE 1024
@ -67,7 +44,7 @@ typedef struct
int count; int count;
/** /**
Message body. The message must be allocated using enough memory to actually contain the message. Message body.
*/ */
std::string body; std::string body;

View file

@ -406,7 +406,6 @@
D0A0853F13B3ACEE0099B651 /* fish_indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fish_indent.cpp; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; D0A0854813B3ACEE0099B651 /* history.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = history.cpp; sourceTree = "<group>"; };
@ -600,7 +599,6 @@
D0A0853F13B3ACEE0099B651 /* fish_indent.cpp */, D0A0853F13B3ACEE0099B651 /* fish_indent.cpp */,
D0A0854113B3ACEE0099B651 /* fish_tests.cpp */, D0A0854113B3ACEE0099B651 /* fish_tests.cpp */,
D0A0854213B3ACEE0099B651 /* fish.cpp */, D0A0854213B3ACEE0099B651 /* fish.cpp */,
D0A0854313B3ACEE0099B651 /* fishd.cpp */,
D00F63F019137E9D00FCCDEC /* fish_version.cpp */, D00F63F019137E9D00FCCDEC /* fish_version.cpp */,
D0A0851113B3ACEE0099B651 /* highlight.h */, D0A0851113B3ACEE0099B651 /* highlight.h */,
D0A0854713B3ACEE0099B651 /* highlight.cpp */, D0A0854713B3ACEE0099B651 /* highlight.cpp */,