summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bfs.h24
-rw-r--r--eval.c16
-rw-r--r--parse.c48
3 files changed, 44 insertions, 44 deletions
diff --git a/bfs.h b/bfs.h
index a6c7264..1ebbf0d 100644
--- a/bfs.h
+++ b/bfs.h
@@ -52,7 +52,7 @@ typedef bool eval_fn(const struct expr *expr, struct eval_state *state);
/**
* Various debugging flags.
*/
-enum debugflags {
+enum debug_flags {
/** Print optimization details. */
DEBUG_OPT = 1 << 0,
/** Trace all stat() calls. */
@@ -88,7 +88,7 @@ struct cmdline {
/** Optimization level. */
int optlevel;
/** Debugging flags. */
- enum debugflags debug;
+ enum debug_flags debug;
/** The command line expression. */
struct expr *expr;
@@ -100,7 +100,7 @@ struct cmdline {
/**
* Possible types of numeric comparison.
*/
-enum cmpflag {
+enum cmp_flag {
/** Exactly n. */
CMP_EXACT,
/** Less than n. */
@@ -112,7 +112,7 @@ enum cmpflag {
/**
* Available struct stat time fields.
*/
-enum timefield {
+enum time_field {
/** Access time. */
ATIME,
/** Status change time. */
@@ -124,7 +124,7 @@ enum timefield {
/**
* Possible time units.
*/
-enum timeunit {
+enum time_unit {
/** Minutes. */
MINUTES,
/** Days. */
@@ -134,7 +134,7 @@ enum timeunit {
/**
* Possible file size units.
*/
-enum sizeunit {
+enum size_unit {
/** 512-byte blocks. */
SIZE_BLOCKS,
/** Single bytes. */
@@ -152,7 +152,7 @@ enum sizeunit {
/**
* Flags for the -exec actions.
*/
-enum execflags {
+enum exec_flags {
/** Prompt the user before executing (-ok, -okdir). */
EXEC_CONFIRM = 1 << 0,
/** Run the command in the file's parent directory (-execdir, -okdir). */
@@ -179,17 +179,17 @@ struct expr {
char **argv;
/** The optional comparison flag. */
- enum cmpflag cmpflag;
+ enum cmp_flag cmp_flag;
/** The optional reference time. */
struct timespec reftime;
/** The optional time field. */
- enum timefield timefield;
+ enum time_field time_field;
/** The optional time unit. */
- enum timeunit timeunit;
+ enum time_unit time_unit;
/** The optional size unit. */
- enum sizeunit sizeunit;
+ enum size_unit size_unit;
/** Optional device number for a target file. */
dev_t dev;
@@ -200,7 +200,7 @@ struct expr {
FILE *file;
/** Optional -exec flags. */
- enum execflags execflags;
+ enum exec_flags exec_flags;
/** Optional integer data for this expression. */
long long idata;
diff --git a/eval.c b/eval.c
index 44b1fa4..f7292a2 100644
--- a/eval.c
+++ b/eval.c
@@ -78,7 +78,7 @@ static time_t timespec_diff(const struct timespec *lhs, const struct timespec *r
* Perform a comparison.
*/
static bool do_cmp(const struct expr *expr, long long n) {
- switch (expr->cmpflag) {
+ switch (expr->cmp_flag) {
case CMP_EXACT:
return n == expr->idata;
case CMP_LESS:
@@ -122,7 +122,7 @@ bool eval_acmtime(const struct expr *expr, struct eval_state *state) {
}
const struct timespec *time = NULL;
- switch (expr->timefield) {
+ switch (expr->time_field) {
case ATIME:
time = &statbuf->st_atim;
break;
@@ -136,7 +136,7 @@ bool eval_acmtime(const struct expr *expr, struct eval_state *state) {
assert(time);
time_t diff = timespec_diff(&expr->reftime, time);
- switch (expr->timeunit) {
+ switch (expr->time_unit) {
case MINUTES:
diff /= 60;
break;
@@ -158,7 +158,7 @@ bool eval_acnewer(const struct expr *expr, struct eval_state *state) {
}
const struct timespec *time = NULL;
- switch (expr->timefield) {
+ switch (expr->time_field) {
case ATIME:
time = &statbuf->st_atim;
break;
@@ -233,7 +233,7 @@ bool eval_delete(const struct expr *expr, struct eval_state *state) {
}
static const char *exec_format_path(const struct expr *expr, const struct BFTW *ftwbuf) {
- if (!(expr->execflags & EXEC_CHDIR)) {
+ if (!(expr->exec_flags & EXEC_CHDIR)) {
return ftwbuf->path;
}
@@ -389,7 +389,7 @@ bool eval_exec(const struct expr *expr, struct eval_state *state) {
goto out_path;
}
- if (expr->execflags & EXEC_CONFIRM) {
+ if (expr->exec_flags & EXEC_CONFIRM) {
for (size_t i = 0; i < argc; ++i) {
fprintf(stderr, "%s ", argv[i]);
}
@@ -420,7 +420,7 @@ bool eval_exec(const struct expr *expr, struct eval_state *state) {
ret = WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS;
} else {
- if (expr->execflags & EXEC_CHDIR) {
+ if (expr->exec_flags & EXEC_CHDIR) {
exec_chdir(ftwbuf);
}
@@ -682,7 +682,7 @@ bool eval_size(const struct expr *expr, struct eval_state *state) {
[SIZE_GB] = 1024*1024*1024,
};
- off_t scale = scales[expr->sizeunit];
+ off_t scale = scales[expr->size_unit];
off_t size = (statbuf->st_size + scale - 1)/scale; // Round up
return do_cmp(expr, size);
}
diff --git a/parse.c b/parse.c
index c24592c..a448289 100644
--- a/parse.c
+++ b/parse.c
@@ -328,7 +328,7 @@ static const char *skip_paths(struct parser_state *state) {
}
/** Integer parsing flags. */
-enum intflags {
+enum int_flags {
IF_INT = 0,
IF_LONG = 1,
IF_LONG_LONG = 2,
@@ -340,7 +340,7 @@ enum intflags {
/**
* Parse an integer.
*/
-static const char *parse_int(const struct parser_state *state, const char *str, void *result, enum intflags flags) {
+static const char *parse_int(const struct parser_state *state, const char *str, void *result, enum int_flags flags) {
char *endptr;
errno = 0;
@@ -392,18 +392,18 @@ bad:
/**
* Parse an integer and a comparison flag.
*/
-static const char *parse_icmp(const struct parser_state *state, const char *str, struct expr *expr, enum intflags flags) {
+static const char *parse_icmp(const struct parser_state *state, const char *str, struct expr *expr, enum int_flags flags) {
switch (str[0]) {
case '-':
- expr->cmpflag = CMP_LESS;
+ expr->cmp_flag = CMP_LESS;
++str;
break;
case '+':
- expr->cmpflag = CMP_GREATER;
+ expr->cmp_flag = CMP_GREATER;
++str;
break;
default:
- expr->cmpflag = CMP_EXACT;
+ expr->cmp_flag = CMP_EXACT;
break;
}
@@ -640,12 +640,12 @@ static struct expr *parse_access(struct parser_state *state, int flag) {
/**
* Parse -[acm]{min,time}.
*/
-static struct expr *parse_acmtime(struct parser_state *state, enum timefield field, enum timeunit unit) {
+static struct expr *parse_acmtime(struct parser_state *state, enum time_field field, enum time_unit unit) {
struct expr *expr = parse_test_icmp(state, eval_acmtime);
if (expr) {
expr->reftime = state->now;
- expr->timefield = field;
- expr->timeunit = unit;
+ expr->time_field = field;
+ expr->time_unit = unit;
}
return expr;
}
@@ -653,7 +653,7 @@ static struct expr *parse_acmtime(struct parser_state *state, enum timefield fie
/**
* Parse -[ac]?newer.
*/
-static struct expr *parse_acnewer(struct parser_state *state, enum timefield field) {
+static struct expr *parse_acnewer(struct parser_state *state, enum time_field field) {
struct expr *expr = parse_unary_test(state, eval_acnewer);
if (!expr) {
return NULL;
@@ -665,7 +665,7 @@ static struct expr *parse_acnewer(struct parser_state *state, enum timefield fie
}
expr->reftime = sb.st_mtim;
- expr->timefield = field;
+ expr->time_field = field;
return expr;
}
@@ -724,7 +724,7 @@ static struct expr *parse_depth(struct parser_state *state, int *depth) {
/**
* Parse -exec[dir]/-ok[dir].
*/
-static struct expr *parse_exec(struct parser_state *state, enum execflags flags) {
+static struct expr *parse_exec(struct parser_state *state, enum exec_flags flags) {
size_t i = 1;
const char *arg;
while ((arg = state->argv[i++])) {
@@ -750,7 +750,7 @@ static struct expr *parse_exec(struct parser_state *state, enum execflags flags)
struct expr *expr = parse_action(state, eval_exec, i);
if (expr) {
- expr->execflags = flags;
+ expr->exec_flags = flags;
}
return expr;
}
@@ -837,7 +837,7 @@ static struct expr *parse_group(struct parser_state *state) {
goto error;
}
- expr->cmpflag = CMP_EXACT;
+ expr->cmp_flag = CMP_EXACT;
return expr;
error:
@@ -878,7 +878,7 @@ static struct expr *parse_user(struct parser_state *state) {
goto error;
}
- expr->cmpflag = CMP_EXACT;
+ expr->cmp_flag = CMP_EXACT;
return expr;
error:
@@ -953,13 +953,13 @@ static struct expr *parse_newerxy(struct parser_state *state) {
switch (arg[6]) {
case 'a':
- expr->timefield = ATIME;
+ expr->time_field = ATIME;
break;
case 'c':
- expr->timefield = CTIME;
+ expr->time_field = CTIME;
break;
case 'm':
- expr->timefield = MTIME;
+ expr->time_field = MTIME;
break;
case 'B':
@@ -1068,22 +1068,22 @@ static struct expr *parse_size(struct parser_state *state) {
switch (*unit) {
case '\0':
case 'b':
- expr->sizeunit = SIZE_BLOCKS;
+ expr->size_unit = SIZE_BLOCKS;
break;
case 'c':
- expr->sizeunit = SIZE_BYTES;
+ expr->size_unit = SIZE_BYTES;
break;
case 'w':
- expr->sizeunit = SIZE_WORDS;
+ expr->size_unit = SIZE_WORDS;
break;
case 'k':
- expr->sizeunit = SIZE_KB;
+ expr->size_unit = SIZE_KB;
break;
case 'M':
- expr->sizeunit = SIZE_MB;
+ expr->size_unit = SIZE_MB;
break;
case 'G':
- expr->sizeunit = SIZE_GB;
+ expr->size_unit = SIZE_GB;
break;
default: