summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* lib/boottime: add a new fileKarel Zak2014-05-061-0/+34
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/timeutils: remove get_boot_time from libcommonKarel Zak2014-05-061-26/+0Star
| | | | | | | | clock_gettime() needs -lrt, so let's keep this stuff outside libcommon.la Reported-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/terminal-colors.d.5: Improve the typesetting of the manualBjarni Ingi Gislason2014-05-061-9/+9
| | | | | | | | | | Remove '\&' in front of a full stop (.), when it does not start or end a string Adjust space between sentences to two space characters (or begin each sentence on a new line). Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
* lib/colors: change an include to a local oneBenno Schulenberg2014-05-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* lib/pager: use names when referring to standard file descriptorsSami Kerola2014-05-061-9/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/timeutils: fix memory leakSami Kerola2014-05-061-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: move get_boot_time() to lib/timeutilsSami Kerola2014-05-041-0/+29
| | | | | | In future the last(1) will use get_boot_time() as well. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/procutils: notice setuid() process ownership changesSami Kerola2014-04-261-4/+5
| | | | | | | | | Earlier the owner of a process was determined by owner of the /proc/<pid>/stat file. When changes user ID privileges with setuid() the stat file ownership is not updated, that resulted kill(1) to consider such processes where running using same uid as the present process. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/procutils: reset errno before strtol() callSami Kerola2014-04-261-1/+2
| | | | | | | | When going through /proc the last entry made readdir() to alter errno, which made the strtol() to think something went wrong, resulting kill(1) tests to fail when running in --parallel mode. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/mbalign: report also size in bytesKarel Zak2014-04-151-10/+30
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mbsalign: split mbs_safe_encode()Karel Zak2014-04-151-12/+33
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: rewrite test code to tree(1)-like utilKarel Zak2014-04-081-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt.c: Goodbye!Ondrej Oprala2014-04-032-998/+0Star
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* mcookie: use lib/randutilsSami Kerola2014-03-261-0/+22
| | | | | | | | | The mcookie should reuse existing code, and there is definitely no need to prefer /dev/random for this utility. See reference for explanation about later statement. References: http://www.2uo.de/myths-about-urandom/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/colors: care about colors only on tty()Karel Zak2014-03-121-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: fix parse_size() return codeKarel Zak2014-03-111-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: fix colors testKarel Zak2014-03-111-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: keep track about output orderKarel Zak2014-03-111-1/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: add tt_line_get_userdata()Karel Zak2014-03-111-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: support dec.points in parse_size()Karel Zak2014-03-111-2/+43
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: use proper return codes in parse_size()Karel Zak2014-03-111-9/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mbalign: add mbs_safe_width() from tt.cKarel Zak2014-03-112-136/+136
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/tt: add function to convert table to stringKarel Zak2014-03-111-0/+26
| | | | | | | Note that open_memstream() is POSIX-1.2008, so it's possible than not all libc have already implemented this function. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: add reduce term width functionalityKarel Zak2014-03-111-0/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: add TT_FL_MAX to fill screenKarel Zak2014-03-111-2/+32
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: add tb_get_nlines()Karel Zak2014-03-111-0/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: don't hardcode stdout as outputKarel Zak2014-03-111-13/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: support <name>.enable tooKarel Zak2014-03-112-18/+38
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add info to man pages, add terminal-colors.d.5Karel Zak2014-03-112-0/+27
| | | | | Co-Author: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: check for /etc/terminal-colors.d/[util].disableOndrej Oprala2014-03-111-4/+25
| | | | | | | | [kzak@redhat.com: - move paths to pathnames.h, - use static path buffer] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: make dirent d_type usage more robustKarel Zak2014-03-041-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/color: add colorscheme parserKarel Zak2014-02-101-2/+47
|
* losetup: wait for udevKarel Zak2014-01-241-5/+18
| | | | | | | | | | | | | On system with /dev/lop-control the udevd creates /dev/loopN nodes. It seems better to wait a moment after unsuccessful open(/dev/loopN) and try it to open again. The problem is pretty visible on systems where udevd also modifies permission for loopN devices, then open() fails with EACCES when losetup executed by non-root user (but user who is in "disk" group). Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1045432 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: fix scanf format string [coverity scan]Karel Zak2014-01-141-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/path: add path_strdup()Karel Zak2014-01-061-0/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: standardize some "cannot read" and "seek failed" error messagesBenno Schulenberg2013-10-091-4/+4
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* losetup: don't require 512-byte aligned offsetsKarel Zak2013-10-011-0/+6
| | | | | | | | | | | | | | | | Kernel aligns the device size, but the offset where the device starts is not required to be aligned. # losetup --offset 32 -f file.img is just fine, the final size of the look device will be (in sectors) (backing_file_size - offset) >> 9 so we have to do the same in userspace when we check for successful set capacity ioctl. Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add -L to colorize outputKarel Zak2013-09-161-4/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: add TT_FL_FREEDATAKarel Zak2013-09-161-1/+9
| | | | | | ... to call free() for line data. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add crc64()Karel Zak2013-09-112-0/+109
| | | | | | Based on bcache code from Rolf Fokkens. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: rename time-util.c to timeutils.c, fix headersKarel Zak2013-09-102-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: optimalize {starts,ends}with()Karel Zak2013-09-101-66/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/time-util: move YYYYMMDDHHMMSS to common parserSami Kerola2013-08-291-0/+7
| | | | | | | | | Even while the YYYYMMDDHHMMSS time format it not magnificent it is best to make it to be part of the one, and only, time format parser. Proposed-by: Karel Zak <kzak@redhat.com> References: http://markmail.org/message/6baqt4ttkopu7ra6 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/strutils: move *swith() functions to private librarySami Kerola2013-08-292-58/+67
| | | | | | | | Avoid code dublication in libmount and time-util. Proposed-by: Karel Zak <kzak@redhat.com> Reference: http://markmail.org/message/h7zexvqsieqngtmx Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/time-util: copy time parsing functions from systemdSami Kerola2013-08-292-0/+389
| | | | | | | | The functions are copied nearly as-is. Coding style has been modified to match with util-linux project, while the functionality remains untouched. CC: Lennart Poettering <lennart@poettering.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* losetup: use loop-control to explicitly ask for deviceKarel Zak2013-08-061-0/+30
| | | | | | | | | | | | | | | | Now we use LOOP_CTL_GET_FREE ioctl to ask for free device, for example losetup -f foo.img Unfortunately, losetup(8) allows to ask for specified device losetup /dev/loop100 foo.img and in this case we assume that the device already exists in the system. This is incorrect, we should be able to use loop-control LOOP_CTL_ADD ioctl to ask for the specified device. Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: set errno for misaligned offsetsKarel Zak2013-07-191-7/+19
| | | | | References: https://bugs.archlinux.org/task/36189 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mbsalign: initializations values are never read [clang-analyzer]Sami Kerola2013-07-091-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/loopdev: assigned value is never read [clang-analyzer]Sami Kerola2013-07-091-1/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/canonical: use realpath() from libcKarel Zak2013-07-011-151/+29Star
| | | | | | | .. after many many years it seems that we can follow libc code rather than duplicate realpath(3) implementation. Signed-off-by: Karel Zak <kzak@redhat.com>