mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-26 02:51:16 -03:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff2d354ef8 | ||
|
|
3bef568955 | ||
|
|
9a7be6db08 | ||
|
|
40e2025327 | ||
|
|
a819c863eb | ||
|
|
827c88e4a1 | ||
|
|
e2b7a078f4 | ||
|
|
6de0c4103b | ||
|
|
b6e8171f01 | ||
|
|
b1439075c6 | ||
|
|
7df536023b | ||
|
|
f5f15f9de2 | ||
|
|
0e0a61119f | ||
|
|
6f058c687d | ||
|
|
53ea5d60b7 | ||
|
|
9525f429c6 | ||
|
|
548e379d6a | ||
|
|
202d29de88 | ||
|
|
23152ae8a6 | ||
|
|
7310596dab | ||
|
|
4afe49d7c6 | ||
|
|
d7c3d2acbf | ||
|
|
f771fce892 | ||
|
|
6522000bf0 | ||
|
|
285abcc9bc | ||
|
|
b15e8123ca | ||
|
|
1c86395ed8 | ||
|
|
3c8d2a1126 | ||
|
|
ed8cd08984 | ||
|
|
69537430ea | ||
|
|
0a603a56c6 | ||
|
|
046dd82995 | ||
|
|
97c3e231f4 | ||
|
|
76b782d576 |
@@ -336,7 +336,8 @@ doc_src/builtin_doc: $(BUILTIN_DOC_SRC) doc_src/count.txt builtin_help.hdr $(CMD
|
||||
done
|
||||
cd doc_src; doxygen; cd ..;
|
||||
for i in doc_src/builtin_doc/man/man1/*.1; do \
|
||||
sed -i -e "s/\(.\)\\.SH/\1/" $$i; \
|
||||
sed -e "s/\(.\)\\.SH/\1/" <$$i >$$i.tmp; \
|
||||
mv $$i.tmp $$i; \
|
||||
done
|
||||
touch doc_src/builtin_doc
|
||||
|
||||
|
||||
24
builtin.c
24
builtin.c
@@ -2743,11 +2743,11 @@ static int builtin_return( wchar_t **argv )
|
||||
b = current_block;
|
||||
while( ( b->type != FUNCTION_CALL))
|
||||
{
|
||||
b->type = FAKE;
|
||||
b->skip=1;
|
||||
b = b->outer;
|
||||
}
|
||||
b->skip=1;
|
||||
// proc_set_last_status( status );
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -2778,7 +2778,7 @@ static int builtin_switch( wchar_t **argv )
|
||||
current_block->skip=1;
|
||||
current_block->param2.switch_taken=0;
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -2790,7 +2790,7 @@ static int builtin_case( wchar_t **argv )
|
||||
int argc = builtin_count_args( argv );
|
||||
int i;
|
||||
wchar_t *unescaped=0;
|
||||
|
||||
|
||||
if( current_block->type != SWITCH )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
@@ -2799,30 +2799,30 @@ static int builtin_case( wchar_t **argv )
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
current_block->skip = 1;
|
||||
|
||||
|
||||
if( current_block->param2.switch_taken )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
for( i=1; i<argc; i++ )
|
||||
{
|
||||
free( unescaped );
|
||||
|
||||
int match;
|
||||
|
||||
unescaped = parse_util_unescape_wildcards( argv[i] );
|
||||
match = wildcard_match( current_block->param1.switch_value, unescaped );
|
||||
free( unescaped );
|
||||
|
||||
|
||||
if( wildcard_match( current_block->param1.switch_value, unescaped ) )
|
||||
if( match )
|
||||
{
|
||||
current_block->skip = 0;
|
||||
current_block->param2.switch_taken = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
free( unescaped );
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -366,9 +366,12 @@ static void print_variables(int include_values, int esc, int scope)
|
||||
{
|
||||
wchar_t *value = env_get(key);
|
||||
wchar_t *e_value;
|
||||
e_value = esc ? expand_escape_variable(value) : wcsdup(value);
|
||||
sb_append2(sb_out, L" ", e_value, (void *)0);
|
||||
free(e_value);
|
||||
if( value )
|
||||
{
|
||||
e_value = esc ? expand_escape_variable(value) : wcsdup(value);
|
||||
sb_append2(sb_out, L" ", e_value, (void *)0);
|
||||
free(e_value);
|
||||
}
|
||||
}
|
||||
|
||||
sb_append(sb_out, L"\n");
|
||||
@@ -455,6 +458,8 @@ static int builtin_set( wchar_t **argv )
|
||||
int slice=0;
|
||||
int i;
|
||||
|
||||
wchar_t *bad_char;
|
||||
|
||||
|
||||
/* Parse options to obtain the requested operation and the modifiers */
|
||||
woptind = 0;
|
||||
@@ -599,6 +604,13 @@ static int builtin_set( wchar_t **argv )
|
||||
return retcode;
|
||||
}
|
||||
|
||||
if( list )
|
||||
{
|
||||
/* Maybe we should issue an error if there are any other arguments? */
|
||||
print_variables(0, 0, scope);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( woptind == argc )
|
||||
{
|
||||
/*
|
||||
@@ -623,13 +635,6 @@ static int builtin_set( wchar_t **argv )
|
||||
return retcode;
|
||||
}
|
||||
|
||||
if( list )
|
||||
{
|
||||
/* Maybe we should issue an error if there are any other arguments? */
|
||||
print_variables(0, 0, scope);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( !(dest = wcsdup(argv[woptind])))
|
||||
{
|
||||
DIE_MEM();
|
||||
@@ -648,7 +653,15 @@ static int builtin_set( wchar_t **argv )
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if( (bad_char = wcsvarname( dest ) ) )
|
||||
{
|
||||
sb_printf( sb_err, BUILTIN_ERR_VARCHAR, argv[0], *bad_char );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
free( dest );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( slice && erase && (scope != ENV_USER) )
|
||||
{
|
||||
free( dest );
|
||||
@@ -676,9 +689,9 @@ static int builtin_set( wchar_t **argv )
|
||||
al_init(&values);
|
||||
al_init(&indexes);
|
||||
al_init(&result);
|
||||
|
||||
|
||||
tokenize_variable_array( env_get(dest), &result );
|
||||
|
||||
|
||||
for( ; woptind<argc; woptind++ )
|
||||
{
|
||||
if( !parse_index( &indexes, argv[woptind], dest, al_get_count( &result ) ) )
|
||||
|
||||
172
common.c
172
common.c
@@ -296,7 +296,10 @@ char *wcs2str_internal( const wchar_t *in, char *out )
|
||||
|
||||
while( in[in_pos] )
|
||||
{
|
||||
if( ( in[in_pos] >= ENCODE_DIRECT_BASE) &&
|
||||
if( in[in_pos] == INTERNAL_SEPARATOR )
|
||||
{
|
||||
}
|
||||
else if( ( in[in_pos] >= ENCODE_DIRECT_BASE) &&
|
||||
( in[in_pos] < ENCODE_DIRECT_BASE+256) )
|
||||
{
|
||||
out[out_pos++] = in[in_pos]- ENCODE_DIRECT_BASE;
|
||||
@@ -307,7 +310,7 @@ char *wcs2str_internal( const wchar_t *in, char *out )
|
||||
|
||||
if( res == (size_t)(-1) )
|
||||
{
|
||||
debug( 1, L"Wide character has no narrow representation" );
|
||||
debug( 1, L"Wide character %d has no narrow representation", in[in_pos] );
|
||||
memset( &state, 0, sizeof(state) );
|
||||
}
|
||||
else
|
||||
@@ -813,64 +816,22 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
|
||||
{
|
||||
switch( in[++in_pos] )
|
||||
{
|
||||
|
||||
/*
|
||||
A null character after a backslash is an
|
||||
error, return null
|
||||
*/
|
||||
case L'\0':
|
||||
{
|
||||
free(in);
|
||||
return 0;
|
||||
}
|
||||
|
||||
case L'n':
|
||||
{
|
||||
in[out_pos]=L'\n';
|
||||
break;
|
||||
}
|
||||
/*
|
||||
Numeric escape sequences. No prefix means
|
||||
octal escape, otherwise hexadecimal.
|
||||
*/
|
||||
|
||||
case L'r':
|
||||
{
|
||||
in[out_pos]=L'\r';
|
||||
break;
|
||||
}
|
||||
|
||||
case L't':
|
||||
{
|
||||
in[out_pos]=L'\t';
|
||||
break;
|
||||
}
|
||||
|
||||
case L'b':
|
||||
{
|
||||
in[out_pos]=L'\b';
|
||||
break;
|
||||
}
|
||||
|
||||
case L'a':
|
||||
{
|
||||
in[out_pos]=L'\a';
|
||||
break;
|
||||
}
|
||||
|
||||
case L'f':
|
||||
{
|
||||
in[out_pos]=L'\f';
|
||||
break;
|
||||
}
|
||||
|
||||
case L'v':
|
||||
{
|
||||
in[out_pos]=L'\v';
|
||||
break;
|
||||
}
|
||||
|
||||
case L'e':
|
||||
{
|
||||
in[out_pos]=L'\x1b';
|
||||
break;
|
||||
}
|
||||
|
||||
case L'u':
|
||||
case L'U':
|
||||
case L'x':
|
||||
case L'X':
|
||||
case L'0':
|
||||
case L'1':
|
||||
case L'2':
|
||||
@@ -879,6 +840,10 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
|
||||
case L'5':
|
||||
case L'6':
|
||||
case L'7':
|
||||
case L'u':
|
||||
case L'U':
|
||||
case L'x':
|
||||
case L'X':
|
||||
{
|
||||
int i;
|
||||
long long res=0;
|
||||
@@ -951,8 +916,106 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
\a means bell (alert)
|
||||
*/
|
||||
case L'a':
|
||||
{
|
||||
in[out_pos]=L'\a';
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
\b means backspace
|
||||
*/
|
||||
case L'b':
|
||||
{
|
||||
in[out_pos]=L'\b';
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
\cX means control sequence X
|
||||
*/
|
||||
case L'c':
|
||||
{
|
||||
in_pos++;
|
||||
if( in[in_pos] >= L'a' &&
|
||||
in[in_pos] <= (L'a'+32) )
|
||||
{
|
||||
in[out_pos]=in[in_pos]-L'a'+1;
|
||||
}
|
||||
else if( in[in_pos] >= L'A' &&
|
||||
in[in_pos] <= (L'A'+32) )
|
||||
{
|
||||
in[out_pos]=in[in_pos]-L'A'+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(in);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
\e means escape
|
||||
*/
|
||||
case L'e':
|
||||
{
|
||||
in[out_pos]=L'\x1b';
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
\f means form feed
|
||||
*/
|
||||
case L'f':
|
||||
{
|
||||
in[out_pos]=L'\f';
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
\n means newline
|
||||
*/
|
||||
case L'n':
|
||||
{
|
||||
in[out_pos]=L'\n';
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
\r means carriage return
|
||||
*/
|
||||
case L'r':
|
||||
{
|
||||
in[out_pos]=L'\r';
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
\t means tab
|
||||
*/
|
||||
case L't':
|
||||
{
|
||||
in[out_pos]=L'\t';
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
\v means vetrical tab
|
||||
*/
|
||||
case L'v':
|
||||
{
|
||||
in[out_pos]=L'\v';
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
in[out_pos++] = INTERNAL_SEPARATOR;
|
||||
in[out_pos]=in[in_pos];
|
||||
break;
|
||||
}
|
||||
@@ -960,7 +1023,8 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( in[in_pos]){
|
||||
switch( in[in_pos])
|
||||
{
|
||||
case L'~':
|
||||
{
|
||||
if( unescape_special && (in_pos == 0) )
|
||||
|
||||
37
complete.c
37
complete.c
@@ -588,7 +588,7 @@ static void parse_cmd_string( void *context,
|
||||
Use the empty string as the 'path' for commands that can
|
||||
not be found.
|
||||
*/
|
||||
path = wcsdup(L"");
|
||||
path = halloc_wcsdup( context, L"");
|
||||
}
|
||||
|
||||
/* Make sure the path is not included in the command */
|
||||
@@ -1820,20 +1820,27 @@ static int complete_variable( const wchar_t *var,
|
||||
|
||||
if( wcsncmp( var, name, varlen) == 0 )
|
||||
{
|
||||
wchar_t *value = expand_escape_variable( env_get( name ));
|
||||
wchar_t *value_unescaped, *value;
|
||||
|
||||
wchar_t *blarg;
|
||||
/*
|
||||
Variable description is 'Variable: VALUE
|
||||
*/
|
||||
blarg = wcsdupcat2( &name[varlen], COMPLETE_SEP_STR, COMPLETE_VAR_DESC_VAL, value, 0 );
|
||||
|
||||
if( blarg )
|
||||
value_unescaped = env_get( name );
|
||||
if( value_unescaped )
|
||||
{
|
||||
res =1;
|
||||
al_push( comp, blarg );
|
||||
value = expand_escape_variable( value_unescaped );
|
||||
/*
|
||||
Variable description is 'Variable: VALUE
|
||||
*/
|
||||
blarg = wcsdupcat2( &name[varlen], COMPLETE_SEP_STR, COMPLETE_VAR_DESC_VAL, value, 0 );
|
||||
|
||||
if( blarg )
|
||||
{
|
||||
res =1;
|
||||
al_push( comp, blarg );
|
||||
}
|
||||
free( value );
|
||||
}
|
||||
free( value );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2130,6 +2137,14 @@ void complete( const wchar_t *cmd,
|
||||
int do_file;
|
||||
|
||||
do_file = complete_param( current_command, prev_token, current_token, comp );
|
||||
|
||||
/*
|
||||
If we have found no command specific completions at
|
||||
all, fall back to using file completions.
|
||||
*/
|
||||
if( !al_get_count( comp ) )
|
||||
do_file = 1;
|
||||
|
||||
complete_param_expand( current_token, comp, do_file );
|
||||
}
|
||||
}
|
||||
|
||||
429
configure.ac
429
configure.ac
@@ -1,5 +1,15 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(fish,1.21.11,fish-users@lists.sf.net)
|
||||
|
||||
#
|
||||
# This file is the main build configuration file for fish. It is used
|
||||
# to determine your systems capabilities, and tried to adapt fish to
|
||||
# take maximum advantage of the services your system offers.
|
||||
#
|
||||
# Process this file using the 'autoconf' to produce a working
|
||||
# configure script, which should in turn be executed in order to
|
||||
# configure the build process.
|
||||
#
|
||||
|
||||
AC_INIT(fish,1.21.12,fish-users@lists.sf.net)
|
||||
|
||||
# If needed, run autoconf to regenerate the configure file
|
||||
AC_MSG_CHECKING([if autoconf needs to be run])
|
||||
@@ -11,12 +21,15 @@ if test configure -ot configure.ac; then
|
||||
AC_MSG_NOTICE([running autoconf])
|
||||
if autoconf; then
|
||||
./configure "$@"
|
||||
exit
|
||||
fi
|
||||
exit
|
||||
exit 1
|
||||
else
|
||||
AC_MSG_ERROR( [cannot find the autoconf program in your path.
|
||||
AC_MSG_ERROR(
|
||||
[cannot find the autoconf program in your path.
|
||||
This program needs to be run whenever the configure.ac file is modified.
|
||||
Please install it and try again.])
|
||||
Please install it and try again.]
|
||||
)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
@@ -29,11 +42,13 @@ if test ! -f ./config.h.in -o config.h.in -ot configure.ac; then
|
||||
AC_MSG_RESULT([yes])
|
||||
if which autoheader >/dev/null; then
|
||||
AC_MSG_NOTICE([running autoheader])
|
||||
autoheader
|
||||
autoheader || exit 1
|
||||
else
|
||||
AC_MSG_ERROR( [cannot find the autoheader program in your path.
|
||||
AC_MSG_ERROR(
|
||||
[cannot find the autoheader program in your path.
|
||||
This program needs to be run whenever the configure.ac file is modified.
|
||||
Please install it and try again.])
|
||||
Please install it and try again.]
|
||||
)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
@@ -87,11 +102,15 @@ AC_PROG_INSTALL
|
||||
AC_CHECK_PROG( SEQ_FALLBACK, seq, [ ], [seq])
|
||||
|
||||
# Optionally drop xsel command
|
||||
AC_ARG_WITH( xsel,
|
||||
AC_HELP_STRING([--without-xsel],
|
||||
[do not build the xsel program needed for X clipboard integration]),
|
||||
[xsel=$withval],
|
||||
[xsel=with_xsel] )
|
||||
AC_ARG_WITH(
|
||||
xsel,
|
||||
AC_HELP_STRING(
|
||||
[--without-xsel],
|
||||
[do not build the xsel program needed for X clipboard integration]
|
||||
),
|
||||
[xsel=$withval],
|
||||
[xsel=with_xsel]
|
||||
)
|
||||
|
||||
if [[ "$xsel" = "with_xsel" ]]; then
|
||||
AC_SUBST( XSEL,[xsel-0.9.6/xsel])
|
||||
@@ -108,33 +127,39 @@ fi
|
||||
#
|
||||
# Test if the compiler accepts the -std=c99 flag. If so, using it
|
||||
# increases the odds of correct compilation, since we want to use the
|
||||
# *wprintf functions, which where defined in C99. On some platforms
|
||||
# (Solaris 10) adding -std=c99 in turn requires that _POSIX_C_SOURCE
|
||||
# be defined to 200112L otherwise several POSIX-specific, non-ISO-C99
|
||||
# types/prototypes are made unavailable e.g. siginfo_t. Finally,
|
||||
# defining _XOPEN_SOURCE to 600 is compatible with the
|
||||
# _POSIX_C_SOURCE value and provides a little assurance that
|
||||
# extension functions' prototypes are available, e.g. killpg().
|
||||
# *wprintf functions, which where defined in C99.
|
||||
|
||||
XCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -std=c99 -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L"
|
||||
AC_MSG_CHECKING(if -std=c99 -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L works)
|
||||
AC_CACHE_VAL(local_cv_has__std_c99,[
|
||||
AC_TRY_RUN([
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
CFLAGS="$CFLAGS -std=c99"
|
||||
XCPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -std=c99"
|
||||
AC_MSG_CHECKING(if -std=c99 works)
|
||||
AC_CACHE_VAL(
|
||||
local_cv_has__std_c99,
|
||||
[
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
}],
|
||||
local_cv_has__std_c99=yes,
|
||||
local_cv_has__std_c99=no,
|
||||
)])
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
],
|
||||
local_cv_has__std_c99=yes,
|
||||
local_cv_has__std_c99=no,
|
||||
)
|
||||
]
|
||||
)
|
||||
AC_MSG_RESULT($local_cv_has__std_c99)
|
||||
case x$local_cv_has__std_c99 in
|
||||
xno) CFLAGS="$XCFLAGS" ;;
|
||||
xno)
|
||||
CFLAGS="$XCFLAGS"
|
||||
CPPFLAGS="$XCPPFLAGS" ;;
|
||||
esac
|
||||
|
||||
|
||||
#
|
||||
# If we are using gcc, set some flags that increase the odds of the
|
||||
# compiler producing a working binary...
|
||||
@@ -144,7 +169,7 @@ if test "$CC" = gcc; then
|
||||
|
||||
#
|
||||
# -fno-optimize-sibling-calls seems to work around a bug where
|
||||
# sending a SIGWINCH to fish on NetBSD causes fish to exit when
|
||||
# sending a SIGWINCH to fish on NetBSD 3.0 causes fish to exit when
|
||||
# compiled with GCC 3.3.3. This is probably either a compiler bug
|
||||
# or a libc bug, but adding this flag seems to fix things for
|
||||
# now. Long term, the real problem should be tracked down and
|
||||
@@ -171,16 +196,24 @@ fi
|
||||
|
||||
AC_MSG_CHECKING([if we are compiling against glibc])
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#include <stdlib.h>
|
||||
#ifdef __GLIBC__
|
||||
#define STATUS 0
|
||||
#else
|
||||
#define STATUS 1
|
||||
#endif],
|
||||
[return STATUS;])],
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[
|
||||
#include <stdlib.h>
|
||||
#ifdef __GLIBC__
|
||||
#define STATUS 0
|
||||
#else
|
||||
#define STATUS 1
|
||||
#endif
|
||||
],
|
||||
[
|
||||
return STATUS;
|
||||
]
|
||||
)
|
||||
],
|
||||
[glibc=yes],
|
||||
[glibc=no] )
|
||||
[glibc=no]
|
||||
)
|
||||
|
||||
if test "$glibc" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
@@ -240,6 +273,7 @@ case $target_os in
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Set up PREFIX and related preprocessor symbols. Fish needs to know
|
||||
# where it will be installed. One of the reasons for this is so that
|
||||
# it can make sure the fish installation directory is in the path
|
||||
@@ -273,8 +307,11 @@ AC_CHECK_FILES([/proc/self/stat])
|
||||
# This is ued to tell the wgetopt library to translate strings. This
|
||||
# way wgetopt can be dropped into any project without requiring i18n.
|
||||
|
||||
AC_DEFINE([HAVE_TRANSLATE_H], [1],
|
||||
[Define to 1 if the wgettext function should be used for translating strings.])
|
||||
AC_DEFINE(
|
||||
[HAVE_TRANSLATE_H],
|
||||
[1],
|
||||
[Define to 1 if the wgettext function should be used for translating strings.]
|
||||
)
|
||||
|
||||
# Check for presense of various libraries
|
||||
AC_SEARCH_LIBS( gettext, intl,,)
|
||||
@@ -285,13 +322,139 @@ AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a c
|
||||
# Check for presense of various header files
|
||||
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h term.h ncurses/term.h libintl.h ncurses.h curses.h stropts.h siginfo.h sys/select.h sys/ioctl.h sys/termios.h])
|
||||
|
||||
AC_CHECK_HEADER([regex.h],
|
||||
[AC_DEFINE([HAVE_REGEX_H], [1], [Define to 1 if you have the <regex.h> header file.])],
|
||||
[AC_MSG_ERROR([Could not find the header regex.h, needed to build fish])])
|
||||
AC_CHECK_HEADER(
|
||||
[regex.h],
|
||||
[
|
||||
AC_DEFINE(
|
||||
[HAVE_REGEX_H],
|
||||
[1],
|
||||
[Define to 1 if you have the <regex.h> header file.]
|
||||
)],
|
||||
[AC_MSG_ERROR([Could not find the header regex.h, needed to build fish])
|
||||
]
|
||||
)
|
||||
|
||||
#
|
||||
# On some platforms (Solaris 10) adding -std=c99 in turn requires that
|
||||
# _POSIX_C_SOURCE be defined to 200112L otherwise several
|
||||
# POSIX-specific, non-ISO-C99 types/prototypes are made unavailable
|
||||
# e.g. siginfo_t. Defining _XOPEN_SOURCE to 600 is compatible with
|
||||
# the _POSIX_C_SOURCE value and provides a little assurance that
|
||||
# extension functions' prototypes are available, e.g. killpg().
|
||||
#
|
||||
# Some other platforms (OS X), will remove types/prototypes/macros
|
||||
# e.g. SIGWINCH if either _POSIX_C_SOURCE or _XOPEN_SOURCE is defined.
|
||||
#
|
||||
# This test adds these macros only if they enable a program that uses
|
||||
# both Posix and non-standard features to compile, and that program
|
||||
# does not compile without these macros.
|
||||
#
|
||||
# We try to make everyone happy.
|
||||
#
|
||||
# The ordering of the various autoconf tests is very critical as well:
|
||||
#
|
||||
# * This test needs to be run _after_ header detection tests, so that
|
||||
# the proper headers are included.
|
||||
#
|
||||
# * This test needs to be run _before_ testing for the presense of any
|
||||
# prototypes or other language functinality.
|
||||
#
|
||||
# * This test should be (but does not need to be) run after the
|
||||
# conditional definition of __EXTENSIONS__, to avoid redundant tests.
|
||||
|
||||
XCFLAGS="$CFLAGS"
|
||||
|
||||
echo Checking how to use -D_XOPEN_SOURCE=600 and -D_POSIX_C_SOURCE=200112L...
|
||||
local_found_posix_switch=no
|
||||
|
||||
for i in "" "-D_POSIX_C_SOURCE=200112L" "-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L"; do
|
||||
|
||||
AC_MSG_CHECKING( if switches \"$i\" works)
|
||||
CFLAGS="$XCFLAGS $i"
|
||||
|
||||
#
|
||||
# Try to run this program, which should test various extensions
|
||||
# and Posix functionality. If this program works, then everything
|
||||
# should work. Hopefully.
|
||||
#
|
||||
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* POSIX, C89 and C99: POSIX extends this header.
|
||||
* For: kill(), killpg(), siginfo_t, sigset_t,
|
||||
* struct sigaction, sigemptyset(), sigaction(),
|
||||
* SIGIO and SIGWINCH. */
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_SIGINFO_H
|
||||
/* Neither POSIX, C89 nor C99: Solaris-specific (others?).
|
||||
* For: siginfo_t (also defined by signal.h when in
|
||||
* POSIX/extensions mode). */
|
||||
#include <siginfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TERMIOS_H
|
||||
/* Neither POSIX, C89 nor C99: a common extension.
|
||||
* For: TIOCGWINSZ and struct winsize (under at least
|
||||
* Solaris, NetBSD and (dual-listed) FreeBSD). */
|
||||
#include <sys/termios.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
/* As above (under at least Linux and FreeBSD). */
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
],
|
||||
[
|
||||
/* Avert high-level optimisation, by making the program's
|
||||
* return value depend on all tested identifiers. */
|
||||
int ret = 0;
|
||||
/* POSIX only: might be unhidden by _POSIX_C_SOURCE. */
|
||||
struct sigaction sa;
|
||||
sigset_t ss;
|
||||
siginfo_t info;
|
||||
ret += (int)(void *)&info + kill( 0, 0 ) +
|
||||
sigaction( 0, &sa, 0 ) + sigemptyset( &ss );
|
||||
/* Extended-POSIX: might be unhidden by _XOPEN_SOURCE. */
|
||||
ret += killpg( 0, 0 );
|
||||
/* Non-standard: might be hidden by the macros. */
|
||||
{
|
||||
struct winsize termsize;
|
||||
ret += (int)(void *)&termsize;
|
||||
ret += SIGWINCH + TIOCGWINSZ + SIGIO;
|
||||
}
|
||||
return ret;
|
||||
|
||||
],
|
||||
local_cv_use__posix_c_source=yes,
|
||||
local_cv_use__posix_c_source=no,
|
||||
)
|
||||
|
||||
if test x$local_cv_use__posix_c_source = xyes; then
|
||||
AC_MSG_RESULT( yes )
|
||||
local_found_posix_switch=yes
|
||||
break;
|
||||
else
|
||||
AC_MSG_RESULT( no )
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
# We didn't find any combination of switches that worked - revert to
|
||||
# no switches and hope that the fallbacks work. A warning will be
|
||||
# printed at the end of the configure script.
|
||||
|
||||
if test ! x$local_found_posix_switch = xyes; then
|
||||
CFLAGS="$XCFLAGS"
|
||||
fi
|
||||
|
||||
# Check for presense of various functions
|
||||
AC_CHECK_FUNCS( gettext wcsdup wcsndup wcslen wcscasecmp wcsncasecmp fwprintf )
|
||||
AC_CHECK_FUNCS( futimes wcwidth wcswidth getopt_long wcstok fputwc fgetwc )
|
||||
AC_CHECK_FUNCS( futimes wcwidth wcswidth wcstok fputwc fgetwc )
|
||||
AC_CHECK_FUNCS( wcstol dcgettext wcslcat wcslcpy lrand48_r killpg)
|
||||
|
||||
# The Makefile also needs to know if we have gettext, so it knows if the translations should be installed.
|
||||
@@ -303,18 +466,33 @@ AC_CHECK_FUNC( gettext, AC_SUBST( HAVE_GETTEXT, 1 ), AC_SUBST( HAVE_GETTEXT, 0 )
|
||||
# Check if realpath accepts null for its second argument
|
||||
AC_MSG_CHECKING([if realpath accepts null for its second argument])
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>],
|
||||
[int status; char *res; res = realpath( "somefile", 0 ); status = !(res != 0 || errno == ENOENT); exit( status );])],
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
],
|
||||
[
|
||||
int status;
|
||||
char *res;
|
||||
res = realpath( "somefile", 0 );
|
||||
status = !(res != 0 || errno == ENOENT);
|
||||
exit( status );
|
||||
]
|
||||
)
|
||||
],
|
||||
[have_realpath_null=yes],
|
||||
[have_realpath_null=no] )
|
||||
[have_realpath_null=no]
|
||||
)
|
||||
|
||||
if test "$have_realpath_null" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_REALPATH_NULL], [1],
|
||||
[Define to 1 if realpath accepts null for its second argument.])
|
||||
AC_DEFINE(
|
||||
[HAVE_REALPATH_NULL],
|
||||
[1],
|
||||
[Define to 1 if realpath accepts null for its second argument.]
|
||||
)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
@@ -323,19 +501,31 @@ fi
|
||||
# Check if struct winsize exists
|
||||
AC_MSG_CHECKING([if struct winsize and TIOCGWINSZ exist])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#ifdef HAVE_SYS_TERMIOS_H
|
||||
#include <sys/termios.h>
|
||||
#endif
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[
|
||||
#ifdef HAVE_SYS_TERMIOS_H
|
||||
#include <sys/termios.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
],
|
||||
[struct winsize termsize = {0}; TIOCGWINSZ;])],
|
||||
[AC_MSG_RESULT(yes); AC_DEFINE([HAVE_WINSIZE], [1], [Define to 1 if the winsize struct and TIOCGWINSZ macro exist])],
|
||||
AC_MSG_RESULT(no))
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
],
|
||||
[
|
||||
struct winsize termsize = {0};
|
||||
TIOCGWINSZ;
|
||||
]
|
||||
)
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(yes);
|
||||
AC_DEFINE([HAVE_WINSIZE], [1], [Define to 1 if the winsize struct and TIOCGWINSZ macro exist])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
]
|
||||
)
|
||||
|
||||
# If we have a fwprintf in libc, test that it actually works. As of
|
||||
# March 2006, it is broken under Dragonfly BSD.
|
||||
@@ -343,38 +533,91 @@ if test "$ac_cv_func_fwprintf" = yes; then
|
||||
|
||||
AC_MSG_CHECKING([if fwprintf is broken])
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <locale.h>
|
||||
#include <wchar.h>
|
||||
],
|
||||
[
|
||||
setlocale( LC_ALL, "" );
|
||||
fwprintf( stderr, L"%ls%ls", L"", L"fish:" );
|
||||
])],
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <locale.h>
|
||||
#include <wchar.h>
|
||||
],
|
||||
[
|
||||
setlocale( LC_ALL, "" );
|
||||
fwprintf( stderr, L"%ls%ls", L"", L"fish:" );
|
||||
]
|
||||
)
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_BROKEN_FWPRINTF], [1], [Define to 1 one if the implemented fwprintf is broken])
|
||||
] )
|
||||
]
|
||||
)
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Check for _nl_msg_cat_cntr symbol
|
||||
AC_MSG_CHECKING([for _nl_msg_cat_cntr symbol])
|
||||
AC_TRY_LINK([#if HAVE_LIBINTL_H]
|
||||
[#include <libintl.h>]
|
||||
[#endif],
|
||||
[extern int _nl_msg_cat_cntr;]
|
||||
[int tmp = _nl_msg_cat_cntr; exit(tmp);], have__nl_msg_cat_cntr=yes, have__nl_msg_cat_cntr=no)
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#if HAVE_LIBINTL_H
|
||||
#include <libintl.h>
|
||||
#endif
|
||||
],
|
||||
[
|
||||
extern int _nl_msg_cat_cntr;
|
||||
int tmp = _nl_msg_cat_cntr;
|
||||
exit(tmp);
|
||||
],
|
||||
have__nl_msg_cat_cntr=yes,
|
||||
have__nl_msg_cat_cntr=no
|
||||
)
|
||||
if test "$have__nl_msg_cat_cntr" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE__NL_MSG_CAT_CNTR], [1],
|
||||
[Define to 1 if the _nl_msg_cat_cntr symbol is exported.])
|
||||
AC_DEFINE(
|
||||
[HAVE__NL_MSG_CAT_CNTR],
|
||||
[1],
|
||||
[Define to 1 if the _nl_msg_cat_cntr symbol is exported.]
|
||||
)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Check if getopt_long exists and works
|
||||
AC_MSG_CHECKING([if getopt_long exists and works])
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#if HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
],
|
||||
[
|
||||
static struct option
|
||||
long_options[] =
|
||||
{
|
||||
0, 0, 0, 0
|
||||
}
|
||||
;
|
||||
int opt = getopt_long( 0,
|
||||
0,
|
||||
0,
|
||||
long_options,
|
||||
0 );
|
||||
|
||||
],
|
||||
have_working_getopt_long=yes,
|
||||
have_working_getopt_long=no
|
||||
)
|
||||
if test "$have_working_getopt_long" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(
|
||||
[HAVE_WORKING_GETOPT_LONG],
|
||||
[1],
|
||||
[Define to 1 if getopt_long exists and works.]
|
||||
)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
@@ -386,7 +629,11 @@ AC_MSG_CHECKING([If del_curterm is broken])
|
||||
case $target_os in
|
||||
*bsd*)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_BROKEN_DEL_CURTERM],[1],[del_curterm si broken, redefine it to a no-op to avoid a double-free bug])
|
||||
AC_DEFINE(
|
||||
[HAVE_BROKEN_DEL_CURTERM],
|
||||
[1],
|
||||
[del_curterm is broken, redefine it to a no-op to avoid a double-free bug]
|
||||
)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
@@ -397,5 +644,11 @@ esac
|
||||
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile seq])
|
||||
AC_OUTPUT
|
||||
|
||||
if test ! x$local_found_posix_switch = xyes; then
|
||||
echo "Can't find a combination of switches to enable common extensions like detecting window size."
|
||||
echo "Some fish features may be disabled."
|
||||
fi
|
||||
|
||||
echo "fish is now configured."
|
||||
echo "Use 'make' and 'make install' to build and install fish."
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ This builtin command is used to print or erase functions.
|
||||
- <code>-d DESCRIPTION</code> or <code>--description=DESCRIPTION</code> change the description of this function
|
||||
- <code>-e</code> or <code>--erase</code> causes the specified functions to be erased.
|
||||
- <code>-h</code> or <code>--help</code> display a help message and exit
|
||||
- <code>-n</code> or <code>--names</code> list only the names of all defined functions
|
||||
- <code>-n</code> or <code>--names</code> list only the names of all defined functions, not their definition
|
||||
- <code>-q</code> or <code>--query</code> test if the specified functions exist. Does not output anything, but the builtins exit status is the number of functions specified that were not defined.
|
||||
|
||||
The default behavior of \c functions when called with no arguments,
|
||||
|
||||
@@ -15,7 +15,7 @@ The <code>set</code> builtin causes fish to assign the variable <code>VARIABLE_N
|
||||
- <code>-l</code> or <code>--local</code> forces the specified environment variable to be given a scope that is local to the current block, even if a variable with the given name exists and is non-local
|
||||
- <code>-g</code> or <code>--global</code> causes the specified environment variable to be given a global scope. Non-global variables disappear when the block they belong to ends
|
||||
- <code>-U</code> or <code>--universal</code> causes the specified environment variable to be given a universal scope. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
|
||||
- <code>-n</code> or <code>--names</code> List only the names of all defined variables
|
||||
- <code>-n</code> or <code>--names</code> List only the names of all defined variables, not their value
|
||||
- <code>-q</code> or <code>--query</code> test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
|
||||
- <code>-u</code> or <code>--unexport</code> causes the specified environment not to be exported to child processes
|
||||
- <code>-x</code> or <code>--export</code> causes the specified environment variable to be exported to child processes
|
||||
|
||||
10
env.c
10
env.c
@@ -457,6 +457,8 @@ void env_init()
|
||||
char **p;
|
||||
struct passwd *pw;
|
||||
wchar_t *uname;
|
||||
wchar_t *version;
|
||||
|
||||
|
||||
sb_init( &dyn_var );
|
||||
b_init( &export_buffer );
|
||||
@@ -468,6 +470,7 @@ void env_init()
|
||||
|
||||
hash_put( &env_read_only, L"status", L"" );
|
||||
hash_put( &env_read_only, L"history", L"" );
|
||||
hash_put( &env_read_only, L"version", L"" );
|
||||
hash_put( &env_read_only, L"_", L"" );
|
||||
hash_put( &env_read_only, L"LINES", L"" );
|
||||
hash_put( &env_read_only, L"COLUMNS", L"" );
|
||||
@@ -555,6 +558,13 @@ void env_init()
|
||||
env_set( L"USER", uname, ENV_GLOBAL | ENV_EXPORT );
|
||||
free( uname );
|
||||
}
|
||||
|
||||
/*
|
||||
Set up the version variable
|
||||
*/
|
||||
version = str2wcs( PACKAGE_VERSION );
|
||||
env_set( L"version", version, ENV_GLOBAL );
|
||||
free( version );
|
||||
|
||||
env_universal_init( env_get( L"FISHD_SOCKET_DIR"),
|
||||
env_get( L"USER" ),
|
||||
|
||||
1
env.h
1
env.h
@@ -129,7 +129,6 @@ char **env_export_arr( int recalc );
|
||||
|
||||
/**
|
||||
Insert all variable names into l. These are not copies of the strings and should not be freed after use.
|
||||
|
||||
*/
|
||||
void env_get_names( array_list_t *l, int flags );
|
||||
|
||||
|
||||
80
exec.c
80
exec.c
@@ -441,7 +441,9 @@ static void launch_process( process_t *p )
|
||||
{
|
||||
// debug( 1, L"exec '%ls'", p->argv[0] );
|
||||
|
||||
execve (wcs2str(p->actual_cmd), wcsv2strv( (const wchar_t **) p->argv), env_export_arr( 0 ) );
|
||||
execve ( wcs2str(p->actual_cmd),
|
||||
wcsv2strv( (const wchar_t **) p->argv),
|
||||
env_export_arr( 0 ) );
|
||||
debug( 0,
|
||||
_( L"Failed to execute process '%ls'" ),
|
||||
p->actual_cmd );
|
||||
@@ -609,21 +611,21 @@ static int set_child_group( job_t *j, process_t *p, int print_errors )
|
||||
|
||||
if( j->job_control )
|
||||
{
|
||||
int new_pgid=0;
|
||||
|
||||
if (!j->pgid)
|
||||
{
|
||||
new_pgid=1;
|
||||
j->pgid = p->pid;
|
||||
}
|
||||
|
||||
if( setpgid (p->pid, j->pgid) )
|
||||
{
|
||||
{
|
||||
if( getpgid( p->pid) != j->pgid && print_errors )
|
||||
{
|
||||
debug( 1,
|
||||
_( L"Could not send process %d from group %d to group %d" ),
|
||||
p->pid,
|
||||
_( L"Could not send process %d, '%ls' in job %d, '%ls' from group %d to group %d" ),
|
||||
p->pid,
|
||||
p->argv[0],
|
||||
j->job_id,
|
||||
j->command,
|
||||
getpgid( p->pid),
|
||||
j->pgid );
|
||||
wperror( L"setpgid" );
|
||||
@@ -671,6 +673,10 @@ void exec( job_t *j )
|
||||
*/
|
||||
int exec_error=0;
|
||||
|
||||
int needs_keepalive = 0;
|
||||
process_t keepalive;
|
||||
|
||||
|
||||
CHECK( j, );
|
||||
|
||||
if( no_exec )
|
||||
@@ -753,6 +759,53 @@ void exec( job_t *j )
|
||||
j->io = io_add( j->io, &pipe_write );
|
||||
|
||||
signal_block();
|
||||
|
||||
/*
|
||||
See if we need to create a group keepalive process. This is a
|
||||
process that we create to make sure that the process group
|
||||
doesn't die accidentally, and is needed when a block/function is
|
||||
inside a pipeline.
|
||||
*/
|
||||
|
||||
if( j->job_control )
|
||||
{
|
||||
for( p=j->first_process; p; p = p->next )
|
||||
{
|
||||
if( (p->type == INTERNAL_BLOCK ) ||
|
||||
(p->type == INTERNAL_FUNCTION ) )
|
||||
{
|
||||
if( p->next )
|
||||
{
|
||||
needs_keepalive = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( needs_keepalive )
|
||||
{
|
||||
keepalive.pid = fork();
|
||||
|
||||
if( keepalive.pid == 0 )
|
||||
{
|
||||
keepalive.pid = getpid();
|
||||
set_child_group( j, &keepalive, 1 );
|
||||
pause();
|
||||
exit(0);
|
||||
}
|
||||
else if( keepalive.pid < 0 )
|
||||
{
|
||||
/* The fork failed. */
|
||||
debug( 0, FORK_ERROR );
|
||||
wperror (L"fork");
|
||||
exit (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_child_group( j, &keepalive, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This loop loops over every process_t in the job, starting it as
|
||||
@@ -761,7 +814,7 @@ void exec( job_t *j )
|
||||
|
||||
The loop also has to handle pipelining between the jobs.
|
||||
*/
|
||||
|
||||
|
||||
for( p=j->first_process; p; p = p->next )
|
||||
{
|
||||
mypipe[1]=-1;
|
||||
@@ -1190,7 +1243,7 @@ void exec( job_t *j )
|
||||
p->pid = getpid();
|
||||
setup_child_process( j, p );
|
||||
launch_process( p );
|
||||
|
||||
|
||||
/*
|
||||
launch_process _never_ returns...
|
||||
*/
|
||||
@@ -1246,6 +1299,15 @@ void exec( job_t *j )
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
The keepalive process is no longer needed, so we terminate it
|
||||
with extreme prejudice
|
||||
*/
|
||||
if( needs_keepalive )
|
||||
{
|
||||
kill( keepalive.pid, SIGKILL );
|
||||
}
|
||||
|
||||
signal_unblock();
|
||||
|
||||
debug( 3, L"Job is constructed" );
|
||||
|
||||
191
expand.c
191
expand.c
@@ -44,6 +44,7 @@ parameter expansion.
|
||||
#include "complete.h"
|
||||
|
||||
#include "parse_util.h"
|
||||
#include "halloc.h"
|
||||
#include "halloc_util.h"
|
||||
|
||||
/**
|
||||
@@ -743,6 +744,55 @@ void expand_variable_error( const wchar_t *token, int token_pos, int error_pos )
|
||||
}
|
||||
|
||||
|
||||
static int parse_slice( wchar_t *in, wchar_t **end_ptr, array_list_t *idx )
|
||||
{
|
||||
|
||||
|
||||
wchar_t *end;
|
||||
|
||||
int pos = 1;
|
||||
|
||||
// debug( 0, L"parse_slice on '%ls'", in );
|
||||
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
long tmp;
|
||||
|
||||
while( iswspace(in[pos]) || (in[pos]==INTERNAL_SEPARATOR))
|
||||
pos++;
|
||||
|
||||
if( in[pos] == L']' )
|
||||
{
|
||||
pos++;
|
||||
break;
|
||||
}
|
||||
|
||||
errno=0;
|
||||
tmp = wcstol( &in[pos], &end, 10 );
|
||||
if( ( errno ) || ( end == &in[pos] ) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
// debug( 0, L"Push idx %d", tmp );
|
||||
|
||||
al_push_long( idx, tmp );
|
||||
pos = end-in;
|
||||
}
|
||||
|
||||
if( end_ptr )
|
||||
{
|
||||
// debug( 0, L"Remainder is '%ls', slice def was %d characters long", in+pos, pos );
|
||||
|
||||
*end_ptr = in+pos;
|
||||
}
|
||||
// debug( 0, L"ok, done" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Expand all environment variables in the string *ptr.
|
||||
|
||||
@@ -841,44 +891,22 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
|
||||
int all_vars=1;
|
||||
array_list_t var_item_list;
|
||||
al_init( &var_item_list );
|
||||
|
||||
|
||||
if( in[stop_pos] == L'[' )
|
||||
{
|
||||
wchar_t *end;
|
||||
|
||||
all_vars = 0;
|
||||
|
||||
stop_pos++;
|
||||
while( 1 )
|
||||
wchar_t *slice_end;
|
||||
all_vars=0;
|
||||
|
||||
if( parse_slice( &in[stop_pos], &slice_end, var_idx_list ) )
|
||||
{
|
||||
long tmp;
|
||||
|
||||
while( iswspace(in[stop_pos]) || (in[stop_pos]==INTERNAL_SEPARATOR))
|
||||
stop_pos++;
|
||||
|
||||
|
||||
if( in[stop_pos] == L']' )
|
||||
{
|
||||
stop_pos++;
|
||||
break;
|
||||
}
|
||||
|
||||
errno=0;
|
||||
tmp = wcstol( &in[stop_pos], &end, 10 );
|
||||
if( ( errno ) || ( end == &in[stop_pos] ) )
|
||||
{
|
||||
error( SYNTAX_ERROR,
|
||||
-1,
|
||||
L"Expected integer or \']\'" );
|
||||
|
||||
is_ok = 0;
|
||||
break;
|
||||
}
|
||||
al_push_long( var_idx_list, tmp );
|
||||
stop_pos = end-in;
|
||||
}
|
||||
}
|
||||
|
||||
error( SYNTAX_ERROR,
|
||||
-1,
|
||||
L"Invalid index value" );
|
||||
is_ok = 0;
|
||||
}
|
||||
stop_pos = (slice_end-in);
|
||||
}
|
||||
|
||||
if( is_ok )
|
||||
{
|
||||
tokenize_variable_array( var_val, &var_item_list );
|
||||
@@ -1189,16 +1217,20 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
|
||||
static int expand_cmdsubst( wchar_t *in, array_list_t *out )
|
||||
{
|
||||
wchar_t *paran_begin=0, *paran_end=0;
|
||||
int len1, len2;
|
||||
int len1;
|
||||
wchar_t prev=0;
|
||||
wchar_t *subcmd;
|
||||
array_list_t sub_res, tail_expand;
|
||||
array_list_t *sub_res, *tail_expand;
|
||||
int i, j;
|
||||
const wchar_t *item_begin;
|
||||
wchar_t *tail_begin = 0;
|
||||
void *context;
|
||||
|
||||
CHECK( in, 0 );
|
||||
CHECK( out, 0 );
|
||||
|
||||
|
||||
|
||||
switch( parse_util_locate_cmdsubst(in,
|
||||
¶n_begin,
|
||||
¶n_end,
|
||||
@@ -1217,38 +1249,93 @@ static int expand_cmdsubst( wchar_t *in, array_list_t *out )
|
||||
break;
|
||||
}
|
||||
|
||||
context = halloc( 0, 0 );
|
||||
|
||||
len1 = (paran_begin-in);
|
||||
len2 = wcslen(paran_end)-1;
|
||||
prev=0;
|
||||
item_begin = paran_begin+1;
|
||||
|
||||
al_init( &sub_res );
|
||||
if( !(subcmd = malloc( sizeof(wchar_t)*(paran_end-paran_begin) )))
|
||||
sub_res = al_halloc( context );
|
||||
if( !(subcmd = halloc( context, sizeof(wchar_t)*(paran_end-paran_begin) )))
|
||||
{
|
||||
al_destroy( &sub_res );
|
||||
halloc_free( context );
|
||||
return 0;
|
||||
}
|
||||
|
||||
wcslcpy( subcmd, paran_begin+1, paran_end-paran_begin );
|
||||
subcmd[ paran_end-paran_begin-1]=0;
|
||||
|
||||
exec_subshell( subcmd, &sub_res);
|
||||
exec_subshell( subcmd, sub_res);
|
||||
|
||||
al_init( &tail_expand );
|
||||
expand_cmdsubst( wcsdup(paran_end+1), &tail_expand );
|
||||
tail_begin = paran_end + 1;
|
||||
if( *tail_begin == L'[' )
|
||||
{
|
||||
array_list_t *slice_idx = al_halloc( context );
|
||||
wchar_t *slice_end;
|
||||
|
||||
if( parse_slice( tail_begin, &slice_end, slice_idx ) )
|
||||
{
|
||||
halloc_free( context );
|
||||
error( SYNTAX_ERROR, -1, L"Invalid index value" );
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
array_list_t *sub_res2 = al_halloc( context );
|
||||
tail_begin = slice_end;
|
||||
for( i=0; i<al_get_count( slice_idx ); i++ )
|
||||
{
|
||||
long idx = al_get_long( slice_idx, i );
|
||||
if( idx < 0 )
|
||||
{
|
||||
idx = al_get_count( sub_res ) + idx + 1;
|
||||
}
|
||||
|
||||
if( idx < 1 || idx > al_get_count( sub_res ) )
|
||||
{
|
||||
halloc_free( context );
|
||||
error( SYNTAX_ERROR, -1, L"Invalid index value" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
idx = idx-1;
|
||||
|
||||
al_push( sub_res2, al_get( sub_res, idx ) );
|
||||
// debug( 0, L"Pushing item '%ls' with index %d onto sliced result", al_get( sub_res, idx ), idx );
|
||||
|
||||
al_set( sub_res, idx, 0 );
|
||||
}
|
||||
al_foreach( sub_res, &free );
|
||||
sub_res = sub_res2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for( i=0; i<al_get_count( &sub_res ); i++ )
|
||||
tail_expand = al_halloc( context );
|
||||
|
||||
/*
|
||||
Recursively call ourselves to expand any remaining command
|
||||
substitutions. The result of this recusrive call usiung the tail
|
||||
of the string is inserted into the tail_expand array list
|
||||
*/
|
||||
expand_cmdsubst( wcsdup(tail_begin), tail_expand );
|
||||
|
||||
/*
|
||||
Combine the result of the current command substitution with the
|
||||
result of the recusrive tail expansion
|
||||
*/
|
||||
for( i=0; i<al_get_count( sub_res ); i++ )
|
||||
{
|
||||
wchar_t *sub_item, *sub_item2;
|
||||
sub_item = (wchar_t *)al_get( &sub_res, i );
|
||||
sub_item = (wchar_t *)al_get( sub_res, i );
|
||||
sub_item2 = escape( sub_item, 1 );
|
||||
free(sub_item);
|
||||
int item_len = wcslen( sub_item2 );
|
||||
|
||||
for( j=0; j<al_get_count( &tail_expand ); j++ )
|
||||
for( j=0; j<al_get_count( tail_expand ); j++ )
|
||||
{
|
||||
string_buffer_t whole_item;
|
||||
wchar_t *tail_item = (wchar_t *)al_get( &tail_expand, j );
|
||||
wchar_t *tail_item = (wchar_t *)al_get( tail_expand, j );
|
||||
|
||||
sb_init( &whole_item );
|
||||
|
||||
@@ -1265,12 +1352,8 @@ static int expand_cmdsubst( wchar_t *in, array_list_t *out )
|
||||
}
|
||||
free(in);
|
||||
|
||||
al_destroy( &sub_res );
|
||||
|
||||
al_foreach( &tail_expand, &free );
|
||||
al_destroy( &tail_expand );
|
||||
|
||||
free( subcmd );
|
||||
al_foreach( tail_expand, &free );
|
||||
halloc_free( context );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
17
fallback.c
17
fallback.c
@@ -1072,7 +1072,22 @@ int _nl_msg_cat_cntr=0;
|
||||
#ifndef HAVE_KILLPG
|
||||
int killpg( int pgr, int sig )
|
||||
{
|
||||
assert( pgr > 0 );
|
||||
assert( pgr > 1 );
|
||||
return kill( -pgr, sig );
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WORKING_GETOPT_LONG
|
||||
|
||||
int getopt_long( int argc,
|
||||
char * const argv[],
|
||||
const char *optstring,
|
||||
const struct option *longopts,
|
||||
int *longindex )
|
||||
{
|
||||
return getopt( argc, argv, optstring );
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
40
fallback.h
40
fallback.h
@@ -9,6 +9,8 @@
|
||||
#include <wchar.h>
|
||||
#include <limits.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef WCHAR_MAX
|
||||
/**
|
||||
@@ -47,6 +49,10 @@ typedef char tputs_arg_t;
|
||||
#define SIGIO SIGUSR1
|
||||
#endif
|
||||
|
||||
#ifndef SIGWINCH
|
||||
#define SIGIO SIGUSR2
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WINSIZE
|
||||
struct winsize
|
||||
{
|
||||
@@ -304,7 +310,7 @@ size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
|
||||
/**
|
||||
BSD del_curterm seems to do a double-free. We redefine it as a no-op
|
||||
*/
|
||||
#define del_curterm(oterm) 1
|
||||
#define del_curterm(oterm) OK
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LRAND48_R
|
||||
@@ -385,5 +391,37 @@ extern int _nl_msg_cat_cntr;
|
||||
int killpg( int pgr, int sig );
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_WORKING_GETOPT_LONG
|
||||
|
||||
struct option
|
||||
{
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
}
|
||||
;
|
||||
|
||||
#ifndef no_argument
|
||||
#define no_argument 0
|
||||
#endif
|
||||
|
||||
#ifndef required_argument
|
||||
#define required_argument 1
|
||||
#endif
|
||||
|
||||
#ifndef optional_argument
|
||||
#define optional_argument 2
|
||||
#endif
|
||||
|
||||
int getopt_long(int argc,
|
||||
char * const argv[],
|
||||
const char *optstring,
|
||||
const struct option *longopts,
|
||||
int *longindex);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
15
fish_pager.c
15
fish_pager.c
@@ -583,14 +583,13 @@ static int completion_try_print( int cols,
|
||||
*/
|
||||
while(do_loop)
|
||||
{
|
||||
wchar_t msg[10];
|
||||
int percent = 100*pos/(rows-termsize.ws_row+1);
|
||||
wchar_t msg[30];
|
||||
int percent = 100*(pos+rows)/(2*rows-termsize.ws_row+1);
|
||||
set_color( FISH_COLOR_BLACK,
|
||||
get_color(HIGHLIGHT_PAGER_PROGRESS) );
|
||||
swprintf( msg, 12,
|
||||
L" %ls(%d%%) \r",
|
||||
percent==100?L"":(percent >=10?L" ": L" "),
|
||||
percent );
|
||||
swprintf( msg, 30,
|
||||
L" %d to %d of %d \r",
|
||||
pos, pos+termsize.ws_row-1, rows );
|
||||
writestr(msg);
|
||||
set_color( FISH_COLOR_NORMAL, FISH_COLOR_NORMAL );
|
||||
pager_flush();
|
||||
@@ -931,7 +930,7 @@ static void init()
|
||||
output_set_writer( &pager_buffered_writer );
|
||||
pager_buffer = halloc( global_context, sizeof( buffer_t ) );
|
||||
halloc_register_function( global_context, (void (*)(void *))&b_destroy, pager_buffer );
|
||||
|
||||
|
||||
sigemptyset( & act.sa_mask );
|
||||
act.sa_flags=0;
|
||||
act.sa_handler=SIG_DFL;
|
||||
@@ -944,7 +943,7 @@ static void init()
|
||||
}
|
||||
|
||||
handle_winch( 0 ); /* Set handler for window change events */
|
||||
|
||||
|
||||
tcgetattr(0,&pager_modes); /* get the current terminal modes */
|
||||
memcpy( &saved_modes,
|
||||
&pager_modes,
|
||||
|
||||
6
fishd.c
6
fishd.c
@@ -494,7 +494,6 @@ int main( int argc, char ** argv )
|
||||
*/
|
||||
while( 1 )
|
||||
{
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
static struct option
|
||||
long_options[] =
|
||||
{
|
||||
@@ -520,11 +519,6 @@ int main( int argc, char ** argv )
|
||||
long_options,
|
||||
&opt_index );
|
||||
|
||||
#else
|
||||
int opt = getopt( argc,
|
||||
argv,
|
||||
GETOPT_STRING );
|
||||
#endif
|
||||
if( opt == -1 )
|
||||
break;
|
||||
|
||||
|
||||
2
halloc.c
2
halloc.c
@@ -74,7 +74,7 @@ typedef struct halloc
|
||||
size_t scratch_free;
|
||||
#if __STDC_VERSION__ < 199901L
|
||||
/**
|
||||
The actual data. MAde to be of type long long to make sure memory alignment is in order.
|
||||
The actual data. Made to be of type long long to make sure memory alignment is in order.
|
||||
*/
|
||||
long long data[1]; // Waste one byte on non-C99 compilers... :-(
|
||||
#else
|
||||
|
||||
6
main.c
6
main.c
@@ -123,7 +123,6 @@ int main( int argc, char **argv )
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
static struct option
|
||||
long_options[] =
|
||||
{
|
||||
@@ -173,11 +172,6 @@ int main( int argc, char **argv )
|
||||
long_options,
|
||||
&opt_index );
|
||||
|
||||
#else
|
||||
int opt = getopt( argc,
|
||||
argv,
|
||||
GETOPT_STRING );
|
||||
#endif
|
||||
if( opt == -1 )
|
||||
break;
|
||||
|
||||
|
||||
12
mimedb.c
12
mimedb.c
@@ -135,14 +135,10 @@ static int launch_len=0;
|
||||
*/
|
||||
static int launch_pos=0;
|
||||
|
||||
#if HAVE_GETTEXT
|
||||
/**
|
||||
gettext alias
|
||||
*/
|
||||
#define _(string) gettext(string)
|
||||
#else
|
||||
#define _(string) (string)
|
||||
#endif
|
||||
|
||||
/**
|
||||
Dynamically generated function, made from the documentation in doc_src.
|
||||
@@ -1145,10 +1141,8 @@ static void clear_entry( void *key, void *val )
|
||||
static void locale_init()
|
||||
{
|
||||
setlocale( LC_ALL, "" );
|
||||
#if HAVE_GETTEXT
|
||||
bindtextdomain( PACKAGE_NAME, LOCALEDIR );
|
||||
textdomain( PACKAGE_NAME );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1174,7 +1168,6 @@ int main (int argc, char *argv[])
|
||||
*/
|
||||
while( 1 )
|
||||
{
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
static struct option
|
||||
long_options[] =
|
||||
{
|
||||
@@ -1228,11 +1221,6 @@ int main (int argc, char *argv[])
|
||||
long_options,
|
||||
&opt_index );
|
||||
|
||||
#else
|
||||
int opt = getopt( argc,
|
||||
argv,
|
||||
GETOPT_STRING );
|
||||
#endif
|
||||
if( opt == -1 )
|
||||
break;
|
||||
|
||||
|
||||
115
parse_util.c
115
parse_util.c
@@ -580,34 +580,46 @@ int parse_util_unload( const wchar_t *cmd,
|
||||
return !!val;
|
||||
}
|
||||
|
||||
static int path_util_load_internal( const wchar_t *cmd,
|
||||
void (*on_load)(const wchar_t *cmd),
|
||||
int reload,
|
||||
autoload_t *loaded,
|
||||
array_list_t *path_list );
|
||||
|
||||
|
||||
int parse_util_load( const wchar_t *cmd,
|
||||
const wchar_t *path_var_name,
|
||||
void (*on_load)(const wchar_t *cmd),
|
||||
int reload )
|
||||
{
|
||||
static array_list_t *path_list=0;
|
||||
static string_buffer_t *path=0;
|
||||
array_list_t *path_list=0;
|
||||
|
||||
int i;
|
||||
time_t *tm;
|
||||
int reloaded = 0;
|
||||
autoload_t *loaded;
|
||||
|
||||
wchar_t *path_var;
|
||||
|
||||
int res;
|
||||
int c, c2;
|
||||
|
||||
CHECK( path_var_name, 0 );
|
||||
CHECK( cmd, 0 );
|
||||
|
||||
// debug( 0, L"Autoload %ls in %ls", cmd, path_var_name );
|
||||
|
||||
path_var = env_get( path_var_name );
|
||||
|
||||
/*
|
||||
Do we know where to look
|
||||
Do we know where to look?
|
||||
*/
|
||||
if( !path_var )
|
||||
{
|
||||
// debug( 0, L"Path null" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Init if this is the first time we try to autoload anything
|
||||
*/
|
||||
if( !all_loaded )
|
||||
{
|
||||
all_loaded = malloc( sizeof( hash_table_t ) );
|
||||
@@ -623,9 +635,14 @@ int parse_util_load( const wchar_t *cmd,
|
||||
|
||||
if( loaded )
|
||||
{
|
||||
/**
|
||||
Warn and fail on infinite recursion
|
||||
*/
|
||||
if( hash_get( &loaded->is_loading, cmd ) )
|
||||
{
|
||||
debug( 0, _(L"Could not autoload item %ls, it is already being autoloaded. This is a circular dependency in the autoloading scripts, please remove it."), cmd );
|
||||
debug( 0,
|
||||
_(L"Could not autoload item '%ls', it is already being autoloaded. This is a circular dependency in the autoloading scripts, please remove it."),
|
||||
cmd );
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -637,35 +654,86 @@ int parse_util_load( const wchar_t *cmd,
|
||||
{
|
||||
parse_util_load_reset( path_var_name, on_load);
|
||||
reload = parse_util_load( cmd, path_var_name, on_load, reload );
|
||||
// debug( 0, L"Reload" );
|
||||
return reload;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
We have never tried to autoload using this name before, set up initial data
|
||||
We have never tried to autoload using this path name before,
|
||||
set up initial data
|
||||
*/
|
||||
loaded = malloc( sizeof( autoload_t ) );
|
||||
loaded = malloc( sizeof( autoload_t ) );
|
||||
if( !loaded )
|
||||
{
|
||||
DIE_MEM();
|
||||
}
|
||||
hash_init( &loaded->load_time, &hash_wcs_func, &hash_wcs_cmp );
|
||||
hash_put( all_loaded, wcsdup(path_var_name), loaded );
|
||||
|
||||
|
||||
hash_init( &loaded->is_loading, &hash_wcs_func, &hash_wcs_cmp );
|
||||
|
||||
loaded->old_path = wcsdup( path_var );
|
||||
}
|
||||
|
||||
hash_put( &loaded->is_loading, cmd, cmd );
|
||||
|
||||
path_list = al_new( global_context);
|
||||
|
||||
tokenize_variable_array( path_var, path_list );
|
||||
|
||||
c = al_get_count( path_list );
|
||||
|
||||
hash_put( &loaded->is_loading, cmd, cmd );
|
||||
|
||||
/*
|
||||
Do the actual work in the internal helper function
|
||||
*/
|
||||
|
||||
res = path_util_load_internal( cmd, on_load, reload, loaded, path_list );
|
||||
|
||||
/**
|
||||
Cleanup
|
||||
*/
|
||||
hash_remove( &loaded->is_loading, cmd, 0, 0 );
|
||||
|
||||
c2 = al_get_count( path_list );
|
||||
|
||||
al_foreach( path_list, &free );
|
||||
al_destroy( path_list );
|
||||
free( path_list );
|
||||
|
||||
/**
|
||||
Make sure we didn't 'drop' something
|
||||
*/
|
||||
|
||||
assert( c == c2 );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
This internal helper function does all the real work. By using two
|
||||
functions, the internal function can return on various places in
|
||||
the code, and the caller can take care of various cleanup work.
|
||||
*/
|
||||
|
||||
static int path_util_load_internal( const wchar_t *cmd,
|
||||
void (*on_load)(const wchar_t *cmd),
|
||||
int reload,
|
||||
autoload_t *loaded,
|
||||
array_list_t *path_list )
|
||||
{
|
||||
static string_buffer_t *path=0;
|
||||
time_t *tm;
|
||||
int i;
|
||||
int reloaded = 0;
|
||||
|
||||
/*
|
||||
Get modification time of file
|
||||
*/
|
||||
tm = (time_t *)hash_get( &loaded->load_time, cmd );
|
||||
|
||||
|
||||
/*
|
||||
Did we just check this?
|
||||
*/
|
||||
@@ -673,7 +741,7 @@ int parse_util_load( const wchar_t *cmd,
|
||||
{
|
||||
if(time(0)-tm[1]<=1)
|
||||
{
|
||||
hash_remove( &loaded->is_loading, cmd, 0, 0 );
|
||||
// debug( 0, L"Cached" );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -683,20 +751,16 @@ int parse_util_load( const wchar_t *cmd,
|
||||
*/
|
||||
if( !reload && tm )
|
||||
{
|
||||
hash_remove( &loaded->is_loading, cmd, 0, 0 );
|
||||
// debug( 0, L"Weak check" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( !path_list )
|
||||
path_list = al_halloc( global_context);
|
||||
|
||||
if( !path )
|
||||
path = sb_halloc( global_context );
|
||||
else
|
||||
sb_clear( path );
|
||||
|
||||
tokenize_variable_array( path_var, path_list );
|
||||
|
||||
/*
|
||||
Iterate over path searching for suitable completion files
|
||||
*/
|
||||
@@ -706,6 +770,7 @@ int parse_util_load( const wchar_t *cmd,
|
||||
wchar_t *next = (wchar_t *)al_get( path_list, i );
|
||||
sb_clear( path );
|
||||
sb_append2( path, next, L"/", cmd, L".fish", (void *)0 );
|
||||
|
||||
if( (wstat( (wchar_t *)path->buff, &buf )== 0) &&
|
||||
(waccess( (wchar_t *)path->buff, R_OK ) == 0) )
|
||||
{
|
||||
@@ -713,6 +778,7 @@ int parse_util_load( const wchar_t *cmd,
|
||||
{
|
||||
wchar_t *esc = escape( (wchar_t *)path->buff, 1 );
|
||||
wchar_t *src_cmd = wcsdupcat( L". ", esc );
|
||||
free( esc );
|
||||
|
||||
if( !tm )
|
||||
{
|
||||
@@ -727,7 +793,6 @@ int parse_util_load( const wchar_t *cmd,
|
||||
intern( cmd ),
|
||||
tm );
|
||||
|
||||
free( esc );
|
||||
|
||||
if( on_load )
|
||||
on_load(cmd );
|
||||
@@ -738,8 +803,8 @@ int parse_util_load( const wchar_t *cmd,
|
||||
exec_subshell( src_cmd, 0 );
|
||||
free(src_cmd);
|
||||
reloaded = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -759,10 +824,8 @@ int parse_util_load( const wchar_t *cmd,
|
||||
hash_put( &loaded->load_time, intern( cmd ), tm );
|
||||
}
|
||||
|
||||
al_foreach( path_list, &free );
|
||||
al_truncate( path_list, 0 );
|
||||
|
||||
hash_remove( &loaded->is_loading, cmd, 0, 0 );
|
||||
// debug( 0, L"Regular return" );
|
||||
|
||||
return reloaded;
|
||||
}
|
||||
|
||||
|
||||
23
parser.c
23
parser.c
@@ -251,11 +251,6 @@ The fish parser. Contains functions for parsing code.
|
||||
#define UNKNOWN_BLOCK N_( L"unknown/invalid block" )
|
||||
|
||||
|
||||
/**
|
||||
Size of the error string buffer
|
||||
*/
|
||||
#define ERR_STR_SZ 1024
|
||||
|
||||
/**
|
||||
Datastructure to describe a block type, like while blocks, command substitution blocks, etc.
|
||||
*/
|
||||
@@ -350,7 +345,7 @@ io_data_t *block_io;
|
||||
static int err_pos;
|
||||
|
||||
/** Description of last error */
|
||||
static wchar_t err_str[ERR_STR_SZ];
|
||||
static string_buffer_t *err_buff=0;
|
||||
|
||||
/** Pointer to the current tokenizer */
|
||||
static tokenizer *current_tokenizer;
|
||||
@@ -756,11 +751,17 @@ void error( int ec, int p, const wchar_t *str, ... )
|
||||
{
|
||||
va_list va;
|
||||
|
||||
if( !err_buff )
|
||||
err_buff = sb_halloc( global_context );
|
||||
|
||||
|
||||
error_code = ec;
|
||||
err_pos = p;
|
||||
|
||||
va_start( va, str );
|
||||
vswprintf( err_str, ERR_STR_SZ, str, va );
|
||||
|
||||
sb_vprintf( err_buff, str, va );
|
||||
|
||||
va_end( va );
|
||||
|
||||
}
|
||||
@@ -1007,11 +1008,11 @@ void parser_destroy()
|
||||
*/
|
||||
static void print_errors( string_buffer_t *target, const wchar_t *prefix )
|
||||
{
|
||||
if( error_code )
|
||||
if( error_code && err_buff )
|
||||
{
|
||||
int tmp;
|
||||
|
||||
sb_printf( target, L"%ls: %ls\n", prefix, err_str );
|
||||
sb_printf( target, L"%ls: %ls\n", prefix, (wchar_t *)err_buff->buff );
|
||||
|
||||
tmp = current_tokenizer_pos;
|
||||
current_tokenizer_pos = err_pos;
|
||||
@@ -1027,9 +1028,9 @@ static void print_errors( string_buffer_t *target, const wchar_t *prefix )
|
||||
*/
|
||||
static void print_errors_stderr()
|
||||
{
|
||||
if( error_code )
|
||||
if( error_code && err_buff )
|
||||
{
|
||||
debug( 0, L"%ls", err_str );
|
||||
debug( 0, L"%ls", (wchar_t *)err_buff->buff );
|
||||
int tmp;
|
||||
|
||||
tmp = current_tokenizer_pos;
|
||||
|
||||
2
proc.c
2
proc.c
@@ -454,7 +454,7 @@ void job_handle_signal ( int signal, siginfo_t *info, void *con )
|
||||
handle_child_status( pid, status );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
kill( 0, SIGIO );
|
||||
errno=errno_old;
|
||||
}
|
||||
|
||||
134
reader.c
134
reader.c
@@ -939,13 +939,14 @@ void reader_exit( int do_exit, int forced )
|
||||
|
||||
}
|
||||
|
||||
void repaint()
|
||||
void repaint( int skip_return )
|
||||
{
|
||||
int steps;
|
||||
|
||||
calc_output();
|
||||
set_color( FISH_COLOR_RESET, FISH_COLOR_RESET );
|
||||
writech('\r');
|
||||
if( !skip_return )
|
||||
writech('\r');
|
||||
writembs(clr_eol);
|
||||
write_prompt();
|
||||
write_cmdline();
|
||||
@@ -975,7 +976,7 @@ static void check_colors()
|
||||
{
|
||||
memcpy( data->color, data->new_color, sizeof(int)*data->buff_len );
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1047,7 +1048,7 @@ static void reader_check_status()
|
||||
|
||||
if( changed )
|
||||
{
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
set_color( FISH_COLOR_RESET, FISH_COLOR_RESET );
|
||||
}
|
||||
}
|
||||
@@ -1108,7 +1109,7 @@ static void remove_backward()
|
||||
data->new_color,
|
||||
sizeof(int) * data->buff_len );
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1198,7 +1199,7 @@ static int insert_char( int c )
|
||||
/* Nope, colors are off, so we repaint the entire command line */
|
||||
memcpy( data->color, data->new_color, sizeof(int) * data->buff_len );
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
}
|
||||
// wcscpy(data->search_buff,data->buff);
|
||||
return 1;
|
||||
@@ -1245,7 +1246,7 @@ static int insert_str(wchar_t *str)
|
||||
|
||||
/* repaint */
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
|
||||
}
|
||||
return 1;
|
||||
@@ -1654,7 +1655,7 @@ static int handle_completions( array_list_t *comp )
|
||||
}
|
||||
|
||||
free( prefix );
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
|
||||
}
|
||||
|
||||
@@ -1800,7 +1801,7 @@ static void handle_history( const wchar_t *new_str )
|
||||
data->buff_pos=wcslen(data->buff);
|
||||
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1885,7 +1886,7 @@ static void handle_token_history( int forward, int reset )
|
||||
|
||||
reader_replace_current_token( str );
|
||||
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1958,7 +1959,7 @@ static void handle_token_history( int forward, int reset )
|
||||
{
|
||||
reader_replace_current_token( str );
|
||||
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
al_push( &data->search_prev, str );
|
||||
data->search_pos = al_get_count( &data->search_prev )-1;
|
||||
}
|
||||
@@ -1983,11 +1984,25 @@ static void handle_token_history( int forward, int reset )
|
||||
static void move_word( int dir, int erase )
|
||||
{
|
||||
int end_buff_pos=data->buff_pos;
|
||||
int mode=0;
|
||||
int step = dir?1:-1;
|
||||
|
||||
while( mode < 2 )
|
||||
/*
|
||||
If we are beyond the last character and moving left, start by
|
||||
moving one step, since otehrwise we'll start on the \0, which
|
||||
should be ignored.
|
||||
*/
|
||||
if( !dir && (end_buff_pos == data->buff_len) )
|
||||
{
|
||||
if( !end_buff_pos )
|
||||
return;
|
||||
|
||||
end_buff_pos--;
|
||||
}
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
wchar_t c;
|
||||
|
||||
if( !dir )
|
||||
{
|
||||
if( end_buff_pos == 0 )
|
||||
@@ -1998,41 +2013,46 @@ static void move_word( int dir, int erase )
|
||||
if( end_buff_pos == data->buff_len )
|
||||
break;
|
||||
}
|
||||
end_buff_pos+=step;
|
||||
|
||||
if( end_buff_pos < data->buff_len )
|
||||
c = data->buff[end_buff_pos];
|
||||
|
||||
if( !iswspace( c ) )
|
||||
{
|
||||
switch( mode )
|
||||
{
|
||||
case 0:
|
||||
if( iswalnum(data->buff[end_buff_pos] ) )
|
||||
mode++;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if( !iswalnum(data->buff[end_buff_pos] ) )
|
||||
{
|
||||
if( !dir )
|
||||
end_buff_pos -= step;
|
||||
mode++;
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case 2:
|
||||
if( !iswspace(data->buff[end_buff_pos] ) )
|
||||
{
|
||||
mode++;
|
||||
if( !dir )
|
||||
end_buff_pos-=step;
|
||||
}
|
||||
break;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
end_buff_pos+=step;
|
||||
}
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
wchar_t c;
|
||||
|
||||
if( !dir )
|
||||
{
|
||||
if( end_buff_pos == 0 )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( end_buff_pos == data->buff_len )
|
||||
break;
|
||||
}
|
||||
|
||||
if( mode==2)
|
||||
break;
|
||||
c = data->buff[end_buff_pos];
|
||||
|
||||
if( !iswalnum( c ) )
|
||||
{
|
||||
/*
|
||||
Don't gobble the boundary character if it was a
|
||||
whitespace, but do for all other non-alphabetic
|
||||
characters
|
||||
*/
|
||||
if( iswspace( c ) )
|
||||
end_buff_pos -= step;
|
||||
break;
|
||||
}
|
||||
end_buff_pos+=step;
|
||||
}
|
||||
|
||||
if( erase )
|
||||
@@ -2051,7 +2071,7 @@ static void move_word( int dir, int erase )
|
||||
|
||||
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2076,7 +2096,7 @@ static void move_word( int dir, int erase )
|
||||
}
|
||||
}
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
// check_colors();
|
||||
}
|
||||
}
|
||||
@@ -2430,7 +2450,7 @@ wchar_t *reader_readline()
|
||||
data->exec_prompt=1;
|
||||
|
||||
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
|
||||
repaint();
|
||||
repaint( 1 );
|
||||
|
||||
tcgetattr(0,&old_modes); /* get the current terminal modes */
|
||||
if( tcsetattr(0,TCSANOW,&shell_modes)) /* set the new modes */
|
||||
@@ -2515,7 +2535,7 @@ wchar_t *reader_readline()
|
||||
{
|
||||
data->buff_pos = 0;
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2524,14 +2544,14 @@ wchar_t *reader_readline()
|
||||
{
|
||||
data->buff_pos = data->buff_len;
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
case R_NULL:
|
||||
{
|
||||
data->exec_prompt=1;
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2600,7 +2620,7 @@ wchar_t *reader_readline()
|
||||
data->buff[data->buff_len]=L'\0';
|
||||
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2619,7 +2639,7 @@ wchar_t *reader_readline()
|
||||
data->buff_pos=0;
|
||||
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2630,7 +2650,7 @@ wchar_t *reader_readline()
|
||||
data->buff[data->buff_len]=L'\0';
|
||||
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2728,7 +2748,7 @@ wchar_t *reader_readline()
|
||||
writech('\r');
|
||||
writembs(clr_eol);
|
||||
writech('\n');
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -2812,7 +2832,7 @@ wchar_t *reader_readline()
|
||||
}
|
||||
else
|
||||
{
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2833,7 +2853,7 @@ wchar_t *reader_readline()
|
||||
{
|
||||
data->buff_pos++;
|
||||
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2844,7 +2864,7 @@ wchar_t *reader_readline()
|
||||
data->buff[0]=0;
|
||||
data->buff_len=0;
|
||||
data->buff_pos=0;
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2880,7 +2900,7 @@ wchar_t *reader_readline()
|
||||
{
|
||||
if( clear_screen )
|
||||
writembs( clear_screen );
|
||||
repaint();
|
||||
repaint( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
15
set_color.c
15
set_color.c
@@ -56,11 +56,7 @@
|
||||
*/
|
||||
#define GETOPT_STRING "b:hvocu"
|
||||
|
||||
#if HAVE_GETTEXT
|
||||
#define _(string) gettext(string)
|
||||
#else
|
||||
#define _(string) (string)
|
||||
#endif
|
||||
|
||||
char *col[]=
|
||||
{
|
||||
@@ -141,10 +137,8 @@ static void check_locale_init()
|
||||
|
||||
is_init = 1;
|
||||
setlocale( LC_ALL, "" );
|
||||
#if HAVE_GETTEXT
|
||||
bindtextdomain( PACKAGE_NAME, LOCALEDIR );
|
||||
textdomain( PACKAGE_NAME );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +153,6 @@ int main( int argc, char **argv )
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
static struct option
|
||||
long_options[] =
|
||||
{
|
||||
@@ -200,11 +193,7 @@ int main( int argc, char **argv )
|
||||
GETOPT_STRING,
|
||||
long_options,
|
||||
&opt_index );
|
||||
#else
|
||||
int opt = getopt( argc,
|
||||
argv,
|
||||
GETOPT_STRING );
|
||||
#endif
|
||||
|
||||
if( opt == -1 )
|
||||
break;
|
||||
|
||||
@@ -339,7 +328,7 @@ int main( int argc, char **argv )
|
||||
|
||||
if( del_curterm( cur_term ) == ERR )
|
||||
{
|
||||
debug( 0, _(L"Error while closing terminfo") );
|
||||
fprintf( stderr, _("Error while closing terminfo") );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ complete -c complete -s u -l unauthorative -d (N_ "Option list is not complete")
|
||||
complete -c complete -s e -l erase -d (N_ "Remove completion")
|
||||
complete -c complete -s h -l help -d (N_ "Display help and exit")
|
||||
complete -c complete -s C -l do-complete -d (N_ "Print all completions for the specified commandline")
|
||||
complete -c complete -s n -l complete -d (N_ "The completion should only be used if the specified command has a zero exit status") -r
|
||||
complete -c complete -s n -l condition -d (N_ "The completion should only be used if the specified command has a zero exit status") -r
|
||||
|
||||
@@ -4,23 +4,6 @@
|
||||
# Incomplete, the number of switches for darcs is _huge_
|
||||
#
|
||||
|
||||
#
|
||||
# Test if a non-switch argument has been given
|
||||
#
|
||||
|
||||
function __fish_use_subcommand
|
||||
set -l -- cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
continue
|
||||
end
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
#
|
||||
# If no subcommand has been specified, complete using all available subcommands
|
||||
#
|
||||
|
||||
@@ -4,3 +4,4 @@ complete -c functions -s a -l all -d (N_ "Show hidden functions")
|
||||
complete -c functions -s h -l help -d (N_ "Display help and exit")
|
||||
complete -c functions -s d -l description -d (N_ "Set function description") -x
|
||||
complete -c functions -s q -l query -d (N_ "Test if function is defined")
|
||||
complete -c functions -s n -l names -d (N_ "List the names of the functions, but not their definition")
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
#Completions for make
|
||||
# Completions for make
|
||||
|
||||
function __fish_print_make_targets
|
||||
set files Makefile makefile GNUmakefile
|
||||
grep -h -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $files | cut -d ":" -f 1 | sed -e 's/^ *//;s/ *$//;s/ */\n/g' ^/dev/null
|
||||
end
|
||||
|
||||
# This completion is a bit ugly. It reenables file completion on
|
||||
# assignments, so e.g. 'make foo FILES=<tab>' will recive standard
|
||||
# filename completion. Unfortunatly, this turns out to be a bit
|
||||
# complicated to do.
|
||||
|
||||
set -l is_assignment "commandline -ct|grep '..*='"
|
||||
set -l complete_file_assignment '(commandline -ct)(complete --do-complete=this_command_does_not_exist\ (commandline -ct|sed -e \'s/.*=//\'))'
|
||||
complete -c make --condition $is_assignment -a $complete_file_assignment
|
||||
|
||||
complete -x -c make -a "(__fish_print_make_targets)" -d (N_ "Target")
|
||||
complete -r -c make -s f -d (N_ "Use file as makefile") -r
|
||||
complete -x -c make -s C -x -a "(__fish_complete_directory (commandline -ct))" -d (N_ "Change directory")
|
||||
|
||||
@@ -63,6 +63,8 @@ complete -c set -n '__fish_is_first_token' -s l -l local -d (N_ "Make variable s
|
||||
complete -c set -n '__fish_is_first_token' -s U -l universal -d (N_ "Make variable scope universal, i.e. share variable with all the users fish processes on this computer")
|
||||
complete -c set -n '__fish_is_first_token' -s q -l query -d (N_ "Test if variable is defined")
|
||||
complete -c set -n '__fish_is_first_token' -s h -l help -d (N_ "Display help and exit")
|
||||
complete -c set -n '__fish_is_first_token' -s n -l names -d (N_ "List the names of the variables, but not their value")
|
||||
|
||||
|
||||
# Complete using preexisting variable names
|
||||
complete -c set -n '__fish_is_first_token' -x -a "(set|sed -e 's/ /'\t'Variable: /')"
|
||||
|
||||
@@ -2,47 +2,35 @@
|
||||
# Completions for the svn VCS command
|
||||
#
|
||||
|
||||
function __fish_svn_subcommand_allowed
|
||||
set -l svncommands add blame cat checkout cleanup commit copy delete diff di help import info list lock log merge mkdir move propdel propedit propget proplist resolved revert status switch unlock update
|
||||
set -l -- cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
if contains -- $i $svncommands
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
#
|
||||
# If no subcommand has been specified, complete using all available subcommands
|
||||
#
|
||||
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'add\t"'(_ "Place files or directories under version control")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'blame\t"'(_ "Output files/URLs with revision and author information inline")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'cat\t"'(_ "Output content of files/URLs")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'checkout\t"'(_ "Check out a working copy from the repository")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'cleanup\t"'(_ "Recursively clean up the working copy")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'commit\t"'(_ "Send changes from your working copy to the repository")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'import\t"'(_ "Commit an unversioned file or tree into the repository")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'info\t"'(_ "Display information about a local or remote item")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'list\t"'(_ "List directory entries in the repository")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'lock\t"'(_ "Lock working copy paths or URLs in the repository")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'log\t"'(_ "Show the log messages for a set of revision(s) and/or file(s)")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'merge\t"'(_ "Apply the differences between two sources to a working copy path")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'mkdir\t"'(_ "Create a new directory under version control")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'move\t"'(_ "Move and/or rename something in working copy or repository")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'propdel\t"'(_ "Remove a property from files, dirs, or revisions")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'propedit\t"'(_ "Edit a property with an external editor on targets")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'propget\t"'(_ "Print value of a property on files, dirs, or revisions")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'proplist\t"'(_ "List all properties on files, dirs, or revisions")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'resolved\t"'(_ "Remove conflicted state on working copy files or directories")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'revert\t"'(_ "Restore pristine working copy file")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'status\t"'(_ "Print the status of working copy files and directories")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'switch\t"'(_ "Update the working copy to a different URL")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'unlock\t"'(_ "Unlock working copy paths or URLs")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'update\t"'(_ "Bring changes from the repository into the working copy")'"'
|
||||
complete -c svn -n '__fish_svn_subcommand_allowed' -xa 'help\t"'(_ "Describe the usage of this program or its subcommands")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'add\t"'(_ "Place files or directories under version control")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'blame\t"'(_ "Output files/URLs with revision and author information inline")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'cat\t"'(_ "Output content of files/URLs")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'checkout\t"'(_ "Check out a working copy from the repository")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'cleanup\t"'(_ "Recursively clean up the working copy")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'commit\t"'(_ "Send changes from your working copy to the repository")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'import\t"'(_ "Commit an unversioned file or tree into the repository")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'info\t"'(_ "Display information about a local or remote item")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'list\t"'(_ "List directory entries in the repository")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'lock\t"'(_ "Lock working copy paths or URLs in the repository")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'log\t"'(_ "Show the log messages for a set of revision(s) and/or file(s)")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'merge\t"'(_ "Apply the differences between two sources to a working copy path")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'mkdir\t"'(_ "Create a new directory under version control")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'move\t"'(_ "Move and/or rename something in working copy or repository")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'propdel\t"'(_ "Remove a property from files, dirs, or revisions")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'propedit\t"'(_ "Edit a property with an external editor on targets")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'propget\t"'(_ "Print value of a property on files, dirs, or revisions")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'proplist\t"'(_ "List all properties on files, dirs, or revisions")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'resolved\t"'(_ "Remove conflicted state on working copy files or directories")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'revert\t"'(_ "Restore pristine working copy file")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'status\t"'(_ "Print the status of working copy files and directories")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'switch\t"'(_ "Update the working copy to a different URL")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'unlock\t"'(_ "Unlock working copy paths or URLs")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'update\t"'(_ "Bring changes from the repository into the working copy")'"'
|
||||
complete -c svn -n '__fish_use_subcommand' -xa 'help\t"'(_ "Describe the usage of this program or its subcommands")'"'
|
||||
|
||||
# -s/--revision
|
||||
complete -c svn -n '__fish_seen_subcommand_from blame cat checkout info list log merge move propdel propedit propget proplist switch update' -x -s r -l revision -d (N_ "Specify revision")
|
||||
|
||||
14
share/functions/__fish_use_subcommand.fish
Normal file
14
share/functions/__fish_use_subcommand.fish
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
function __fish_use_subcommand -d "Test if a non-switch argument has been given in the current commandline"
|
||||
set -l -- cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
continue
|
||||
end
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user