author | Olivier Brunel
<jjk@jjacky.com> 2018-01-19 18:18:30 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2018-01-21 19:41:52 UTC |
parent | eae7b24436a67231653c9d4a5411b2b80005163d |
src/anopa/aa-enable.c | +11 | -11 |
src/anopa/aa-reset.c | +8 | -8 |
src/anopa/aa-start.c | +6 | -6 |
src/anopa/aa-status.c | +65 | -64 |
src/anopa/aa-stop.c | +8 | -8 |
src/anopa/start-stop.c | +37 | -37 |
src/anopa/start-stop.h | +4 | -4 |
src/include/anopa/output.h | +5 | -5 |
src/libanopa/die_usage.c | +6 | -6 |
src/libanopa/die_version.c | +3 | -3 |
src/libanopa/output.c | +39 | -39 |
src/libanopa/progress.c | +14 | -14 |
src/libanopa/stats.c | +12 | -12 |
src/utils/aa-echo.c | +10 | -10 |
src/utils/aa-incmdline.c | +2 | -2 |
src/utils/aa-kill.c | +6 | -6 |
src/utils/aa-terminate.c | +5 | -5 |
src/utils/aa-tty.c | +2 | -2 |
diff --git a/src/anopa/aa-enable.c b/src/anopa/aa-enable.c index 50def90..dfd17b9 100644 --- a/src/anopa/aa-enable.c +++ b/src/anopa/aa-enable.c @@ -74,8 +74,8 @@ static void warn_cb (const char *name, int err) { aa_put_warn (cur_name, name, 0); - aa_bs_noflush (AA_ERR, ": "); - aa_bs_noflush (AA_ERR, strerror (err)); + aa_bs (AA_ERR, ": "); + aa_bs (AA_ERR, strerror (err)); aa_end_warn (); } @@ -140,8 +140,8 @@ process: aa_put_err (cur_name, errmsg[-r], r != -ERR_IO); if (r == -ERR_IO) { - aa_bs_noflush (AA_ERR, ": "); - aa_bs_noflush (AA_ERR, strerror (e)); + aa_bs (AA_ERR, ": "); + aa_bs (AA_ERR, strerror (e)); aa_end_err (); } @@ -152,8 +152,8 @@ process: if (!quiet) { - aa_bs_noflush (AA_OUT, "Enabled: "); - aa_bs_noflush (AA_OUT, cur_name); + aa_bs (AA_OUT, "Enabled: "); + aa_bs (AA_OUT, cur_name); aa_bs_flush (AA_OUT, "\n"); } @@ -161,8 +161,8 @@ process: { if (!quiet) { - aa_bs_noflush (AA_OUT, "Enabled: "); - aa_bs_noflush (AA_OUT, cur_name); + aa_bs (AA_OUT, "Enabled: "); + aa_bs (AA_OUT, cur_name); aa_bs_flush (AA_OUT, "/log\n"); } ++nb_enabled; @@ -400,8 +400,8 @@ main (int argc, char * const argv[]) int e = errno; aa_put_err (names.s + offset, errmsg[ERR_IO], 1); - aa_bs_noflush (AA_ERR, ": " "unable to check for existing servicedir" ": "); - aa_bs_noflush (AA_ERR, strerror (e)); + aa_bs (AA_ERR, ": " "unable to check for existing servicedir" ": "); + aa_bs (AA_ERR, strerror (e)); aa_end_err (); } else @@ -414,7 +414,7 @@ main (int argc, char * const argv[]) } } - aa_bs_noflush (AA_OUT, "\n"); + aa_bs (AA_OUT, "\n"); aa_put_title (1, PROG, "Completed", 1); aa_show_stat_nb (nb_enabled, "Enabled", ANSI_HIGHLIGHT_GREEN_ON); aa_show_stat_names (names.s, &ga_failed, "Failed", ANSI_HIGHLIGHT_RED_ON); diff --git a/src/anopa/aa-reset.c b/src/anopa/aa-reset.c index 0c005bc..b6993d0 100644 --- a/src/anopa/aa-reset.c +++ b/src/anopa/aa-reset.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * aa-reset.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -75,7 +75,7 @@ reset_service (const char *name, intptr_t mode) int e = errno; aa_put_err (name, "Failed to read service status file: ", 0); - aa_bs_noflush (AA_ERR, strerror (e)); + aa_bs (AA_ERR, strerror (e)); aa_end_err (); return; } @@ -115,17 +115,17 @@ reset_service (const char *name, intptr_t mode) int e = errno; aa_put_err (name, "Failed to write service status file: ", 0); - aa_bs_noflush (AA_ERR, strerror (e)); + aa_bs (AA_ERR, strerror (e)); aa_end_err (); } else { aa_put_title (1, name, "", 0); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); - aa_bs_noflush (AA_OUT, eventmsg[old_event]); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_ON); - aa_bs_noflush (AA_OUT, " -> "); - aa_bs_noflush (AA_OUT, eventmsg[event]); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_bs (AA_OUT, eventmsg[old_event]); + aa_is (AA_OUT, ANSI_HIGHLIGHT_ON); + aa_bs (AA_OUT, " -> "); + aa_bs (AA_OUT, eventmsg[event]); aa_end_title (); } } diff --git a/src/anopa/aa-start.c b/src/anopa/aa-start.c index dd90c60..d9a33a2 100644 --- a/src/anopa/aa-start.c +++ b/src/anopa/aa-start.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * aa-start.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -104,10 +104,10 @@ autoload_cb (int si, aa_al al, const char *name, int err) { int aa = (mode & AA_MODE_IS_DRY) ? AA_ERR : AA_OUT; - aa_bs_noflush (aa, "auto-add: "); - aa_bs_noflush (aa, aa_service_name (aa_service (si))); - aa_bs_noflush (aa, (al == AA_AUTOLOAD_NEEDS) ? " needs " : " wants "); - aa_bs_noflush (aa, name); + aa_bs (aa, "auto-add: "); + aa_bs (aa, aa_service_name (aa_service (si))); + aa_bs (aa, (al == AA_AUTOLOAD_NEEDS) ? " needs " : " wants "); + aa_bs (aa, name); aa_bs_flush (aa, "\n"); } @@ -356,7 +356,7 @@ main (int argc, char * const argv[]) if (!(mode & AA_MODE_IS_DRY)) { - aa_bs_noflush (AA_OUT, "\n"); + aa_bs (AA_OUT, "\n"); put_title (1, PROG, "Completed.", 1); aa_show_stat_nb (nb_already, "Already up", ANSI_HIGHLIGHT_GREEN_ON); aa_show_stat_nb (nb_done, "Started", ANSI_HIGHLIGHT_GREEN_ON); diff --git a/src/anopa/aa-status.c b/src/anopa/aa-status.c index 6366824..446f657 100644 --- a/src/anopa/aa-status.c +++ b/src/anopa/aa-status.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * aa-status.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -141,12 +141,12 @@ put_time (tain_t *st_stamp, int strict) localtmn_fmt (buf, &local); buf[19] = ' '; buf[20] = '\0'; - aa_bs_noflush (AA_OUT, buf); + aa_bs (AA_OUT, buf); return; } - aa_bb_noflush (AA_OUT, buf, localtmn_fmt (buf, &local)); - aa_bs_noflush (AA_OUT, " ("); + aa_bb (AA_OUT, buf, localtmn_fmt (buf, &local)); + aa_bs (AA_OUT, " ("); tain_sub (&stamp, &STAMP, st_stamp); if (stamp.sec.x > 86400) { @@ -154,8 +154,8 @@ put_time (tain_t *st_stamp, int strict) stamp.sec.x -= 86400 * n; buf[uint_fmt (buf, n)] = '\0'; - aa_bs_noflush (AA_OUT, buf); - aa_bs_noflush (AA_OUT, "d "); + aa_bs (AA_OUT, buf); + aa_bs (AA_OUT, "d "); } if (stamp.sec.x > 3600) { @@ -163,8 +163,8 @@ put_time (tain_t *st_stamp, int strict) stamp.sec.x -= 3600 * n; buf[uint_fmt (buf, n)] = '\0'; - aa_bs_noflush (AA_OUT, buf); - aa_bs_noflush (AA_OUT, "h "); + aa_bs (AA_OUT, buf); + aa_bs (AA_OUT, "h "); } if (stamp.sec.x > 60) { @@ -172,12 +172,12 @@ put_time (tain_t *st_stamp, int strict) stamp.sec.x -= 60 * n; buf[uint_fmt (buf, n)] = '\0'; - aa_bs_noflush (AA_OUT, buf); - aa_bs_noflush (AA_OUT, "m "); + aa_bs (AA_OUT, buf); + aa_bs (AA_OUT, "m "); } buf[uint_fmt (buf, stamp.sec.x)] = '\0'; - aa_bs_noflush (AA_OUT, buf); - aa_bs_noflush (AA_OUT, "s ago)\n"); + aa_bs (AA_OUT, buf); + aa_bs (AA_OUT, "s ago)\n"); } static struct col @@ -195,7 +195,7 @@ static inline void pad_with (ssize_t left) { for ( ; left > 0; left -= 10) - aa_bb_noflush (AA_OUT, " ", (left >= 10) ? 10 : left); + aa_bb (AA_OUT, " ", (left >= 10) ? 10 : left); } static inline void @@ -264,18 +264,18 @@ put_list_header (struct config *cfg) cols[3].len += cfg->cols - len; } - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_ON); + aa_is (AA_OUT, ANSI_HIGHLIGHT_ON); for (i = 0; i < 4; ++i) { if (i < 3 && cols[i].len == 0) continue; - aa_bs_noflush (AA_OUT, cols[i].title); + aa_bs (AA_OUT, cols[i].title); if (i < 3) pad_col (i, strlen (cols[i].title)); } - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); - aa_bs_flush (AA_OUT, "\n"); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_bs (AA_OUT, "\n"); return 1; } @@ -289,12 +289,12 @@ put_s_max (const char *s, size_t max, int pad) return 0; else if (l >= max) { - aa_bb_noflush (AA_OUT, s, max - 4); - aa_bs_noflush (AA_OUT, "... "); + aa_bb (AA_OUT, s, max - 4); + aa_bs (AA_OUT, "... "); } else { - aa_bs_noflush (AA_OUT, s); + aa_bs (AA_OUT, s); if (!pad) return l; pad_col (0, l); @@ -306,7 +306,7 @@ put_s_max (const char *s, size_t max, int pad) if (cfg->mode == MODE_LIST) \ max -= put_s_max (s, max, 0); \ else \ - aa_bs_noflush (AA_OUT, s); + aa_bs (AA_OUT, s); static void status_service (struct serv *serv, struct config *cfg) @@ -317,17 +317,17 @@ status_service (struct serv *serv, struct config *cfg) if (cfg->mode == MODE_DRY_LIST) { - aa_bs_noflush (AA_OUT, aa_service_name (s)); - aa_bs_flush (AA_OUT, "\n"); + aa_bs (AA_OUT, aa_service_name (s)); + aa_bs (AA_OUT, "\n"); return; } else if (cfg->mode == MODE_LIST) { if (first && !put_list_header (cfg)) - aa_bs_noflush (AA_OUT, "\n"); + aa_bs (AA_OUT, "\n"); } else if (!first) - aa_bs_noflush (AA_OUT, "\n"); + aa_bs (AA_OUT, "\n"); if (cfg->mode == MODE_LIST) { @@ -336,15 +336,15 @@ status_service (struct serv *serv, struct config *cfg) if (cols[1].len) { if (s->st.type == AA_TYPE_ONESHOT) - aa_bs_noflush (AA_OUT, "oneshot"); + aa_bs (AA_OUT, "oneshot"); else - aa_bs_noflush (AA_OUT, "longrun"); + aa_bs (AA_OUT, "longrun"); pad_col (1, 7); } if (!serv->is_s6 && s->st.event == AA_EVT_NONE) { - aa_bs_noflush (AA_OUT, "-"); + aa_bs (AA_OUT, "-"); pad_col (2, 1); } else @@ -352,29 +352,29 @@ status_service (struct serv *serv, struct config *cfg) } else { - aa_bs_noflush (AA_OUT, "Service: "); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_ON); - aa_bs_noflush (AA_OUT, aa_service_name (s)); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_bs (AA_OUT, "Service: "); + aa_is (AA_OUT, ANSI_HIGHLIGHT_ON); + aa_bs (AA_OUT, aa_service_name (s)); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); if (s->st.type == AA_TYPE_ONESHOT) - aa_bs_noflush (AA_OUT, " (one-shot)"); + aa_bs (AA_OUT, " (one-shot)"); else - aa_bs_noflush (AA_OUT, " (long-run)"); - aa_bs_noflush (AA_OUT, "\n"); + aa_bs (AA_OUT, " (long-run)"); + aa_bs (AA_OUT, "\n"); - aa_bs_noflush (AA_OUT, "Since: "); + aa_bs (AA_OUT, "Since: "); if (!serv->is_s6 && s->st.event == AA_EVT_NONE) - aa_bs_noflush (AA_OUT, "-\n"); + aa_bs (AA_OUT, "-\n"); else put_time (&serv->stamp, 0); if (serv->is_s6 && serv->st6.flagready) { - aa_bs_noflush (AA_OUT, "Ready: "); + aa_bs (AA_OUT, "Ready: "); put_time (&serv->st6.readystamp, 0); } - aa_bs_noflush (AA_OUT, "Status: "); + aa_bs (AA_OUT, "Status: "); } if (serv->is_s6) @@ -385,7 +385,7 @@ status_service (struct serv *serv, struct config *cfg) { char buf[UINT_FMT]; - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_GREEN_ON); + aa_is (AA_OUT, ANSI_HIGHLIGHT_GREEN_ON); put_s ("Up"); if (serv->st6.flagready) { @@ -395,7 +395,7 @@ status_service (struct serv *serv, struct config *cfg) { put_s ("; Getting ready..."); } - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); put_s (" (PID "); buf[uint_fmt (buf, serv->st6.pid)] = '\0'; put_s (buf); @@ -407,7 +407,7 @@ status_service (struct serv *serv, struct config *cfg) if (cfg->mode != MODE_LIST) { - aa_bs_noflush (AA_OUT, "\nMode: "); + aa_bs (AA_OUT, "\nMode: "); if (serv->st6.flagwant) { put_s ("Automatic restart (want up)"); @@ -420,21 +420,21 @@ status_service (struct serv *serv, struct config *cfg) } else { - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_ON); + aa_is (AA_OUT, ANSI_HIGHLIGHT_ON); put_s ("Down"); if (serv->st6.flagready) { put_s (" & Ready"); } - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); put_s (" ("); put_wstat (serv->st6.wstat, max, 0); if (serv->st6.flagwant && serv->st6.flagwantup) { put_s ("; "); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_BLUE_ON); + aa_is (AA_OUT, ANSI_HIGHLIGHT_BLUE_ON); put_s ("To be restarted"); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); } put_s (")"); @@ -446,7 +446,7 @@ status_service (struct serv *serv, struct config *cfg) */ if (cfg->mode != MODE_LIST && serv->st6.flagwant && serv->st6.flagwantup) { - aa_bs_noflush (AA_OUT, "\nMode: "); + aa_bs (AA_OUT, "\nMode: "); put_s ("Automatic restart (want up)"); } } @@ -462,9 +462,9 @@ status_service (struct serv *serv, struct config *cfg) break; case AA_EVT_ERROR: - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_RED_ON); + aa_is (AA_OUT, ANSI_HIGHLIGHT_RED_ON); put_s (eventmsg[s->st.event]); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); put_s (": "); put_s (errmsg[s->st.code]); msg = aa_service_status_get_msg (&s->st); @@ -477,21 +477,21 @@ status_service (struct serv *serv, struct config *cfg) case AA_EVT_STARTING: case AA_EVT_STOPPING: - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_BLUE_ON); + aa_is (AA_OUT, ANSI_HIGHLIGHT_BLUE_ON); put_s (eventmsg[s->st.event]); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); break; case AA_EVT_STARTING_FAILED: case AA_EVT_STOPPING_FAILED: - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_RED_ON); + aa_is (AA_OUT, ANSI_HIGHLIGHT_RED_ON); put_s (eventmsg[s->st.event]); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); if (cfg->mode == MODE_LIST && max <= 6) { if (max > 1) - aa_bb_noflush (AA_OUT, "...", (max > 4) ? 3 : max - 1); - aa_bs_noflush (AA_OUT, " "); + aa_bb (AA_OUT, "...", (max > 4) ? 3 : max - 1); + aa_bs (AA_OUT, " "); } else { @@ -508,14 +508,14 @@ status_service (struct serv *serv, struct config *cfg) case AA_EVT_START_FAILED: case AA_EVT_STOP_FAILED: - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_RED_ON); + aa_is (AA_OUT, ANSI_HIGHLIGHT_RED_ON); put_s (eventmsg[s->st.event]); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); if (cfg->mode == MODE_LIST && max <= 6) { if (max > 1) - aa_bb_noflush (AA_OUT, "...", (max > 4) ? 3 : max - 1); - aa_bs_noflush (AA_OUT, " "); + aa_bb (AA_OUT, "...", (max > 4) ? 3 : max - 1); + aa_bs (AA_OUT, " "); } else { @@ -525,9 +525,9 @@ status_service (struct serv *serv, struct config *cfg) break; case AA_EVT_STARTED: - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_GREEN_ON); + aa_is (AA_OUT, ANSI_HIGHLIGHT_GREEN_ON); put_s (eventmsg[s->st.event]); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); break; case AA_EVT_STOPPED: @@ -538,7 +538,7 @@ status_service (struct serv *serv, struct config *cfg) break; } } - aa_bs_flush (AA_OUT, "\n"); + aa_bs (AA_OUT, "\n"); if (first) first = 0; @@ -629,7 +629,7 @@ load_service (const char *name, struct config *cfg) int e = errno; aa_put_err (name, "Failed to read service status file: ", 0); - aa_bs_noflush (AA_ERR, strerror (e)); + aa_bs (AA_ERR, strerror (e)); aa_end_err (); return -1; } @@ -649,7 +649,7 @@ load_service (const char *name, struct config *cfg) int e = errno; aa_put_err (name, "Unable to read s6 status: ", 0); - aa_bs_noflush (AA_ERR, strerror (e)); + aa_bs (AA_ERR, strerror (e)); aa_end_err (); return -1; } @@ -974,5 +974,6 @@ main (int argc, char * const argv[]) for (size_t i = 0; i < genalloc_len (struct serv, &ga_serv); ++i) status_service (&genalloc_s (struct serv, &ga_serv)[i], &cfg); + aa_bb_flush (AA_OUT, "", 0); return 0; } diff --git a/src/anopa/aa-stop.c b/src/anopa/aa-stop.c index 457fc67..2dc3f25 100644 --- a/src/anopa/aa-stop.c +++ b/src/anopa/aa-stop.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * aa-stop.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -72,10 +72,10 @@ autoload_cb (int si, aa_al al, const char *name, int err) { int aa = (mode & AA_MODE_IS_DRY) ? AA_ERR : AA_OUT; - aa_bs_noflush (aa, "auto-add: "); - aa_bs_noflush (aa, aa_service_name (aa_service (si))); - aa_bs_noflush (aa, " needs "); - aa_bs_noflush (aa, name); + aa_bs (aa, "auto-add: "); + aa_bs (aa, aa_service_name (aa_service (si))); + aa_bs (aa, " needs "); + aa_bs (aa, name); aa_bs_flush (aa, "\n"); } @@ -293,8 +293,8 @@ stop_supervise_for (int si) if (s->st.type != AA_TYPE_LONGRUN) return; - aa_bs_noflush (AA_OUT, "Stopping s6-supervise for "); - aa_bs_noflush (AA_OUT, aa_service_name (s)); + aa_bs (AA_OUT, "Stopping s6-supervise for "); + aa_bs (AA_OUT, aa_service_name (s)); aa_bs_flush (AA_OUT, "...\n"); byte_copy (dir, l_sn, aa_service_name (s)); @@ -491,7 +491,7 @@ main (int argc, char * const argv[]) if (!(mode & AA_MODE_IS_DRY)) { - aa_bs_noflush (AA_OUT, "\n"); + aa_bs (AA_OUT, "\n"); put_title (1, PROG, "Completed.", 1); aa_show_stat_nb (nb_already, "Not up", ANSI_HIGHLIGHT_GREEN_ON); aa_show_stat_nb (nb_done, "Stopped", ANSI_HIGHLIGHT_GREEN_ON); diff --git a/src/anopa/start-stop.c b/src/anopa/start-stop.c index 4fbd2c3..ae87d59 100644 --- a/src/anopa/start-stop.c +++ b/src/anopa/start-stop.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * start-stop.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -117,18 +117,18 @@ draw_password () struct progress *pg = &genalloc_s (struct progress, &ga_progress)[s->pi]; if (pg->is_drawn == DRAWN_PASSWORD_READY) - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_ON); - aa_is_noflush (AA_OUT, aa_service_name (s)); + aa_is (AA_OUT, ANSI_HIGHLIGHT_ON); + aa_is (AA_OUT, aa_service_name (s)); if (pg->is_drawn == DRAWN_PASSWORD_READY) - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_OFF); - aa_is_noflush (AA_OUT, ": "); - aa_is_noflush (AA_OUT, pg->aa_pg.sa.s); + aa_is (AA_OUT, ANSI_HIGHLIGHT_OFF); + aa_is (AA_OUT, ": "); + aa_is (AA_OUT, pg->aa_pg.sa.s); aa_is_flush (AA_OUT, " : "); draw |= DRAW_CUR_PASSWORD; } static void -is_noflush_time (int secs) +is_time (int secs) { char buf[UINT_FMT]; int mins; @@ -139,14 +139,14 @@ is_noflush_time (int secs) if (mins > 0) { buf[uint_fmt (buf, mins)] = '\0'; - aa_is_noflush (AA_OUT, buf); - aa_is_noflush (AA_OUT, "m"); + aa_is (AA_OUT, buf); + aa_is (AA_OUT, "m"); } if (secs > 0) { buf[uint_fmt (buf, secs)] = '\0'; - aa_is_noflush (AA_OUT, buf); - aa_is_noflush (AA_OUT, "s"); + aa_is (AA_OUT, buf); + aa_is (AA_OUT, "s"); } } @@ -162,7 +162,7 @@ draw_waiting (int already_drawn) int secs; if (already_drawn) - aa_is_noflush (AA_OUT, ANSI_CLEAR_BEFORE ANSI_START_LINE); + aa_is (AA_OUT, ANSI_CLEAR_BEFORE ANSI_START_LINE); nb = genalloc_len (pid_t, &ga_pid) + nb_wait_longrun; if (nb <= 0) @@ -211,33 +211,33 @@ draw_waiting (int already_drawn) } if (nb > 1 || secs >= 0) - aa_is_noflush (AA_OUT, "["); + aa_is (AA_OUT, "["); if (nb > 1) { buf[uint_fmt (buf, n)] = '\0'; - aa_is_noflush (AA_OUT, buf); - aa_is_noflush (AA_OUT, "/"); + aa_is (AA_OUT, buf); + aa_is (AA_OUT, "/"); buf[uint_fmt (buf, nb)] = '\0'; - aa_is_noflush (AA_OUT, buf); + aa_is (AA_OUT, buf); if (secs >= 0) - aa_is_noflush (AA_OUT, "; "); + aa_is (AA_OUT, "; "); } if (secs >= 0) { - is_noflush_time (secs); - aa_is_noflush (AA_OUT, "/"); + is_time (secs); + aa_is (AA_OUT, "/"); if (aa_service (si)->secs_timeout > 0) - is_noflush_time (aa_service (si)->secs_timeout); + is_time (aa_service (si)->secs_timeout); else if (is_utf8) - aa_is_noflush (AA_OUT, "\u221e"); /* infinity sign */ + aa_is (AA_OUT, "\u221e"); /* infinity sign */ else - aa_is_noflush (AA_OUT, "Inf"); + aa_is (AA_OUT, "Inf"); } if (nb > 1 || secs >= 0) - aa_is_noflush (AA_OUT, "] "); + aa_is (AA_OUT, "] "); aa_is_flush (AA_OUT, aa_service_name (aa_service (si))); @@ -446,8 +446,8 @@ handle_fd_out (int si) ++len; clear_draw (); - aa_bs_noflush (AA_OUT, aa_service_name (s)); - aa_bs_noflush (AA_OUT, ": "); + aa_bs (AA_OUT, aa_service_name (s)); + aa_bs (AA_OUT, ": "); aa_bb_flush (AA_OUT, s->sa_out.s, len); memmove (s->sa_out.s, s->sa_out.s + len, s->sa_out.len - len); @@ -636,9 +636,9 @@ end_si_password (void) clear_draw (); /* we put the message into the service output */ - aa_bs_noflush (AA_OUT, aa_service_name (s)); - aa_bs_noflush (AA_OUT, ": "); - aa_bs_noflush (AA_OUT, pg->aa_pg.sa.s); + aa_bs (AA_OUT, aa_service_name (s)); + aa_bs (AA_OUT, ": "); + aa_bs (AA_OUT, pg->aa_pg.sa.s); aa_bs_flush (AA_OUT, "\n"); remove_fd_from_iop (s->fd_in); @@ -822,8 +822,8 @@ handle_longrun (aa_mode mode, uint16_t id, char event) if (event == 'u' || event == 'd') { clear_draw (); - aa_bs_noflush (AA_OUT, aa_service_name (aa_service (si))); - aa_bs_noflush (AA_OUT, ": "); + aa_bs (AA_OUT, aa_service_name (aa_service (si))); + aa_bs (AA_OUT, ": "); aa_bs_flush (AA_OUT, (event == 'u') ? "Started; Getting ready...\n" : "Down; Will restart...\n"); @@ -977,15 +977,15 @@ exec_cb (int si, aa_evt evt, pid_t pid) && s->gets_ready && s->st.code == ERR_ALREADY_UP) { - aa_bs_noflush (AA_OUT, aa_service_name (s)); + aa_bs (AA_OUT, aa_service_name (s)); aa_bs_flush (AA_OUT, ": Getting ready...\n"); } else { if (!(pid & AA_MODE_IS_DRY)) - aa_bs_noflush (AA_OUT, + aa_bs (AA_OUT, (pid & AA_MODE_START) ? "Starting " : "Stopping "); - aa_bs_noflush (AA_OUT, aa_service_name (aa_service (si))); + aa_bs (AA_OUT, aa_service_name (aa_service (si))); aa_bs_flush (AA_OUT, (pid & AA_MODE_IS_DRY) ? "\n" : "...\n"); } break; @@ -1354,10 +1354,10 @@ show_stat_service_names (genalloc *ga, const char *title, const char *ansi_color for (i = 0; i < genalloc_len (int, ga); ++i) { if (i > 0) - aa_bs_noflush (AA_OUT, "; "); - aa_is_noflush (AA_OUT, ansi_color); - aa_bs_noflush (AA_OUT, aa_service_name (aa_service (list_get (ga, i)))); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_ON); + aa_bs (AA_OUT, "; "); + aa_is (AA_OUT, ansi_color); + aa_bs (AA_OUT, aa_service_name (aa_service (list_get (ga, i)))); + aa_is (AA_OUT, ANSI_HIGHLIGHT_ON); } end_title (); } diff --git a/src/anopa/start-stop.h b/src/anopa/start-stop.h index e364643..c6cf235 100644 --- a/src/anopa/start-stop.h +++ b/src/anopa/start-stop.h @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * start-stop.h - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -113,19 +113,19 @@ void show_stat_service_names (genalloc *ga, const char *title, const char *ansi_ clear_draw (); \ aa_put_err (name, msg, end); \ } while (0) -#define add_err(s) aa_bs_noflush (AA_ERR, s) +#define add_err(s) aa_bs (AA_ERR, s) #define put_err_service(name,err,end) put_err (name, errmsg[err], end) #define end_warn() aa_end_warn () #define put_warn(name,msg,end) do { \ clear_draw (); \ aa_put_warn (name, msg, end); \ } while (0) -#define add_warn(s) aa_bs_noflush (AA_ERR, s) +#define add_warn(s) aa_bs (AA_ERR, s) #define end_title() aa_end_title () #define put_title(main,name,title,end) do { \ clear_draw (); \ aa_put_title (main, name, title, end); \ } while (0) -#define add_title(s) aa_bs_noflush (AA_OUT, s) +#define add_title(s) aa_bs (AA_OUT, s) #endif /* AA_START_STOP_H */ diff --git a/src/include/anopa/output.h b/src/include/anopa/output.h index c07a24b..d77cfb9 100644 --- a/src/include/anopa/output.h +++ b/src/include/anopa/output.h @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * output.h - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -39,13 +39,13 @@ extern const char *PROG; #define AA_ERR 1 extern void aa_set_double_output (int enabled); -extern void aa_bb_noflush (int where, const char *s, size_t len); +extern void aa_bb (int where, const char *s, size_t len); extern void aa_bb_flush (int where, const char *s, size_t len); -#define aa_bs_noflush(w,s) aa_bb_noflush ((w), (s), strlen (s)) +#define aa_bs(w,s) aa_bb ((w), (s), strlen (s)) #define aa_bs_flush(w,s) aa_bb_flush ((w), (s), strlen (s)) -extern void aa_ib_noflush (int where, const char *s, size_t len); +extern void aa_ib (int where, const char *s, size_t len); extern void aa_ib_flush (int where, const char *s, size_t len); -#define aa_is_noflush(w,s) aa_ib_noflush ((w), (s), strlen (s)) +#define aa_is(w,s) aa_ib ((w), (s), strlen (s)) #define aa_is_flush(w,s) aa_ib_flush ((w), (s), strlen (s)) extern void aa_bs_end (int where); #define aa_end_err() aa_bs_end (AA_ERR) diff --git a/src/libanopa/die_usage.c b/src/libanopa/die_usage.c index 3daac57..d552862 100644 --- a/src/libanopa/die_usage.c +++ b/src/libanopa/die_usage.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * die_usage.c - * Copyright (C) 2015 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -28,11 +28,11 @@ extern char const *PROG; void aa_die_usage (int rc, const char *usage, const char *details) { - aa_bs_noflush (AA_OUT, "Usage: "); - aa_bs_noflush (AA_OUT, PROG); - aa_bs_noflush (AA_OUT, " "); - aa_bs_noflush (AA_OUT, usage); - aa_bs_noflush (AA_OUT, "\n\n"); + aa_bs (AA_OUT, "Usage: "); + aa_bs (AA_OUT, PROG); + aa_bs (AA_OUT, " "); + aa_bs (AA_OUT, usage); + aa_bs (AA_OUT, "\n\n"); aa_bs_flush (AA_OUT, details); _exit (rc); } diff --git a/src/libanopa/die_version.c b/src/libanopa/die_version.c index 37a55c7..002ced1 100644 --- a/src/libanopa/die_version.c +++ b/src/libanopa/die_version.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * die_version.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -30,8 +30,8 @@ extern char const *PROG; void aa_die_version (void) { - aa_bs_noflush (AA_OUT, PROG); - aa_bs_noflush (AA_OUT, " v" ANOPA_VERSION "\n"); + aa_bs (AA_OUT, PROG); + aa_bs (AA_OUT, " v" ANOPA_VERSION "\n"); aa_bs_flush (AA_OUT, "Copyright (C) 2015-2017 Olivier Brunel - https://jjacky.com/anopa\n" "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n" diff --git a/src/libanopa/output.c b/src/libanopa/output.c index 12c9e5c..10d18bf 100644 --- a/src/libanopa/output.c +++ b/src/libanopa/output.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * output.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -30,7 +30,7 @@ static int double_output = 0; #define is_tty(n) (istty[0] > -1 || chk_tty ()) && istty[n] -#define putb_noflush(w,s,l) buffer_putnoflush ((w) ? buffer_2 : buffer_1small, s, l) +#define putb(w,s,l) buffer_put ((w) ? buffer_2 : buffer_1small, s, l) #define putb_flush(w,s,l) buffer_putflush ((w) ? buffer_2 : buffer_1small, s, l) static int @@ -48,11 +48,11 @@ aa_set_double_output (int enabled) } void -aa_bb_noflush (int where, const char *s, size_t len) +aa_bb (int where, const char *s, size_t len) { - putb_noflush (where, s, len); + putb (where, s, len); if (double_output) - putb_noflush (!where, s, len); + putb (!where, s, len); } void @@ -64,12 +64,12 @@ aa_bb_flush (int where, const char *s, size_t len) } void -aa_ib_noflush (int where, const char *s, size_t len) +aa_ib (int where, const char *s, size_t len) { if (is_tty (where)) - putb_noflush (where, s, len); + putb (where, s, len); if (double_output && is_tty (!where)) - putb_noflush (!where, s, len); + putb (!where, s, len); } void @@ -84,21 +84,21 @@ aa_ib_flush (int where, const char *s, size_t len) void aa_bs_end (int where) { - aa_is_noflush (where, ANSI_HIGHLIGHT_OFF); + aa_is (where, ANSI_HIGHLIGHT_OFF); aa_bs_flush (where, "\n"); } void aa_put_err (const char *name, const char *msg, int end) { - aa_is_noflush (AA_ERR, ANSI_HIGHLIGHT_RED_ON); - aa_bs_noflush (AA_ERR, "==> ERROR: "); - aa_is_noflush (AA_ERR, ANSI_HIGHLIGHT_ON); - aa_bs_noflush (AA_ERR, name); + aa_is (AA_ERR, ANSI_HIGHLIGHT_RED_ON); + aa_bs (AA_ERR, "==> ERROR: "); + aa_is (AA_ERR, ANSI_HIGHLIGHT_ON); + aa_bs (AA_ERR, name); if (msg) { - aa_bs_noflush (AA_ERR, ": "); - aa_bs_noflush (AA_ERR, msg); + aa_bs (AA_ERR, ": "); + aa_bs (AA_ERR, msg); } if (end) aa_end_err (); @@ -107,14 +107,14 @@ aa_put_err (const char *name, const char *msg, int end) void aa_put_warn (const char *name, const char *msg, int end) { - aa_is_noflush (AA_ERR, ANSI_HIGHLIGHT_YELLOW_ON); - aa_bs_noflush (AA_ERR, "==> WARNING: "); - aa_is_noflush (AA_ERR, ANSI_HIGHLIGHT_ON); - aa_bs_noflush (AA_ERR, name); + aa_is (AA_ERR, ANSI_HIGHLIGHT_YELLOW_ON); + aa_bs (AA_ERR, "==> WARNING: "); + aa_is (AA_ERR, ANSI_HIGHLIGHT_ON); + aa_bs (AA_ERR, name); if (msg) { - aa_bs_noflush (AA_ERR, ": "); - aa_bs_noflush (AA_ERR, msg); + aa_bs (AA_ERR, ": "); + aa_bs (AA_ERR, msg); } if (end) aa_end_warn (); @@ -123,14 +123,14 @@ aa_put_warn (const char *name, const char *msg, int end) void aa_put_title (int main, const char *name, const char *title, int end) { - aa_is_noflush (AA_OUT, (main) ? ANSI_HIGHLIGHT_GREEN_ON : ANSI_HIGHLIGHT_BLUE_ON); - aa_bs_noflush (AA_OUT, (main) ? "==> " : " -> "); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_ON); - aa_bs_noflush (AA_OUT, name); + aa_is (AA_OUT, (main) ? ANSI_HIGHLIGHT_GREEN_ON : ANSI_HIGHLIGHT_BLUE_ON); + aa_bs (AA_OUT, (main) ? "==> " : " -> "); + aa_is (AA_OUT, ANSI_HIGHLIGHT_ON); + aa_bs (AA_OUT, name); if (title) { - aa_bs_noflush (AA_OUT, ": "); - aa_bs_noflush (AA_OUT, title); + aa_bs (AA_OUT, ": "); + aa_bs (AA_OUT, title); } if (end) aa_end_title (); @@ -148,28 +148,28 @@ aa_strerr_warn (const char *s1, const char *s9, const char *s10) { - aa_bs_noflush (AA_ERR, PROG); - aa_bs_noflush (AA_ERR, ": "); + aa_bs (AA_ERR, PROG); + aa_bs (AA_ERR, ": "); if (s1) - aa_bs_noflush (AA_ERR, s1); + aa_bs (AA_ERR, s1); if (s2) - aa_bs_noflush (AA_ERR, s2); + aa_bs (AA_ERR, s2); if (s3) - aa_bs_noflush (AA_ERR, s3); + aa_bs (AA_ERR, s3); if (s4) - aa_bs_noflush (AA_ERR, s4); + aa_bs (AA_ERR, s4); if (s5) - aa_bs_noflush (AA_ERR, s5); + aa_bs (AA_ERR, s5); if (s6) - aa_bs_noflush (AA_ERR, s6); + aa_bs (AA_ERR, s6); if (s7) - aa_bs_noflush (AA_ERR, s7); + aa_bs (AA_ERR, s7); if (s8) - aa_bs_noflush (AA_ERR, s8); + aa_bs (AA_ERR, s8); if (s9) - aa_bs_noflush (AA_ERR, s9); + aa_bs (AA_ERR, s9); if (s10) - aa_bs_noflush (AA_ERR, s10); + aa_bs (AA_ERR, s10); aa_bs_flush (AA_ERR, "\n"); } diff --git a/src/libanopa/progress.c b/src/libanopa/progress.c index bce7039..b20b157 100644 --- a/src/libanopa/progress.c +++ b/src/libanopa/progress.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * progress.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -179,31 +179,31 @@ aa_progress_draw (aa_progress *pg, const char *title, int cols, int is_utf8) d = pg->pctg * w * per_c; n = d / per_c; - aa_is_noflush (AA_OUT, title); - aa_is_noflush (AA_OUT, ":"); + aa_is (AA_OUT, title); + aa_is (AA_OUT, ":"); if (w) { - aa_is_noflush (AA_OUT, edge[0]); + aa_is (AA_OUT, edge[0]); for (i = 0; i < n; ++i) - aa_is_noflush (AA_OUT, bars[per_c - 1]); + aa_is (AA_OUT, bars[per_c - 1]); if (n < w) - aa_is_noflush (AA_OUT, bars[(int) d % per_c]); + aa_is (AA_OUT, bars[(int) d % per_c]); for (i = n + 1; i < w; ++i) - aa_is_noflush (AA_OUT, edge[1]); - aa_is_noflush (AA_OUT, edge[2]); + aa_is (AA_OUT, edge[1]); + aa_is (AA_OUT, edge[2]); } - aa_is_noflush (AA_OUT, " "); + aa_is (AA_OUT, " "); buf[uint_fmt (buf, p1)] = '\0'; - aa_is_noflush (AA_OUT, buf); - aa_is_noflush (AA_OUT, "."); + aa_is (AA_OUT, buf); + aa_is (AA_OUT, "."); if (uint_fmt (buf, p2) == 1) buf[1] = '0'; buf[2] = '\0'; - aa_is_noflush (AA_OUT, buf); - aa_is_noflush (AA_OUT, "% "); + aa_is (AA_OUT, buf); + aa_is (AA_OUT, "% "); if (pg->sa.s[0] != '\0') - aa_is_noflush (AA_OUT, pg->sa.s); + aa_is (AA_OUT, pg->sa.s); aa_is_flush (AA_OUT, "\n"); } diff --git a/src/libanopa/stats.c b/src/libanopa/stats.c index 957db2f..6c1d09b 100644 --- a/src/libanopa/stats.c +++ b/src/libanopa/stats.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * stats.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -34,14 +34,14 @@ aa_show_stat_nb (int nb, const char *title, const char *ansi_color) if (nb <= 0) return; - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_BLUE_ON); - aa_bs_noflush (AA_OUT, " -> "); - aa_is_noflush (AA_OUT, ansi_color); - aa_bs_noflush (AA_OUT, title); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_ON); - aa_bs_noflush (AA_OUT, ": "); + aa_is (AA_OUT, ANSI_HIGHLIGHT_BLUE_ON); + aa_bs (AA_OUT, " -> "); + aa_is (AA_OUT, ansi_color); + aa_bs (AA_OUT, title); + aa_is (AA_OUT, ANSI_HIGHLIGHT_ON); + aa_bs (AA_OUT, ": "); buf[uint_fmt (buf, nb)] = '\0'; - aa_bs_noflush (AA_OUT, buf); + aa_bs (AA_OUT, buf); aa_end_title (); } @@ -60,10 +60,10 @@ aa_show_stat_names (const char *names, for (i = 0; i < genalloc_len (size_t, ga_offets); ++i) { if (i > 0) - aa_bs_noflush (AA_OUT, "; "); - aa_is_noflush (AA_OUT, ansi_color); - aa_bs_flush (AA_OUT, names + ga_get (size_t, ga_offets, i)); - aa_is_noflush (AA_OUT, ANSI_HIGHLIGHT_ON); + aa_bs (AA_OUT, "; "); + aa_is (AA_OUT, ansi_color); + aa_bs (AA_OUT, names + ga_get (size_t, ga_offets, i)); + aa_is (AA_OUT, ANSI_HIGHLIGHT_ON); } aa_end_title (); } diff --git a/src/utils/aa-echo.c b/src/utils/aa-echo.c index 16dcdf5..bef87e3 100644 --- a/src/utils/aa-echo.c +++ b/src/utils/aa-echo.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * aa-echo.c - * Copyright (C) 2015 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -145,7 +145,7 @@ main (int argc, char * const argv[]) dieusage (1); if (blank) - aa_bs_noflush (where, "\n"); + aa_bs (where, "\n"); if (put) put ("", NULL, 0); for (i = 0; i < argc; ++i) @@ -153,22 +153,22 @@ main (int argc, char * const argv[]) if (*argv[i] == '+') { if (str_equal (argv[i], "+g") || str_equal (argv[i], "+green")) - aa_is_noflush (where, ANSI_HIGHLIGHT_GREEN_ON); + aa_is (where, ANSI_HIGHLIGHT_GREEN_ON); else if (str_equal (argv[i], "+b") || str_equal (argv[i], "+blue")) - aa_is_noflush (where, ANSI_HIGHLIGHT_BLUE_ON); + aa_is (where, ANSI_HIGHLIGHT_BLUE_ON); else if (str_equal (argv[i], "+y") || str_equal (argv[i], "+yellow")) - aa_is_noflush (where, ANSI_HIGHLIGHT_YELLOW_ON); + aa_is (where, ANSI_HIGHLIGHT_YELLOW_ON); else if (str_equal (argv[i], "+r") || str_equal (argv[i], "+red")) - aa_is_noflush (where, ANSI_HIGHLIGHT_RED_ON); + aa_is (where, ANSI_HIGHLIGHT_RED_ON); else if (str_equal (argv[i], "+w") || str_equal (argv[i], "+white")) - aa_is_noflush (where, ANSI_HIGHLIGHT_ON); + aa_is (where, ANSI_HIGHLIGHT_ON); else if (str_equal (argv[i], "+n") || str_equal (argv[i], "+normal")) - aa_is_noflush (where, ANSI_HIGHLIGHT_OFF); + aa_is (where, ANSI_HIGHLIGHT_OFF); else - aa_bs_noflush (where, argv[i] + 1); + aa_bs (where, argv[i] + 1); } else - aa_bs_noflush (where, argv[i]); + aa_bs (where, argv[i]); } aa_bs_end (where); diff --git a/src/utils/aa-incmdline.c b/src/utils/aa-incmdline.c index 127331d..74b6dbb 100644 --- a/src/utils/aa-incmdline.c +++ b/src/utils/aa-incmdline.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * aa-incmdline.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -160,7 +160,7 @@ main (int argc, char * const argv[]) return 3; else if (!quiet) { - aa_bb_noflush (AA_OUT, sa.s + start, len); + aa_bb (AA_OUT, sa.s + start, len); aa_bs_flush (AA_OUT, "\n"); } return 0; diff --git a/src/utils/aa-kill.c b/src/utils/aa-kill.c index 62fd4c7..7b26e8c 100644 --- a/src/utils/aa-kill.c +++ b/src/utils/aa-kill.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * aa-kill.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -51,13 +51,13 @@ static void _kill (pid_t pid, int sig) u = pid; buf[uint_fmt (buf, u)] = 0; - aa_bs_noflush (AA_OUT, "kill("); + aa_bs (AA_OUT, "kill("); if (u == (unsigned int) -1) - aa_bs_noflush (AA_OUT, "-1"); + aa_bs (AA_OUT, "-1"); else - aa_bs_noflush (AA_OUT, buf); - aa_bs_noflush (AA_OUT, ","); - aa_bs_noflush (AA_OUT, sig_name (sig)); + aa_bs (AA_OUT, buf); + aa_bs (AA_OUT, ","); + aa_bs (AA_OUT, sig_name (sig)); aa_bs_flush (AA_OUT, ")\n"); } #else diff --git a/src/utils/aa-terminate.c b/src/utils/aa-terminate.c index e274695..b1ad0ec 100644 --- a/src/utils/aa-terminate.c +++ b/src/utils/aa-terminate.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * aa-terminate.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -52,8 +52,8 @@ verbose_do (const char *s1, const char *s2) { if (level < 2) return; - aa_bs_noflush (AA_OUT, s1); - aa_bs_noflush (AA_OUT, s2); + aa_bs (AA_OUT, s1); + aa_bs (AA_OUT, s2); aa_bs_flush (AA_OUT, "...\n"); } @@ -62,8 +62,8 @@ verbose_fail (int e) { if (level < 2) return; - aa_bs_noflush (AA_OUT, "Failed: "); - aa_bs_noflush (AA_OUT, strerror (e)); + aa_bs (AA_OUT, "Failed: "); + aa_bs (AA_OUT, strerror (e)); aa_bs_flush (AA_OUT, "\n"); } diff --git a/src/utils/aa-tty.c b/src/utils/aa-tty.c index e5af583..8e599bb 100644 --- a/src/utils/aa-tty.c +++ b/src/utils/aa-tty.c @@ -2,7 +2,7 @@ * anopa - Copyright (C) 2015-2017 Olivier Brunel * * aa-tty.c - * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> + * Copyright (C) 2015-2018 Olivier Brunel <jjk@jjacky.com> * * This file is part of anopa. * @@ -108,7 +108,7 @@ main (int argc, char * const argv[]) { if (errno == ENOENT) { - aa_bs_noflush (AA_OUT, "/dev/"); + aa_bs (AA_OUT, "/dev/"); aa_bb_flush (AA_OUT, s, l); return 0; }