summaryrefslogtreecommitdiff
path: root/glnx-console.c
Commit message (Collapse)AuthorAgeFilesLines
* console: Pacify `gcc -fanalyzer`Colin Walters2021-06-281-1/+1
| | | | | | It's not smart enough to follow the conditionals here to see that `textlen > 0` implies `text != NULL`. But the cost of an additional check is probably nil, so let's be robust to future code refactoring.
* console: Drop newline on glnx_console_lockColin Walters2018-05-081-1/+1
| | | | | | This was inherited from some other code; perhaps the idea was to ensure the console is in a consistent state before starting a progress bar, but it causes extra newlines which is distracting.
* console: make stdout_is_tty() publicJonathan Lebon2018-01-101-5/+5
| | | | | | | Share its static var goodness with clients. This will be used in rpm-ostree from various places which sometimes do use a `GLnxConsole` and sometimes don't, so it's more convenient to make it its own function.
* console: Avoid rendering too quicklyColin Walters2017-12-121-0/+28
| | | | | For TTYs, it slows things down pointlessly. For non-TTYs like Jenkins jobs, it creates a ton of output that obscures useful information.
* console: Drop unused current_text/current_percentColin Walters2017-12-121-11/+0
| | | | | | The idea was clearly to avoid useless updates, but we never actually *set* these values. Drop the code for now to avoid confusion, I'll reimplement this in a better way.
* console: Limit progress bar to 20 columns maxColin Walters2017-12-121-2/+9
| | | | | IMO, it looks bad to have a really big progress bar. I personally usually work on a 27" monitor with maximized terminals.
* console: Add an "n items" APIColin Walters2017-12-121-0/+26
| | | | It's often really useful to see the counts, not just the percentage.
* console: trim useless checkJonathan Lebon2017-08-151-1/+1
| | | | | | The `percentage` var is a guint and so is always >= 0. Coverity CID: 163703
* glnx-console: Add missing NULL check before writing out textPhilip Withnall2017-08-151-1/+2
| | | | | | | | It’s possible that text is NULL on this path. Coverity CID: 1376570 Signed-off-by: Philip Withnall <withnall@endlessm.com>
* console: Fix Coverity NULL deref warningColin Walters2017-08-021-1/+2
| | | | | | | We need to handle our "empty to NULL canonicalization" before doing the length. Coverity CID: 1376570
* text_percent_internal: compare uints before printingJonathan Lebon2016-07-221-2/+4
| | | | | | | A wild sordid tale of substractions and unsigned integers leads this team of variables down a loonng path... Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
* text_percent_internal: only pad right in the text caseJonathan Lebon2016-05-101-7/+5
| | | | | | | Padding in the percentage case was useless (and actually didn't work properly) since all the real estate is taken up by the text and the bar. We only need padding in the text case, in case the new string is shorter.
* console: Fix glnx_console_textColin Walters2016-05-011-24/+29
| | | | Not sure if it ever worked. We need to not print the bars, etc.
* console: Add an API to just emit textColin Walters2016-03-101-18/+31
| | | | We had this internally, just need to expose it.
* console: Fix bar progress lengthv2016.1Colin Walters2016-02-081-1/+1
| | | | | The previous fix added the last character of text, but failed to account for the space we're adding.
* console: Don't delete last character of output textColin Walters2016-01-261-1/+1
| | | | | Not sure why we were doing this...I guess people were working around it by adding their own spaces?
* console: Fix g_auto() and unlock cleanupColin Walters2016-01-251-1/+1
| | | | | This way, one can unlock the console while still using the cleanup macro. Otherwise we miss a lot of the ergonomics of cleanup macros.
* console: Do basic output if we're not on a ttyColin Walters2015-04-171-20/+33
| | | | | | | | | Doing nothing isn't super useful; if you're using e.g. rpm-ostree in Jenkins you want to see *something* from the "live tail". This is a basic line-per-change implementation. Closes: https://github.com/GNOME/libglnx/pull/6
* console: Make glnx_console_lines and columns publicColin Walters2015-03-191-7/+15
| | | | They'll be used by rpm-ostree at least.
* Import console from rpm-ostreeColin Walters2015-02-171-0/+268
This contains some basic progress bar drawing code for now.