aboutsummaryrefslogtreecommitdiffhomepage
path: root/fish.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-10-08 14:47:25 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-10-08 14:47:25 -0700
commit51de26960c35ef707713d5c02568290d66578db3 (patch)
tree2c5478875d03db06a97f7dc1ecf840280e2c5e45 /fish.cpp
parentb67526aae8a28a4870edc51ad46a002c6ecf0ecf (diff)
Make escaping consistent for fish <-> fishd protocol
Fix fork guards to work in fishd https://github.com/fish-shell/fish-shell/issues/339
Diffstat (limited to 'fish.cpp')
-rw-r--r--fish.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/fish.cpp b/fish.cpp
index baf8a774..d1699d58 100644
--- a/fish.cpp
+++ b/fish.cpp
@@ -410,10 +410,34 @@ static int fish_parse_opt( int argc, char **argv, const char **cmd_ptr )
parses commands from stdin or files, depending on arguments
*/
+static wcstring full_escape( const wchar_t *in )
+{
+ wcstring out;
+ for( ; *in; in++ )
+ {
+ if( *in < 32 )
+ {
+ append_format( out, L"\\x%.2x", *in );
+ }
+ else if( *in < 128 )
+ {
+ out.push_back(*in);
+ }
+ else if( *in < 65536 )
+ {
+ append_format( out, L"\\u%.4x", *in );
+ }
+ else
+ {
+ append_format( out, L"\\U%.8x", *in );
+ }
+ }
+ return out;
+}
+
extern int g_fork_count;
int main( int argc, char **argv )
{
- struct stat tmp;
int res=1;
const char *cmd=0;
int my_optind=0;
@@ -425,7 +449,8 @@ int main( int argc, char **argv )
is_interactive_session=1;
program_name=L"fish";
- stat("----------FISH_HIT_MAIN----------", &tmp);
+ //struct stat tmp;
+ //stat("----------FISH_HIT_MAIN----------", &tmp);
my_optind = fish_parse_opt( argc, argv, &cmd );