diff options
author | Yoav <gergesh@gmail.com> | 2018-12-31 01:35:00 +0200 |
---|---|---|
committer | Quentin Glidic <sardemff7+github@sardemff7.net> | 2018-12-31 00:35:00 +0100 |
commit | 238648b5b2267724e2cf7d0c238fca9d983b0c6a (patch) | |
tree | 27359ce471e3905e4714049a53d42a1449589a81 /source/history.c | |
parent | aacb570850dced80b3490f85037e7a9beaabdc4f (diff) |
Add history ignore (#846)
Diffstat (limited to 'source/history.c')
-rw-r--r-- | source/history.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/history.c b/source/history.c index 64f73205..c17fe040 100644 --- a/source/history.c +++ b/source/history.c @@ -180,6 +180,20 @@ void history_set ( const char *filename, const char *entry ) if ( config.disable_history ) { return; } + + // Check if program should be ignored + for ( char *checked_prefix = strtok ( config.ignored_prefixes, ";" ); checked_prefix != NULL; checked_prefix = strtok ( NULL, ";" ) ) { + // For each ignored prefix + + while ( g_unichar_isspace ( g_utf8_get_char ( checked_prefix ) ) ) { + checked_prefix = g_utf8_next_char ( checked_prefix ); // Some users will probably want "; " as their separator for aesthetics. + } + + if ( g_str_has_prefix ( entry, checked_prefix ) ) { + return; + } + } + int found = 0; unsigned int curr = 0; unsigned int length = 0; |