#include "config.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 <pwd.h>
#include <errno.h>
#include <sys/stat.h>
#include <dirent.h>
#include <wctype.h>
#include <iconv.h>
#include <locale.h>
#include <signal.h>
#include <sys/select.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "env_universal_common.h"
Data Structures | |
| struct | var_uni_entry |
| A variable entry. More... | |
Defines | |
| #define | SET_MBS "SET" |
| Non-wide version of the set command. | |
| #define | SET_EXPORT_MBS "SET_EXPORT" |
| Non-wide version of the set_export command. | |
| #define | ERASE_MBS "ERASE" |
| Non-wide version of the erase command. | |
| #define | BARRIER_MBS "BARRIER" |
| Non-wide version of the barrier command. | |
| #define | BARRIER_REPLY_MBS "BARRIER_REPLY" |
| Non-wide version of the barrier_reply command. | |
| #define | PARSE_ERR L"Unable to parse universal variable message: '%ls'" |
| Error message. | |
| #define | ENV_UNIVERSAL_ERROR 0x100 |
| ERROR string for internal buffered reader. | |
| #define | ENV_UNIVERSAL_AGAIN 0x101 |
| EAGAIN string for internal buffered reader. | |
| #define | ENV_UNIVERSAL_EOF 0x102 |
| EOF string for internal buffered reader. | |
Typedefs | |
| typedef var_uni_entry | var_uni_entry_t |
| A variable entry. | |
Functions | |
| static void | parse_message (wchar_t *msg, connection_t *src) |
| Parse message msg. | |
| wchar_t * | utf2wcs (const char *in) |
| char * | wcs2utf (const wchar_t *in) |
| void | env_universal_common_init (void(*cb)(int type, const wchar_t *key, const wchar_t *val)) |
| Init the library. | |
| static void | erase (void *key, void *data) |
| Free both key and data. | |
| void | env_universal_common_destroy () |
| Destroy library data. | |
| static int | read_byte (connection_t *src) |
| void | read_message (connection_t *src) |
| Read all available messages on this connection. | |
| void | env_universal_common_remove (const wchar_t *name) |
| Remove the specified variable. | |
| static int | match (const wchar_t *msg, const wchar_t *cmd) |
| Test if the message msg contains the command cmd. | |
| void | env_universal_common_set (const wchar_t *key, const wchar_t *val, int export) |
| Perform the specified variable assignment. | |
| static int | try_send (message_t *msg, int fd) |
| Attempt to send the specified message to the specified file descriptor. | |
| void | try_send_all (connection_t *c) |
| Send as many messages as possible without blocking to the connection. | |
| static wchar_t * | full_escape (const wchar_t *in) |
| message_t * | create_message (int type, const wchar_t *key_in, const wchar_t *val_in) |
| Create a messge with the specified properties. | |
| static void | add_key_to_hash (void *key, void *data, void *aux) |
| Function used with hash_foreach to insert keys of one table into another. | |
| void | env_universal_common_get_names (array_list_t *l, int show_exported, int show_unexported) |
| Add all variable names to the specified list. | |
| wchar_t * | env_universal_common_get (const wchar_t *name) |
| Get the value of the variable with the specified name. | |
| int | env_universal_common_get_export (const wchar_t *name) |
| Get the export flag of the variable with the specified name. | |
| static void | enqueue (void *k, void *v, void *q) |
| Adds a variable creation message about the specified variable to the specified queue. | |
| void | enqueue_all (connection_t *c) |
| Add messages about all existing variables to the specified connection. | |
| void | connection_init (connection_t *c, int fd) |
| Fill in the specified connection_t struct. | |
| void | connection_destroy (connection_t *c) |
| Close and destroy the specified connection struct. | |
Variables | |
| hash_table_t | env_universal_var |
| The table of all universal variables. | |
| void(* | callback )(int type, const wchar_t *key, const wchar_t *val) |
| Callback function, should be called on all events. | |
| static int | get_names_show_exported |
| Variable used by env_get_names to communicate auxiliary information to add_key_to_hash. | |
| static int | get_names_show_unexported |
| Variable used by env_get_names to communicate auxiliary information to add_key_to_hash. | |
| static char * | iconv_utf8_names [] |
| List of names for the UTF-8 character set. | |
| static char * | iconv_wide_names_unknown [] |
| List of wide character names, undefined byte length. | |
| static char * | iconv_wide_names_4 [] |
| List of wide character names, 4 bytes long. | |
| static char * | iconv_wide_names_2 [] |
| List of wide character names, 2 bytes long. | |
Used both by the client library and by the daemon.
|
|
A variable entry. Stores the value of a variable and whether it should be exported. Obviously, it needs to be allocated large enough to fit the value string. |
|
|
Close and destroy the specified connection struct. This frees allstructures allocated by the connection, such as ques of unsent messages. |
|
||||||||||||
|
Fill in the specified connection_t struct. Use the specified file descriptor for communication. |
|
||||||||||||||||
|
Adds a variable creation message about the specified variable to the specified queue. The function signature is non-obvious since this function is used together with hash_foreach2, which requires the specified function signature.
|
|
|
Get the value of the variable with the specified name. This function operate agains the local copy of all universal variables, it does not communicate with any other process. |
|
|
Get the export flag of the variable with the specified name. Returns 0 if the variable doesn't exist. This function operate agains the local copy of all universal variables, it does not communicate with any other process. |
|
||||||||||||||||
|
Add all variable names to the specified list. This function operate agains the local copy of all universal variables, it does not communicate with any other process. |
|
|
Remove the specified variable. This function operate agains the local copy of all universal variables, it does not communicate with any other process. Do not call this function. Create a message to do it. This function is only to be used when fishd is dead. |
|
||||||||||||||||
|
Perform the specified variable assignment. This function operate agains the local copy of all universal variables, it does not communicate with any other process. Do not call this function. Create a message to do it. This function is only to be used when fishd is dead. |
|
||||||||||||
|
Attempt to send the specified message to the specified file descriptor.
|
|
|
Initial value:
{
"utf-8", "UTF-8",
"utf8", "UTF8",
0
}
|
|
|
Initial value:
{
"wchar_t", "WCHAR_T",
"wchar", "WCHAR",
"ucs-2", "UCS-2",
"ucs2", "UCS2",
"utf-16", "UTF-16",
"utf16", "UTF16",
0
}
|
|
|
Initial value:
{
"wchar_t", "WCHAR_T",
"wchar", "WCHAR",
"ucs-4", "UCS-4",
"ucs4", "UCS4",
"utf-32", "UTF-32",
"utf32", "UTF32",
0
}
|
|
|
Initial value:
{
"wchar_t", "WCHAR_T",
"wchar", "WCHAR",
0
}
|
1.4.4