mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Various minor codee updates. Dead code removal, comment tweaking. Spelling fixes, etc.
darcs-hash:20070225111738-ac50b-9656f807d2e41ebb06a43e10925834420740e20d.gz
This commit is contained in:
parent
7c96cb2ff8
commit
83a3706099
5 changed files with 47 additions and 44 deletions
23
complete.c
23
complete.c
|
@ -202,29 +202,6 @@ void completion_allocate( array_list_t *context,
|
|||
al_push( context, res );
|
||||
}
|
||||
|
||||
void completion_allocate2( array_list_t *context,
|
||||
wchar_t *comp,
|
||||
wchar_t sep )
|
||||
{
|
||||
completion_t *res = halloc( context, sizeof( completion_t) );
|
||||
wchar_t *sep_pos = wcschr( comp, sep );
|
||||
int flags = 0;
|
||||
|
||||
if( sep_pos )
|
||||
{
|
||||
*sep_pos = 0;
|
||||
res->description = halloc_wcsdup( context, sep_pos+1 );
|
||||
}
|
||||
|
||||
res->completion = halloc_wcsdup( context, comp );
|
||||
|
||||
if( ( wcslen(comp) > 0 ) && ( wcschr( L"/=@:", comp[wcslen(comp)-1] ) != 0 ) )
|
||||
flags |= COMPLETE_NO_SPACE;
|
||||
res->flags = flags;
|
||||
al_push( context, res );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Destroys various structures used for tab-completion and free()s the memory used by them.
|
||||
*/
|
||||
|
|
11
complete.h
11
complete.h
|
@ -247,15 +247,4 @@ void completion_allocate( array_list_t *context,
|
|||
int flags );
|
||||
|
||||
|
||||
/**
|
||||
Create a new completion entry from an existing text entry
|
||||
|
||||
\param context The halloc context to use for allocating new memory
|
||||
\param comp the completion and possibly the description for it
|
||||
\param sep the separator character between completion and description
|
||||
*/
|
||||
void completion_allocate2( array_list_t *context,
|
||||
wchar_t *comp,
|
||||
wchar_t sep );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -246,7 +246,7 @@ AC_CACHE_VAL(
|
|||
)
|
||||
|
||||
#
|
||||
# Try to enale large file support. This will make sure that on systems
|
||||
# Try to enable large file support. This will make sure that on systems
|
||||
# where off_t can be either 32 or 64 bit, the latter size is used. On
|
||||
# other systems, this should do nothing. (Hopefully)
|
||||
#
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
|
||||
|
||||
- \c CMD is the new value of the commandline. If unspecified, the
|
||||
current value of the commandline is written to standard output.
|
||||
current value of the commandline is written to standard output. All
|
||||
output from the commandline builtin is escaped, i.e. quotes are
|
||||
removed, backslash escapes are expanded, etc..
|
||||
|
||||
The following switches change what the commandline builtin does
|
||||
|
||||
|
|
51
wildcard.c
51
wildcard.c
|
@ -511,9 +511,27 @@ static const wchar_t *file_get_desc( const wchar_t *filename,
|
|||
{
|
||||
return COMPLETE_DIRECTORY_SYMLINK_DESC;
|
||||
}
|
||||
else if( waccess( filename, X_OK ) == 0 )
|
||||
else
|
||||
{
|
||||
return COMPLETE_EXEC_LINK_DESC;
|
||||
|
||||
if( ( buf.st_mode & S_IXUSR ) ||
|
||||
( buf.st_mode & S_IXGRP ) ||
|
||||
( buf.st_mode & S_IXOTH ) )
|
||||
{
|
||||
|
||||
if( waccess( filename, X_OK ) == 0 )
|
||||
{
|
||||
/*
|
||||
Weird group permissions and other such
|
||||
issues make it non-trivial to find out
|
||||
if we can actually execute a file using
|
||||
the result from stat. It is much safer
|
||||
to use the access function, since it
|
||||
tells us exactly what we want to know.
|
||||
*/
|
||||
return COMPLETE_EXEC_LINK_DESC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return COMPLETE_SYMLINK_DESC;
|
||||
|
@ -560,9 +578,26 @@ static const wchar_t *file_get_desc( const wchar_t *filename,
|
|||
{
|
||||
return COMPLETE_DIRECTORY_DESC;
|
||||
}
|
||||
else if( waccess( filename, X_OK ) == 0 )
|
||||
else
|
||||
{
|
||||
return COMPLETE_EXEC_DESC;
|
||||
if( ( buf.st_mode & S_IXUSR ) ||
|
||||
( buf.st_mode & S_IXGRP ) ||
|
||||
( buf.st_mode & S_IXOTH ) )
|
||||
{
|
||||
|
||||
if( waccess( filename, X_OK ) == 0 )
|
||||
{
|
||||
/*
|
||||
Weird group permissions and other such issues
|
||||
make it non-trivial to find out if we can
|
||||
actually execute a file using the result from
|
||||
stat. It is much safer to use the access
|
||||
function, since it tells us exactly what we want
|
||||
to know.
|
||||
*/
|
||||
return COMPLETE_EXEC_DESC;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -590,9 +625,9 @@ static const wchar_t *file_get_desc( const wchar_t *filename,
|
|||
\param is_cmd whether we are performing command completion
|
||||
*/
|
||||
static void wildcard_completion_allocate( array_list_t *list,
|
||||
wchar_t *fullname,
|
||||
wchar_t *completion,
|
||||
wchar_t *wc,
|
||||
const wchar_t *fullname,
|
||||
const wchar_t *completion,
|
||||
const wchar_t *wc,
|
||||
int is_cmd )
|
||||
{
|
||||
const wchar_t *desc;
|
||||
|
@ -717,7 +752,7 @@ static void wildcard_completion_allocate( array_list_t *list,
|
|||
wildcard_complete( completion, wc, (wchar_t *)sb->buff, 0, list, flags );
|
||||
|
||||
if( free_completion )
|
||||
free( completion );
|
||||
free( (void *)completion );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue