diff --git a/common.cpp b/common.cpp index 21871f8b8..4b6c33c56 100644 --- a/common.cpp +++ b/common.cpp @@ -1508,11 +1508,16 @@ wchar_t *unescape( const wchar_t * orig, int flags ) return in; } -void unescape_string(wcstring &str, int escape_special) +bool unescape_string(wcstring &str, int escape_special) { + bool success = false; wchar_t *result = unescape(str.c_str(), escape_special); - str.replace(str.begin(), str.end(), result); - free(result); + if ( result) { + str.replace(str.begin(), str.end(), result); + free(result); + success = true; + } + return success; } /** diff --git a/common.h b/common.h index b9a59e8dd..5bd420d4a 100644 --- a/common.h +++ b/common.h @@ -478,7 +478,7 @@ wcstring escape_string( const wcstring &in, int escape_all ); wchar_t *unescape( const wchar_t * in, int escape_special ); -void unescape_string( wcstring &str, +bool unescape_string( wcstring &str, int escape_special ); /** diff --git a/fish.cpp b/fish.cpp index 624037fef..2758594ab 100644 --- a/fish.cpp +++ b/fish.cpp @@ -278,6 +278,8 @@ static int fish_parse_opt( int argc, char **argv, char **cmd_ptr ) int main( int argc, char **argv ) { + struct stat tmp; + stat("----------FISH_HIT_MAIN----------", &tmp); int res=1; char *cmd=0; int my_optind=0; diff --git a/highlight.cpp b/highlight.cpp index 3071540d1..acc7f6886 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -72,18 +72,20 @@ static const wchar_t *highlight_var[] = \return zero it this is not a valid prefix, non-zero otherwise */ // PCA DOES_IO -static int is_potential_path( const wcstring &cpath ) +static bool is_potential_path( const wcstring &cpath ) { ASSERT_IS_BACKGROUND_THREAD(); const wchar_t *unescaped, *in; wcstring cleaned_path; int has_magic = 0; - int res = 0; + bool res = false; wcstring path(cpath); expand_tilde(path); - unescape_string(path, 1); + if (! unescape_string(path, 1)) + return false; + unescaped = path.c_str(); // debug( 1, L"%ls -> %ls ->%ls", path, tilde, unescaped ); @@ -142,7 +144,7 @@ static int is_potential_path( const wcstring &cpath ) if( dir_name == L"/" && base_name == L"/" ) { - res = 1; + res = true; } else if( (dir = wopendir( dir_name.c_str() )) ) { @@ -151,7 +153,7 @@ static int is_potential_path( const wcstring &cpath ) { if( wcsncmp( base_name.c_str(), base_name.c_str(), base_name.length() ) == 0 ) { - res = 1; + res = true; break; } } diff --git a/proc.cpp b/proc.cpp index 356e136b3..893bf3758 100644 --- a/proc.cpp +++ b/proc.cpp @@ -1113,7 +1113,7 @@ void job_continue (job_t *j, int cont) if( p->pid ) { int status = proc_format_status(p->status); - + //wprintf(L"setting status %d for %ls\n", job_get_flag( j, JOB_NEGATE )?!status:status, j->command); proc_set_last_status( job_get_flag( j, JOB_NEGATE )?!status:status); } } diff --git a/reader.cpp b/reader.cpp index 7ffb5bae2..572057cdc 100644 --- a/reader.cpp +++ b/reader.cpp @@ -627,7 +627,11 @@ void reader_write_title() return; } - if( !contains( term, L"xterm", L"screen", L"nxterm", L"rxvt" ) ) + bool recognized = false; + recognized = recognized || contains( term, L"xterm", L"screen", L"nxterm", L"rxvt" ); + recognized = recognized || ! wcsncmp(term, L"xterm-", wcslen(L"xterm-")); + + if( ! recognized ) { char *n = ttyname( STDIN_FILENO );