aboutsummaryrefslogtreecommitdiffhomepage
path: root/function.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-01-14 11:58:01 +1000
committerGravatar axel <axel@liljencrantz.se>2006-01-14 11:58:01 +1000
commit1562b8148d344a94335032e0e5d6402c9a2dd7e3 (patch)
tree7d994c94ff9dae679b704a3174d4a5533ba50352 /function.c
parentd7b659d8e8365229cd357711bdc44b860e3f9163 (diff)
Make sure functions as printed by the fyunctions builtin don't have any stray empty lines
darcs-hash:20060114015801-ac50b-135fb66cf74a9cd51f6d52e2eff12c55042e4183.gz
Diffstat (limited to 'function.c')
-rw-r--r--function.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/function.c b/function.c
index c57760e4..9c10523c 100644
--- a/function.c
+++ b/function.c
@@ -68,12 +68,20 @@ void function_add( const wchar_t *name,
int is_binding )
{
int i;
+ wchar_t *cmd_end;
+
if( function_exists( name ) )
function_remove( name );
function_data_t *d = malloc( sizeof( function_data_t ) );
d->cmd = wcsdup( val );
+ cmd_end = d->cmd + wcslen(d->cmd)-1;
+ while( (cmd_end>d->cmd) && wcschr( L"\n\r\t ", *cmd_end ) )
+ {
+ *cmd_end--=0;
+ }
+
d->desc = desc?wcsdup( desc ):0;
d->is_binding = is_binding;
hash_put( &function, intern(name), d );