aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2007-02-25 21:17:38 +1000
committerGravatar axel <axel@liljencrantz.se>2007-02-25 21:17:38 +1000
commit83a3706099bd6c5b7c9840e5049b012f5e8bcc5d (patch)
tree67fe1ee3d08cd8acadc23b9c903cd9e079c11705
parent7c96cb2ff869ca3c5b3df9176e649a8acefc8062 (diff)
Various minor codee updates. Dead code removal, comment tweaking. Spelling fixes, etc.
darcs-hash:20070225111738-ac50b-9656f807d2e41ebb06a43e10925834420740e20d.gz
-rw-r--r--complete.c23
-rw-r--r--complete.h11
-rw-r--r--configure.ac2
-rw-r--r--doc_src/commandline.txt4
-rw-r--r--wildcard.c51
5 files changed, 47 insertions, 44 deletions
diff --git a/complete.c b/complete.c
index cc842d06..e491facf 100644
--- a/complete.c
+++ b/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.
*/
diff --git a/complete.h b/complete.h
index 57a0e3d3..56e66884 100644
--- a/complete.h
+++ b/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
diff --git a/configure.ac b/configure.ac
index 7e1a8cdf..917a28ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
#
diff --git a/doc_src/commandline.txt b/doc_src/commandline.txt
index 6fc7dea9..0202bbb3 100644
--- a/doc_src/commandline.txt
+++ b/doc_src/commandline.txt
@@ -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
diff --git a/wildcard.c b/wildcard.c
index d80d47e3..85185b11 100644
--- a/wildcard.c
+++ b/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 );
}
/**