summaryrefslogtreecommitdiff
path: root/src/print.c
AgeCommit message (Collapse)AuthorFilesLines
2021-12-14everywhere: use stdlib.h for malloc(3) definition, not GNU-specific malloc.hAriadne Conill1-1/+0
musl implements support for malloc.h, but it is only a stub. we do not use any of the GNU-specific malloc interfaces, so just use POSIX stdlib.h instead. ref #10794
2021-07-23db: allow read-only operations without cacheTimo Teräs1-0/+2
fixes #10748
2021-02-07db: consider control characters in filename as maliciousTimo Teräs1-0/+4
Especially a newline can produce havoc in the database file as the filename is written there as-is. This hardenes the extraction to consider any control character as malicious. Additional hardening is added to database loading to better detect corrupt state and return proper error code about it. Reported-by: Luca Weiss <luca@z3ntu.xyz>
2021-01-11database: Propagate errors when loading an APKINDEXthibault.ferrante1-0/+2
In case of failure when loading an APKINDEX, no errors are propagated to the user which may uncorrectly interpret the current problem.
2020-10-05db: mask password component of printed URLsTimo Teräs1-0/+24
fixes #10710
2020-05-07use SPDX-License-Identifier in source filesTBK1-3/+1
2020-03-21lower min-width to 25 columnsAntoine Fontaine1-1/+1
Some screen size are quite small. For example, the default phosh terminal is less than 50 character wide on Pinephone. This lowers the minimum loading bar size to 25 characters. For comparison, 25 character wide is just as wide as "apk add firefox linux-lts" without the quotes. Here's a bad picture to illustrate the result gitlab.alpine.org/uploads/48c20f746fbf685b62b6bd73585ecbf2/pinephone-phosh.png
2020-01-05Humanize size output of `apk info`Sören Tempel1-0/+18
This commits adds a function for receiving the closet byte unit and the size in that unit for a given size_t. The function doesn't return a string since dynamic memory allocation (or a static buffer) would be required to implement this properly. Discussion: It might be useful to add a command line flag for disabling this behaviour in order to retain compatibility with the previous apk info output format.
2018-11-02print: don't print spurious newlinesTimo Teräs1-3/+3
2017-06-01print: oh dear, i have reworked the progress bar againWilliam Pitcock1-4/+15
- rework the progress bar a little bit, basically removing the [ and ] to give a more modern aesthetic. - if utf-8 locale is enabled, use unicode codepoint 0x2588 instead of # to give the progress bar a nicer look. - if APK_PROGRESS_CHAR environment variable is defined, use the character defined there for the progress bar.
2017-04-26print: handle mixing stdout and stderr printingTimo Teräs1-0/+2
Fixes regression from commit 5ba27c90 which caused stdio buffering issues now that output is split to stderr/stdout. See also commit 51737872 for some of the history. Fixes #7107
2017-04-24print: don't shadow log()William Pitcock1-3/+3
2017-04-24print: print warnings and errors to stderrShiz1-7/+18
2017-03-29progress: shorten bar to prevent newlines on some terminalsAvi Halachmi (:avih)1-1/+1
On some (probably buggy) terminals, printing up to the rightmost column may end up with the terminal issueing a newline (probably due to putting the cursor at the next char -> new line). Some other progress bars avoid it by not reaching the rightmost column. Shorten the bar width from term-width - 7 to -8 (the 7 are "xxx% []").
2015-04-24modifications for the previous commit in error message handlingTimo Teräs1-3/+3
forgot to --amend my changes
2015-04-22print.c: provide more detailed error messages if retrieving a package failsAlex Dowad1-1/+19
fetch_maperror() translates error codes returned by libfetch to our error codes. Handle those in apk_error_str(), returning error messages which advise the user of the most likely fix. A custom error code, EAPKSTALEINDEX, has been added for cases where retrieving a package fails due to a HTTP error 404 or similar. [TimoT: add also EAPKBADURL, as well as organize a bit better where the EAPKSTALEINDEX is generated]
2013-12-05print: flush on apk_logNatanael Copa1-0/+1
Makes it more useful whith pipes.
2013-10-11print: use stdout instead of stderr for logging and progressTimo Teräs1-10/+10
stdout is the proper place for it. this also fixes the progress bar in musl, which seems to not support using line buffering for stderr.
2013-06-19print: move progress bar update logic to apk_print_progressNatanael Copa1-22/+39
- let the apk_print functions deal with the forced print itself. We avoid that the callbacks need to deal with the force flag. We can also get rid of the APK_PRINT_PROGRESS_* defines. - let the reader of --progress-fd decide how often things are updated rather than having a fixed granularity off 1/100 (percent) - avoid detect screen size and percent/bar calculations in case the --no-progress was given - track satistics for both the ascii bar and percent info and update bar only if either percent or bar changes. This makes the bar go smoother when width is wider than 100 chars and it makes the percent counter go smooth when screen width is less thann 100 chars. It also simplifies the callbacks as they no longer need to deal with update granularity.
2013-06-19print: percent arg for process_fd is integerNatanael Copa1-1/+1
With commit 0a131418899436b58a163978176d99c08cbddb0c the percent variable became an integer instead of size_t. We fix the format modifier accordingly.
2013-06-17print: move progress printing to common functionsTimo Teräs1-0/+32
2013-06-17db: refactor repository file constructionTimo Teräs1-0/+2
Fixes also 'fetch' applet to prefer copying/linking to files from cache if possible.
2013-06-13errors: rewrite the logic how errors are reportedTimo Teräs1-0/+12
Instead of the dependency oriented logic, switch to print them for each package or name needed. Might give a bit more readable errors now. There's still few corner cases that proper error is not output, which are cought by the test cases.
2012-02-10print: minimum screen width of 50Timo Teräs1-2/+3
2011-09-13all: update copyright year statementTimo Teräs1-1/+1
2011-09-09print: minor cleanup to indented writerTimo Teräs1-5/+6
2011-07-22apk: improve indented printingTimo Teräs1-3/+22
* fixup the help messages to align up properly * refresh screen width on SIGWINCH
2010-12-14various: use 'atoms' for certain package field and misc fixesTimo Teräs1-1/+1
- implement a hash table for commonly shared fields such as license, version and architecture - use macroes to print blobs or pkgname-pkgver strings - fix some old cruft
2010-12-09io: enhance istream/bstreams with pipe to forked childTimo Teräs1-1/+1
* prunes the child pid to avoid zombies * handles the errors so e.g. file-not-found is reported properly
2010-06-11print: clean up after copy-pasteNatanael Copa1-1/+1
2010-06-11First steps for libapkNatanael Copa1-0/+70