summaryrefslogtreecommitdiff
path: root/src/test/test-terminal-util.c
Commit message (Collapse)AuthorAgeFilesLines
* test: use _cleanup_ for temp. filesDavid Tardon2023-04-211-3/+2
|
* tree-wide: use -EBADF moreYu Watanabe2022-12-211-1/+1
|
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* test: Use TEST macroJan Janssen2021-11-251-28/+7
| | | | | | | | | This converts to TEST macro where it is trivial. Some additional notable changes: - simplify HAVE_LIBIDN #ifdef in test-dns-domain.c - use saved_argc/saved_argv in test-copy.c, test-path-util.c, test-tmpfiles.c and test-unit-file.c
* terminal: don't hardcode major number of PTYsLennart Poettering2021-05-191-0/+25
| | | | | | Hardcoding major numbers sucks. And we generally don't do it, except when determining whether something is a PTY. Thing though is that we don't actually need to do that here either, hence don#t.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* basic/terminal-util: rename our replacement highlight-yellow and test both ↵Zbigniew Jędrzejewski-Szmek2020-07-301-1/+2
| | | | | | | | | | | | | | the original and replacement The fact that we cannot use the "real" yellow color and need to use some other color is essentially a bug. In this particular case the issue is in urxvt, see a9009769de43b7f29d05017f4219e18c1e42a273. While we work around this by using a different color, let's not forget that this is just a (hopefullly temporary) workaround. https://bugzilla.redhat.com/show_bug.cgi?id=1859886 https://bugzilla.redhat.com/show_bug.cgi?id=1859889 https://bugzilla.redhat.com/show_bug.cgi?id=1859894
* test-terminal-util: print paragraphs of text in different colorsZbigniew Jędrzejewski-Szmek2020-07-301-0/+24
|
* basic/terminal-util: define all foreground colorsZbigniew Jędrzejewski-Szmek2020-07-231-26/+48
| | | | | | We would add and remove definitions based on which colors were used by other code. Let's just define all of them to simplify tests and allow easy comparisons which colors look good.
* test-terminal-util: fix typoLennart Poettering2020-04-081-1/+1
|
* test: add test that shows all colors we defineLennart Poettering2019-05-101-0/+33
|
* test-terminal-util: fix sigsegv when compiled without assertsZbigniew Jędrzejewski-Szmek2019-03-281-1/+1
| | | | | | | | I couldn't figure out what is going on here, because LTO inlines everything and then the backtrace reported a different spot. But when compiled with NDEBUG but no LTO, it's fairly obvious ;) C.f. #12008.
* test-terminal-util: add function loggingZbigniew Jędrzejewski-Szmek2019-03-281-0/+8
|
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-0/+2
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* tests: add simple testcase for getttyname_malloc()Lennart Poettering2019-03-261-1/+12
|
* util-lib: split out all temporary file related calls into tmpfiles-util.cLennart Poettering2018-12-021-2/+2
| | | | | | | | This splits out a bunch of functions from fileio.c that have to do with temporary files. Simply to make the header files a bit shorter, and to group things more nicely. No code changes, just some rearranging of source files.
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-27/+2
| | | | | This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
* Introduce fmkostemp_safe and use it in testsZbigniew Jędrzejewski-Szmek2018-10-261-6/+2
| | | | No functional change.
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-3/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-1/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* terminal-util: add a function that shows a pretty separator lineLennart Poettering2018-05-111-0/+2
| | | | Follow-up for #8824
* analyze: add 'cat-config' verbZbigniew Jędrzejewski-Szmek2018-04-271-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is used as 'systemd-analyze show-config systemd/logind.conf', which will dump /etc/systemd/system/user@.service /etc/systemd/system/user@.service.d/*.conf /run/systemd/system/user@.service.d/*.conf /usr/local/lib/systemd/system/user@.service.d/*.conf /usr/lib/systemd/system/user@.service.d/*.conf The idea is to make it easy to dump the configuration using the same locations and order that systemd programs use themselves (including masking, in the right order, etc.). This is the generic variant that works with any configuration scheme that follows the same general rules: $ systemd-analyze cat-config systemd/system.conf $ systemd-analyze cat-config systemd/user.conf $ systemd-analyze cat-config systemd/logind.conf $ systemd-analyze cat-config systemd/sleep.conf $ systemd-analyze cat-config systemd/journald.conf $ systemd-analyze cat-config systemd/journal-remote.conf $ systemd-analyze cat-config systemd/journal-upload.conf $ systemd-analyze cat-config systemd/coredump.conf $ systemd-analyze cat-config systemd/resolved.conf $ systemd-analyze cat-config systemd/timesyncd.conf $ systemd-analyze cat-config udev/udev.conf
* Move function to cat file & dropins into basic/Zbigniew Jędrzejewski-Szmek2018-04-261-0/+9
| | | | | This fixes a buglet where the second and later drop-in would not be seperated properly by a newline.
* terminal: add internal API to format URLs for display in capable terminalsLennart Poettering2018-04-191-0/+14
| | | | | | | | | | | | | | | | Newer terminals (in particular gnome-terminal) understand special escape sequence for formatting clickable links. Let's support that to make our tool output more clickable where that's appropriate. For details see this: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda The one big issue is that 'less' currently doesn't grok this, and doesn't ignore sequence like regular terminal implementations do if they don't support it. Hence for now, let's disable URL output if a pager is used. We should revisit that though as soon as less added support for it and enough time passed for it to enter various distributions.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* fileio: simplify mkostemp_safe() (#4090)Topi Miettinen2016-09-131-1/+1
| | | | | | According to its manual page, flags given to mkostemp(3) shouldn't include O_RDWR, O_CREAT or O_EXCL flags as these are always included. Beyond those, the only flag that all callers (except a few tests where it probably doesn't matter) use is O_CLOEXEC, so set that unconditionally.
* tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-161-1/+1
| | | | Sort the includes accoding to the new coding style.
* util-lib: move more file I/O related calls into fileio.[ch]Lennart Poettering2015-10-271-3/+4
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-0/+1
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* shared: add terminal-util.[ch]Ronny Chevalier2015-04-111-0/+84