From 2839f5e567e21a15850c3adfa2cc3cd1d7372ea9 Mon Sep 17 00:00:00 2001 From: axel Date: Mon, 2 Oct 2006 01:59:18 +1000 Subject: [PATCH] Minor comment and documentation edits darcs-hash:20061001155918-ac50b-8b5b4f5dbd8334bac1c0dc77fa18c8f3cfb4a878.gz --- doc_src/doc.hdr | 3 ++- env.c | 10 ++++------ output.h | 2 +- reader.c | 3 ++- signal.c | 2 +- tokenizer.c | 10 +++++----- util.c | 2 +- util.h | 15 ++++++++++++--- 8 files changed, 28 insertions(+), 19 deletions(-) diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr index 773690687..c74e94f8a 100644 --- a/doc_src/doc.hdr +++ b/doc_src/doc.hdr @@ -1298,7 +1298,8 @@ g++, javac, java, gcj, lpr, doxygen, whois, find) - Suspending and then resuming pipelines containing a builtin is broken. How should this be handled? - line wrapping issues on xterm - The search token is invisible on long commandlines -- Remove --indicator-style=classify from ls function (or use something to detect whether the function is used interactively or not) +- xdg stuff expects posix functionality, e.g. strdup +- Reading long history file takes way too much time If you think you have found a bug not described here, please send a report to axel@liljencrantz.se diff --git a/env.c b/env.c index 8a7d2459e..ce9b1fc1c 100644 --- a/env.c +++ b/env.c @@ -693,7 +693,7 @@ int env_set( const wchar_t *key, env_universal_set( key, val, export ); is_universal = 1; - + } else { @@ -721,6 +721,7 @@ int env_set( const wchar_t *key, (var_mode & ENV_GLOBAL) ) { node = ( var_mode & ENV_GLOBAL )?global_env:top; + } else { @@ -946,7 +947,7 @@ wchar_t *env_get( const wchar_t *key ) wchar_t *item; CHECK( key, 0 ); - + if( wcscmp( key, L"history" ) == 0 ) { wchar_t *current; @@ -966,10 +967,6 @@ wchar_t *env_get( const wchar_t *key ) wchar_t *next = history_get( i-add_current ); if( !next ) { - /* - This is not an error - it simply means the user has - a short history - */ break; } @@ -977,6 +974,7 @@ wchar_t *env_get( const wchar_t *key ) sb_append( &dyn_var, ARRAY_SEP_STR ); sb_append( &dyn_var, next ); } + return (wchar_t *)dyn_var.buff; } else if( wcscmp( key, L"COLUMNS" )==0 ) diff --git a/output.h b/output.h index 8669da7e7..8a663cd60 100644 --- a/output.h +++ b/output.h @@ -82,7 +82,7 @@ void set_color( int c, int c2 ); int writembs( char *str ); /** - Write a wide character to fd 1. + Write a wide character using the output method specified using output_set_writer(). */ int writech( wint_t ch ); diff --git a/reader.c b/reader.c index 8456ec07d..f3bca3343 100644 --- a/reader.c +++ b/reader.c @@ -135,7 +135,7 @@ commence. typedef struct reader_data { /** - Buffer containing the current commandline + Buffer containing the whole current commandline */ wchar_t *buff; @@ -153,6 +153,7 @@ typedef struct reader_data Buffer containing the current search item */ wchar_t *search_buff; + /** Saved position used by token history search */ diff --git a/signal.c b/signal.c index 46cc3858c..18fc3eec2 100644 --- a/signal.c +++ b/signal.c @@ -543,7 +543,7 @@ void signal_set_handlers() Interactive mode. Ignore interactive signals. We are a shell, we know whats best for the user. ;-) */ - + act.sa_handler=SIG_IGN; sigaction( SIGINT, &act, 0); diff --git a/tokenizer.c b/tokenizer.c index d2b18e2ce..9be49c72e 100644 --- a/tokenizer.c +++ b/tokenizer.c @@ -1,9 +1,9 @@ /** \file tokenizer.c - A specialized tokenizer for tokenizing the fish language. In the - future, the tokenizer should be extended to support marks, - tokenizing multiple strings and disposing of unused string - segments. +A specialized tokenizer for tokenizing the fish language. In the +future, the tokenizer should be extended to support marks, +tokenizing multiple strings and disposing of unused string +segments. */ #include "config.h" @@ -46,7 +46,7 @@ #define PIPE_ERROR _( L"Can not use fd 0 as pipe output" ) /** - Characters that separate tokens. They are ordered by frequency of occurrence to increase parsing speed. + Characters that separate tokens. They are ordered by frequency of occurrence to increase parsing speed. */ #define SEP L" \n|\t;#\r<>^&" diff --git a/util.c b/util.c index b9f188880..7c938bf32 100644 --- a/util.c +++ b/util.c @@ -21,7 +21,7 @@ #include #include #include - +#include #include "fallback.h" #include "util.h" diff --git a/util.h b/util.h index 9423e0c45..01cb8b910 100644 --- a/util.h +++ b/util.h @@ -109,7 +109,9 @@ priority_queue_t; */ typedef struct array_list { - /** Array containing the data */ + /** + Array containing the data + */ anything_t *arr; /** Position to append elements at*/ int pos; @@ -517,8 +519,8 @@ void al_foreach( array_list_t *l, void (*func)( void * )); void al_foreach2( array_list_t *l, void (*func)( void *, void *), void *aux); /** - Compares two wide character strings without case but with - a logical ordering for numbers. + Compares two wide character strings with an (arguably) intuitive + ordering. This function tries to order strings in a way which is intuitive to humans with regards to sorting strings containing numbers. @@ -542,6 +544,13 @@ void al_foreach2( array_list_t *l, void (*func)( void *, void *), void *aux); This won't return the optimum results for numbers in bases higher than ten, such as hexadecimal, but at least a stable sort order will result. + + This function performs a two-tiered sort, where difference in case + and in number of leading zeroes in numbers only have effect if no + other differences between strings are found. This way, a 'file1' + and 'File1' will not be considered identical, and hence their + internal sort order is not arbitrary, but the names 'file1', + 'File2' and 'file3' will still be sorted in the order given above. */ int wcsfilecmp( const wchar_t *a, const wchar_t *b );