summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-04-04 14:56:22 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-04-15 14:45:08 -0400
commita571aa9ef6f3dc2099ee33c5040f8c54776ddece (patch)
treeb38b6656e4fcd225559d0c950fcbae4ff3165372
parent44a2912b831f1c3f75fee82273e235ff78b5cb93 (diff)
downloadbfs-a571aa9ef6f3dc2099ee33c5040f8c54776ddece.tar.xz
color: Use three-letter codes for warnings and errors
No reason to potentially conflict with the two-letter codes GNU ls uses.
-rw-r--r--color.c4
-rw-r--r--diag.c8
-rw-r--r--parse.c10
3 files changed, 11 insertions, 11 deletions
diff --git a/color.c b/color.c
index ec4c178..d59875c 100644
--- a/color.c
+++ b/color.c
@@ -387,8 +387,8 @@ struct colors *parse_colors(const char *ls_colors) {
ret |= init_color(colors, "cyn", "01;36", &colors->cyan);
ret |= init_color(colors, "wht", "01;37", &colors->white);
- ret |= init_color(colors, "wr", "01;33", &colors->warning);
- ret |= init_color(colors, "er", "01;31", &colors->error);
+ ret |= init_color(colors, "wrn", "01;33", &colors->warning);
+ ret |= init_color(colors, "err", "01;31", &colors->error);
// Defaults from man dir_colors
diff --git a/diag.c b/diag.c
index e8333f1..27848f1 100644
--- a/diag.c
+++ b/diag.c
@@ -84,12 +84,12 @@ bool bfs_vdebug(const struct bfs_ctx *ctx, enum debug_flags flag, const char *fo
}
void bfs_error_prefix(const struct bfs_ctx *ctx) {
- cfprintf(ctx->cerr, "${bld}%s:${rs} ${er}error:${rs} ", xbasename(ctx->argv[0]));
+ cfprintf(ctx->cerr, "${bld}%s:${rs} ${err}error:${rs} ", xbasename(ctx->argv[0]));
}
bool bfs_warning_prefix(const struct bfs_ctx *ctx) {
if (ctx->warn) {
- cfprintf(ctx->cerr, "${bld}%s:${rs} ${wr}warning:${rs} ", xbasename(ctx->argv[0]));
+ cfprintf(ctx->cerr, "${bld}%s:${rs} ${wrn}warning:${rs} ", xbasename(ctx->argv[0]));
return true;
} else {
return false;
@@ -180,9 +180,9 @@ static void bfs_argv_diag(const struct bfs_ctx *ctx, const bool *args, bool warn
if (args[i] && (i == 0 || !args[i - 1])) {
if (warning) {
- cfprintf(ctx->cerr, "${wr}");
+ cfprintf(ctx->cerr, "${wrn}");
} else {
- cfprintf(ctx->cerr, "${er}");
+ cfprintf(ctx->cerr, "${err}");
}
}
diff --git a/parse.c b/parse.c
index ecf1387..17aeafe 100644
--- a/parse.c
+++ b/parse.c
@@ -1941,7 +1941,7 @@ static struct bfs_expr *parse_newerxy(struct parser_state *state, int arg1, int
expr->stat_field = parse_newerxy_field(arg[6]);
if (!expr->stat_field) {
parse_expr_error(state, expr,
- "For ${blu}-newer${bld}XY${rs}, ${bld}X${rs} should be ${bld}a${rs}, ${bld}c${rs}, ${bld}m${rs}, or ${bld}B${rs}, not ${er}%c${rs}.\n",
+ "For ${blu}-newer${bld}XY${rs}, ${bld}X${rs} should be ${bld}a${rs}, ${bld}c${rs}, ${bld}m${rs}, or ${bld}B${rs}, not ${err}%c${rs}.\n",
arg[6]);
goto fail;
}
@@ -1954,7 +1954,7 @@ static struct bfs_expr *parse_newerxy(struct parser_state *state, int arg1, int
enum bfs_stat_field field = parse_newerxy_field(arg[7]);
if (!field) {
parse_expr_error(state, expr,
- "For ${blu}-newer${bld}XY${rs}, ${bld}Y${rs} should be ${bld}a${rs}, ${bld}c${rs}, ${bld}m${rs}, ${bld}B${rs}, or ${bld}t${rs}, not ${er}%c${rs}.\n",
+ "For ${blu}-newer${bld}XY${rs}, ${bld}Y${rs} should be ${bld}a${rs}, ${bld}c${rs}, ${bld}m${rs}, ${bld}B${rs}, or ${bld}t${rs}, not ${err}%c${rs}.\n",
arg[7]);
goto fail;
}
@@ -2636,7 +2636,7 @@ static struct bfs_expr *parse_size(struct parser_state *state, int arg1, int arg
return expr;
bad_unit:
- parse_expr_error(state, expr, "Expected a size unit (one of ${bld}cwbkMGTP${rs}); found ${er}%s${rs}.\n", unit);
+ parse_expr_error(state, expr, "Expected a size unit (one of ${bld}cwbkMGTP${rs}); found ${err}%s${rs}.\n", unit);
fail:
bfs_expr_free(expr);
return NULL;
@@ -2722,7 +2722,7 @@ static struct bfs_expr *parse_type(struct parser_state *state, int x, int arg2)
goto fail;
default:
- parse_expr_error(state, expr, "Unknown type flag ${er}%c${rs}; expected one of [${bld}bcdpflsD${rs}].\n", *c);
+ parse_expr_error(state, expr, "Unknown type flag ${err}%c${rs}; expected one of [${bld}bcdpflsD${rs}].\n", *c);
goto fail;
}
@@ -3455,7 +3455,7 @@ static struct bfs_expr *parse_factor(struct parser_state *state) {
return expr;
} else if (strcmp(arg, "-exclude") == 0) {
if (state->excluding) {
- parse_error(state, "${er}%s${rs} is not supported within ${red}-exclude${rs}.\n", arg);
+ parse_error(state, "${err}%s${rs} is not supported within ${red}-exclude${rs}.\n", arg);
return NULL;
}