* 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 <francois@fleuret.org>
*
* This file is part of selector.
/*********************************************************************/
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') {
}
}
current_value = 0;
- gotone = 0;
+ got_one = 0;
} else {
fprintf(stderr,
"selector: Too many values in `%s'.\n", string);
/* 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
};
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;