summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
...
| * | lib: fix strutils.h, remove STRTOXX_EXIT_CODERuediger Meier2017-06-221-5/+2Star
| |/ | | | | | | | | | | | | | | | | As discussed on the mailing list. We fix all places where the non-working define STRTOXX_EXIT_CODE was used. Regarding tunelp, also see 7e3c80a7. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* / misc: no more errtryh()Ruediger Meier2017-06-251-6/+0Star
|/ | | | | | | Nowadays all our regular commands have --help options. test_uuidd does not use translations anyways. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* hwclock: update --help content and grammarJ William Piggott2017-06-211-2/+2
| | | | | Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: J William Piggott <elseifthen@gmx.com>
* include: update pathnames.hJ William Piggott2017-06-211-24/+12Star
| | | | | | | | | | | | | | | | * use /dev/rtc0 (/dev/rtc was for the 'old' driver) * remove hwclock Award workaround and alpha cmos paths * relocate _PATH_BTMP from hwclock to login-utils * add a comment for _PATH_BTMP and fix other login-utils comments * add a comment for proc/cpuinfo * remove empty shutdown.c comment from 4d43977f Review changes * remove 'used in' comments * white space fixes Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: add usage() functions headingJ William Piggott2017-06-211-0/+1
| | | | | | | | | | | Make a functions heading, similar to the existing options heading. * include/c.h: define USAGE_FUNCTIONS * Documentation/boilerplate.c: add USAGE_FUNCTIONS * sys-utils/hwclock.c add functions header to usage() Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: J William Piggott <elseifthen@gmx.com>
* libfdisk: cleanup sun label checksum usuageRuediger Meier2017-06-131-1/+1
| | | | | | | | | | | | | | We are using now the formerly unused function sun_pt_checksum(). This cleanup was motivated by clang compiler warning, see below. Also nice that we are now always using uint16_t instead of short. Warning was: ../libfdisk/src/sun.c:177:35: warning: taking address of packed member 'csum' of class or structure 'sun_disklabel' may result in an unaligned pointer value [-Waddress-of-packed-member] while(ush < (unsigned short *)(&sunlabel->csum)) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib/ttyutils: return terminal lines tooKarel Zak2017-06-121-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: Fix bug where help text was not being translated.Sebastian Rasmussen2017-05-281-2/+2
| | | | This affected cfdisk, fdisk, sfdisk, cal, dmesg and hexdump.
* include/exitcodes: remove mount(8) exit codesKarel Zak2017-04-271-10/+0Star
| | | | | | All defined by libmount now. Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '170415' of github.com:jwpi/util-linuxKarel Zak2017-04-261-3/+4
|\ | | | | | | | | | | | | | | | | * '170415' of github.com:jwpi/util-linux: optutils.h: don't print non-graph characters hwclock: improve audit control hwclock: --set and --predict segmentation fault hwclock: make epoch functions alpha only hwclock: improve default function handling
| * optutils.h: don't print non-graph charactersJ William Piggott2017-04-191-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no eloquent way to exclude/include arch dependent arguments from the ul_excl_t array. So when an arch dependent argument is left undefined err_exclusive_options() was printing out-of-bounds values. This commit cause them to be skipped instead. err_exclusive_options() shouldn't be printing out-of-bounds values in any case. Also change the error massage from 'options' to 'arguments' as some programs, like hwclock, distinguish between options and functions. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | libfdisk: fix NLS supportKarel Zak2017-04-251-2/+12
|/ | | | | | | | | | | | | | | | | | | The current libfdisk code uses gettext() to translate strings. It means it follows the default text domain (as set by textdomain(3) usually in the main program). This is useless for public shared library. We have call private bindtextdomain() and use dgettext() with private domain name to be independent on the main program. For this purpose include/nls.h supports UL_TEXTDOMAIN_EXPLICIT to use dgettext(). Note that libfdisk will continue to use util-linux.po, rather than keep the texts in the separate file. The nls.h has to be included only from fdiskP.h to be sure that nls.h works as expected for the library. Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: fix characters reorder in login promptKarel Zak2017-03-271-0/+4
| | | | | | | | | | | | | | The current agetty uses TIOCSTI ioctl to return already read chars from login name back to the terminal (without read() before tcsetattr() we will lost data already written by user). The ioctl based solution is fragile due to race -- we can return chars when terminal already contains another new chars. The result is reordered chars in login name. The solution is to use extra buffer for already read data. Reported-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add missing header fileKarel Zak2017-03-231-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge remote-tracking branch 'jwpi/hwclock-date7'Karel Zak2017-03-232-0/+327
|\ | | | | | | | | | | | | | | * jwpi/hwclock-date7: lib: add parse-date documentation hwclock: use parse_date function build-sys: add parse-date.y lib: add parse-date.y
| * lib: add parse-date.yJ William Piggott2017-03-042-0/+327
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * include/timeutils.h Add parse-date API * lib/parse-date.y - new file Lib function that parses a date string into a timespec struct. Derived from gnulib-dd7a871 parse-datetime.y with these changes: * reduced to a single function API renamed to parse_date() * removed gnulib dependencies * removed debugging * converted to util-linux coding style * include/cctype.h - new file Like ctype.h only hard coded to the 'C' locale. Used by lib/parse-date.y. Derived from gnulib-dd7a871 c-ctype.h with these changes: * removed gnulib dependencies * converted to util-linux coding style * add requisite util-linux constants Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | include: fix compiler warningSami Kerola2017-03-132-0/+6
|/ | | | | | | | | | | | | | ./include/optutils.h:12:18: warning: null pointer dereference [-Wnull-dereference] for (o = opts; o->name; o++) ~^~~~~~ In file included from libfdisk/src/dos.c:12:0: ./include/pt-mbr.h:25:47: warning: potential null pointer dereference [-Wnull-dereference] return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); ~^~~ Well these should be impossible, so add assert() to catch possible bugs. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-1/+1
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: add missing fileKarel Zak2017-02-161-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mbsedit: add simple buffer editorKarel Zak2017-02-161-0/+32
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: improve coding styleSami Kerola2017-02-051-0/+4
| | | | | | | | | Make string constants to be symbolical declarations. Use longer variable name for rtc and cmos function pointer values. Exclude code that is architecture specific with preprocessor directives. And remove message duplication. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib: add timegm() portability function to lib/timeutils.cSami Kerola2017-02-031-0/+4
| | | | | | | | | Local timegm() is a replacement function in cases it is missing from libc implementation. Hopefully the replacement is never, or very rarely, used. CC: Ruediger Meier <ruediger.meier@ga-group.nl> Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/strutils: return end pointer by isdigit_string()Karel Zak2017-01-281-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/list: remove LIST_HEAD macroKarel Zak2017-01-051-5/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | * the variable definition with hidden type is always horrible, for example: int func() { LIST_HEAD(foo); ... } the more readable is: int func() { struct list_head foo; INIT_LIST_HEAD(&foo); ... } * the name LIST_HEAD conflict with /usr/include/sys/queue.h * we use it only on two places in sulogin Signed-off-by: Karel Zak <kzak@redhat.com>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-0/+6
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* include/c.h: add errtryhelp()Karel Zak2016-12-191-0/+9
| | | | | | | | | | Add code to print: Try '<progname> --help' for more information. and exit. Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: remove obsolete HAVE_UPDWTMP fallbackRuediger Meier2016-12-071-2/+0Star
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib,strutils: add strtoux[16|32|64]_or_err functionsHeiko Carstens2016-11-091-0/+3
| | | | | | | Add helper functions which allow to parse hexadecimal numbers. Based on a patch from Clemens von Mann. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
* lib/crc32: prefix public functionsGustavo Zacarias2016-10-191-2/+2
| | | | | | | | | | | Make the publicly-visible crc32 library functions prefixed by ul_, such as crc32() -> ul_crc32(). This is because it clashes with the crc32() function from zlib. For newer versions of glib (2.50+) zlib and libblkid are required dependencies and otherwise results in build failure when building statically. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
* lib/randutils: remove unnecessary functionKarel Zak2016-10-041-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: make left and right trims more robustSami Kerola2016-09-291-2/+7
| | | | | | | Do not follow null pointer, and stop going any further when ltrim_whitespace() is at the end of a string. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* debug: use const void * for ul_debugobj()Igor Gnatenko2016-09-211-1/+1
| | | | | | | | | | We don't modify data it's pointing out and we should not modify it. Also remove casting to void * as gcc will do it automatically (before we had to cast it explicitly to avoid warning on discarding 'const' qualifier). Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* libsmartcols: support multi-line cells based on line breaksKarel Zak2016-09-061-1/+1
| | | | | | | | | | Now libsmartcols completely control when and how wrap long lines/cells. This is sometimes user unfriendly and it would be nice to support multi-line cells where wrap is based on \n (new line char). This patch add new column flag SCOLS_FL_WRAPNL. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/randutils: add xsrand() and rand_get_number()Karel Zak2016-09-061-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/pager: cleanup and extend APIKarel Zak2016-08-261-1/+4
| | | | | | | | | * clean up function names * add functions to temporary redirect to the pager and then restore original terminal output Signed-off-by: Karel Zak <kzak@redhat.com>
* loopdev: Implememt loopcxt_set_status()Stanislav Brabec2016-08-171-0/+1
| | | | | | | | | | | | Implement stand-alone loopcxt_set_status(). It allows manipulation with some loop device parameters even if it is initialized. Its function is limited by the kernel implementation, and only a small subset of changes is allowed. For more see linux/drivers/block/loop.c:loop_set_status() Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* include/closestream: define exit codesKarel Zak2016-08-161-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/env: minor fixes and clean upsKarel Zak2016-08-161-1/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: always check setenv(3) return valueSami Kerola2016-08-121-1/+1
| | | | | | At least glibc setenv(3) can fail when system runs out of memory. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* pathnames: guard clashing definitions on FreeBSDFranco Fichtner2016-08-111-0/+4
|
* libmount: ignore redundant slashesKarel Zak2016-08-081-1/+1
| | | | | | | | | | | | | | | ///aaa/bbb and /aaa/bbb/ are the same paths. This is important especially with NFS where number of slashes are not the same in the /proc/self/mountinfo and fstab or utab. The regular URI is euler://tmp but /proc contains euler:/tmp Reported-by: Ales Novak <alnovak@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: cleanup sizelimit checkKarel Zak2016-08-041-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Implement loopcxt_check_conflict()Stanislav Brabec2016-08-031-0/+3
| | | | | | | Add a function that searches for a possible conflicting (i. e. overlaying loop device). Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* Add sizelimit to internal APIStanislav Brabec2016-08-031-3/+5
| | | | | | | | | | | | | | Fully safe checks of loop device need to check sizelimit. To prevent need of two nearly equal functions, introduce sizelimit parameter to several internal functions: loopdev_is_used() loopdev_find_by_backing_file() loopcxt_is_used() loopcxt_find_by_backing_file() If sizelimit is zero, fall back to the old behavior (ignoring of sizelimit). Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* libsmartcols: Corrected JSON escapingKarel Zak2016-08-021-0/+80
| | | | | | | | | Based on patch set https://github.com/karelzak/util-linux/pull/331 from Fordi. Addresses: https://github.com/karelzak/util-linux/issues/330 Co-Author: Bryan Elliott <fordiman@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: try to find tty in get_terminal_name()Sami Kerola2016-07-041-1/+1
| | | | | | | | Try all standard terminal input/output file descriptors when finding tty name in get_germinal_name(). This should make all invocations of the function as robust as they can get. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libcommon: add ISO_8601_GMTIME that will print UTC-0 timestampsSami Kerola2016-06-261-1/+2
| | | | | | | When timestamps are intented to be conversable back from string to binary it is best to stick with UTC-0 timezone. This is needed in utmpdump(1). Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/widechar: add fallback for WEOFKarel Zak2016-06-031-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/widechar: add missing fallbacksKarel Zak2016-06-031-2/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: be more smart for non-scsi devicesKarel Zak2016-06-021-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>