Skip to content
Snippets Groups Projects
Commit 79d53ca6 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

kjournalprint: color output cleanup

parent 520fadb7
No related branches found
No related tags found
No related merge requests found
Pipeline #55985 failed
......@@ -695,12 +695,12 @@ int changeset_walk(const changeset_t *changeset, changeset_walk_callback callbac
void changeset_print(const changeset_t *changeset, FILE *outfile, bool color)
{
const char * RED = "\x1B[31m", * GRN = "\x1B[32m", * RESET = "\x1B[0m";
const char *RED = "\x1B[31m", *GRN = "\x1B[32m", *RESET = "\x1B[0m";
size_t buflen = 1024;
char *buff = malloc(buflen);
if (changeset->soa_from != NULL || !zone_contents_is_empty(changeset->remove)) {
fprintf(outfile, "%s;;Removed\n", color ? RED : "");
fprintf(outfile, "%s;; Removed\n", color ? RED : "");
}
if (changeset->soa_from != NULL && buff != NULL) {
(void)knot_rrset_txt_dump(changeset->soa_from, &buff, &buflen, &KNOT_DUMP_STYLE_DEFAULT);
......@@ -709,7 +709,7 @@ void changeset_print(const changeset_t *changeset, FILE *outfile, bool color)
(void)zone_dump_text(changeset->remove, outfile, false);
if (changeset->soa_to != NULL || !zone_contents_is_empty(changeset->add)) {
fprintf(outfile, "%s;;Added\n", color ? GRN : "");
fprintf(outfile, "%s;; Added\n", color ? GRN : "");
}
if (changeset->soa_to != NULL && buff != NULL) {
(void)knot_rrset_txt_dump(changeset->soa_to, &buff, &buflen, &KNOT_DUMP_STYLE_DEFAULT);
......
......@@ -31,11 +31,6 @@
#define PROGRAM_NAME "kjournalprint"
#define RED "\x1B[31m"
#define GRN "\x1B[32m"
#define YLW "\x1B[93m"
#define RESET "\x1B[0m"
static void print_help(void)
{
printf("Usage: %s [parameter] <journal_db> <zone_name>\n"
......@@ -62,7 +57,9 @@ typedef struct {
static void print_changeset(const changeset_t *chs, print_params_t *params)
{
printf(params->color ? YLW : "");
const char *YLW = "\x1B[93m";
printf("%s", params->color ? YLW : "");
if (chs->soa_from == NULL) {
printf(";; Zone-in-journal, serial: %u\n",
knot_soa_serial(chs->soa_to->rrs.rdata));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment