From: Francois Fleuret Date: Fri, 13 Mar 2015 07:15:42 +0000 (+0100) Subject: OCD cosmetics. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=247055c60e22d0347e5c46259163a9c7fdab5dee;p=selector.git OCD cosmetics. --- diff --git a/selector.c b/selector.c index 94cd99e..ac80d93 100644 --- a/selector.c +++ b/selector.c @@ -3,7 +3,7 @@ * selector is a simple command line utility for selection of strings * with a dynamic pattern-matching. * - * Copyright (c) 2009-2013 Francois Fleuret + * Copyright (c) 2009-2015 Francois Fleuret * Written by Francois Fleuret * * This file is part of selector. @@ -111,21 +111,21 @@ void inject_into_tty_buffer(char *string, int add_control_qs) { /*********************************************************************/ void str_to_positive_integers(char *string, int *values, int nb) { - int current_value, gotone; + int current_value, got_one; char *s; int n; n = 0; current_value = 0; - gotone = 0; + got_one = 0; s = string; while(1) { if(*s >= '0' && *s <= '9') { current_value = current_value * 10 + (int) (*s - '0'); - gotone = 1; + got_one = 1; } else if(*s == ',' || *s == '\0') { - if(gotone) { + if(got_one) { if(n < nb) { values[n++] = current_value; if(*s == '\0') { @@ -138,7 +138,7 @@ void str_to_positive_integers(char *string, int *values, int nb) { } } current_value = 0; - gotone = 0; + got_one = 0; } else { fprintf(stderr, "selector: Too many values in `%s'.\n", string); @@ -960,8 +960,7 @@ void read_file(struct hash_table_t *hash_table, /* For long options that have no equivalent short option, use a non-character as a pseudo short option, starting with CHAR_MAX + 1. */ -enum -{ +enum { OPT_BASH_MODE = CHAR_MAX + 1 }; @@ -1010,14 +1009,14 @@ int main(int argc, char **argv) { struct hash_table_t *hash_table; char *bash_histsize; - /* Group and others have no access to created files */ - umask(S_IRWXG | S_IRWXO); - if(!isatty(STDIN_FILENO)) { fprintf(stderr, "selector: The standard input is not a tty.\n"); exit(EXIT_FAILURE); } + /* Group and others have no access to created files */ + umask(S_IRWXG | S_IRWXO); + pattern[0] = '\0'; color_fg_modeline = COLOR_WHITE;