static void operational_state_to_color(const char *state, const char **on, const char **off) {
        assert(on);
        assert(off);

        if (streq_ptr(state, "routable")) {
                *on = ansi_highlight_green();
                *off = ansi_highlight_off();
        } else if (streq_ptr(state, "degraded")) {
                *on = ansi_highlight_yellow();
                *off = ansi_highlight_off();
        } else
                *on = *off = "";
}
static void setup_state_to_color(const char *state, const char **on, const char **off) {
        assert(on);
        assert(off);

        if (streq_ptr(state, "configured")) {
                *on = ansi_highlight_green();
                *off = ansi_highlight_off();
        } else if (streq_ptr(state, "configuring")) {
                *on = ansi_highlight_yellow();
                *off = ansi_highlight_off();
        } else if (streq_ptr(state, "failed") || streq_ptr(state, "linger")) {
                *on = ansi_highlight_red();
                *off = ansi_highlight_off();
        } else
                *on = *off = "";
}
示例#3
0
文件: delta.c 项目: ariscop/systemd
static int notify_override_extended(const char *top, const char *bottom) {
        if (!(arg_flags & SHOW_EXTENDED))
               return 0;

        printf("%s%s%s   %s → %s\n",
               ansi_highlight(), "[EXTENDED]", ansi_highlight_off(), top, bottom);
        return 1;
}
示例#4
0
文件: delta.c 项目: ariscop/systemd
static int notify_override_overridden(const char *top, const char *bottom) {
        if (!(arg_flags & SHOW_OVERRIDDEN))
                return 0;

        printf("%s%s%s %s → %s\n",
               ansi_highlight(), "[OVERRIDDEN]", ansi_highlight_off(), top, bottom);
        return 1;
}
示例#5
0
文件: delta.c 项目: ariscop/systemd
static int notify_override_redirected(const char *top, const char *bottom) {
        if (!(arg_flags & SHOW_REDIRECTED))
                return 0;

        printf("%s%s%s   %s → %s\n",
               ansi_highlight(), "[REDIRECTED]", ansi_highlight_off(), top, bottom);
        return 1;
}
示例#6
0
文件: delta.c 项目: ariscop/systemd
static int notify_override_equivalent(const char *top, const char *bottom) {
        if (!(arg_flags & SHOW_EQUIVALENT))
                return 0;

        printf("%s%s%s %s → %s\n",
               ansi_highlight_green(), "[EQUIVALENT]", ansi_highlight_off(), top, bottom);
        return 1;
}
示例#7
0
文件: delta.c 项目: ariscop/systemd
static int notify_override_masked(const char *top, const char *bottom) {
        if (!(arg_flags & SHOW_MASKED))
                return 0;

        printf("%s%s%s     %s → %s\n",
               ansi_highlight_red(), "[MASKED]", ansi_highlight_off(), top, bottom);
        return 1;
}
示例#8
0
文件: delta.c 项目: vitalikp/systemd
static int notify_override_equivalent(const char *top, const char *bottom) {
        if (!(arg_flags & SHOW_EQUIVALENT))
                return 0;

        printf("%s%s%s %s %s %s\n",
        		ansi_lightgreen(), "[EQUIVALENT]", ansi_highlight_off(),
               top, draw_special_char(DRAW_ARROW), bottom);
        return 1;
}
示例#9
0
文件: delta.c 项目: vitalikp/systemd
static int notify_override_masked(const char *top, const char *bottom) {
        if (!(arg_flags & SHOW_MASKED))
                return 0;

        printf("%s%s%s     %s %s %s\n",
               ansi_lightred(), "[MASKED]", ansi_highlight_off(),
               top, draw_special_char(DRAW_ARROW), bottom);
        return 1;
}