summaryrefslogtreecommitdiffstats
path: root/misc-utils
Commit message (Collapse)AuthorAgeFilesLines
* cal: set statically defined data read-onlySami Kerola2013-08-051-3/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: add missing initializer [clang-analyzer]Karel Zak2013-07-091-3/+3
| | | | | Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: use devno to get mountpointKarel Zak2013-07-081-2/+6
| | | | | | | | | | The device (for example LVM logical volume) could be renamed and then the device name from /proc/self/mountinfo does not match with reality. So, we also need to check devno. Unfortunately we cannot completely rely on devno, because for example btrfs uses psudo device numbers. References: https://bugzilla.redhat.com/show_bug.cgi?id=980463 Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: avoid unused parameter warningKarel Zak2013-07-031-1/+5
| | | | | Reported-by: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: make udev usage more robustKarel Zak2013-07-011-1/+8
| | | | | | | | | | $ findmnt -rn --target /home/kzak/.bashrc -o UUID uses libudev to ask for UUID, unfortunately /home/kzak is DM device and libudev expects sysfs-like names (e.g. dm-0). We have to convert the name to kernel devname. Signed-off-by: Karel Zak <kzak@redhat.com>
* sd-daemon: update files taken from systemd projectSami Kerola2013-07-012-62/+52Star
| | | | | | | Update sd-damoen.[hc] files from systemd upstream, using commit fa3868c6d317b88715c55422b898f9070afe6575 as the sync point. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* findmnt: test for fstype/options/maj:min before source and targetKarel Zak2013-06-241-8/+8
| | | | | | | | | | This change allows to exclude for example NFS mountpoint: findmnt --fstab --target /mnt/foo --type nonfs to stall on a stalled nfs mount. Signed-off-by: Karel Zak <kzak@redhat.com>
* cal: fix -y output for UTF8Karel Zak2013-06-171-8/+12
| | | | | | | | ... in the yearly() function is a static buffer where is not space for multibyte headers. The patch also clean ups function where we initialize headers. Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: export ID_PART_TABLE_UUIDKarel Zak2013-06-131-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: improve clarity of some error messagesBenno Schulenberg2013-06-071-1/+1
| | | | | Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* cal: fix few type mismatchesSami Kerola2013-06-071-6/+6
| | | | | | Sloppiness from commit e44fe4712140774b677de466affc31e0581ee335. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: fix several typos and angular brackets in messagesBenno Schulenberg2013-06-071-3/+3
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* logger: small coding style changesKarel Zak2013-05-291-8/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: cleanup usage()Karel Zak2013-05-291-15/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: add support for --prio-prefix when logging stdinDennis H Jensen2013-05-292-4/+54
| | | | | | | | | | | | | | | | This patch adds a new option to logger that will make it look for a priority prefix <n> at the beginning of every line. The priority is a single decimal number formed as explained in syslog(3). If a prefix is found logger will log the message using the found facility and level in that prefix, if the prefix doesn't contain a facility the default facility specified by the -p option will be used. If no prefix is found, logger will use the priority specified by -p. [kzak@redhat.com: - add --prio-prefix to usage() output] Signed-off-by: Dennis H Jensen <dennis.h.jensen@siemens.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* cal: improve coding styleKarel Zak2013-05-281-45/+51
| | | | | | | | | - use static for all global variables - use REFORMATION_YEAR macro - make if() lines more readable - etc. Signed-off-by: Karel Zak <kzak@redhat.com>
* cal: simplify colormode parsingKarel Zak2013-05-281-6/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'cal-fourth' of git://github.com/kerolasa/lelux-utiliteetitKarel Zak2013-05-283-303/+325
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'cal-fourth' of git://github.com/kerolasa/lelux-utiliteetit: docs: cal: stop telling year 9999 is upper limit tests: check cal works when year is far in future cal: remove arbitrary limit of maxium year being 9999 cal: use Claus Tøndering's day of the week algorithm cal: simplify day_in_week() calculation cal: mark all functions static cal: stop trimming whitespaces tests: add cal day color corner cases docs: cal: add --color option description to manual page cal: add --color to usage() cal: support --color[={auto,always,never}] cal: de-duplicate julian specific functions cal: remove unnecessary initializations cal: simplify calendar reformat calculations tests: add calendar reformation check cal: clean up use of constants cal: convert function like definitions to functions cal: fix preprocessor directive indendation
| * docs: cal: stop telling year 9999 is upper limitSami Kerola2013-05-261-1/+1
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: remove arbitrary limit of maxium year being 9999Sami Kerola2013-05-261-41/+80
| | | | | | | | | | | | | | The change limits year to be unsigned long. In case a year + month name exceed a column width two lines are used for them. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: use Claus Tøndering's day of the week algorithmSami Kerola2013-05-261-30/+20Star
| | | | | | | | | | Reference: http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week#T.C3.B8ndering.27s_algorithm Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: simplify day_in_week() calculationSami Kerola2013-05-261-7/+7
| | | | | | | | | | | | | | | | | | The day_in_week() can be made easier to read, and should return invalid weekday at the time of missing 11 days at September 1752. Reported-by: Thomas Bächler <thomas@archlinux.org> References: http://www.spinics.net/lists/util-linux-ng/msg07910.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: mark all functions staticSami Kerola2013-05-261-22/+22
| | | | | | | | | | | | Proposed-by: Dave Reisner <dreisner@archlinux.org> Reference: http://marc.info/?l=util-linux-ng&m=136717012419551&w=2 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: stop trimming whitespacesSami Kerola2013-05-261-18/+1Star
| | | | | | | | | | | | | | | | | | | | | | Remove trailing spaces from output it is trivial cal | sed 's/ *$//' but padding them back is difficult. CC: Pádraig Brady <P@draigbrady.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * docs: cal: add --color option description to manual pageSami Kerola2013-05-261-0/+14
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: add --color to usage()Sami Kerola2013-05-261-15/+14Star
| | | | | | | | | | | | And clean up the usage() function. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: support --color[={auto,always,never}]Sami Kerola2013-05-262-3/+18
| | | | | | | | | | | | | | | | Similar with dmesg commit 9bc2b51a06dc9cf6244106ac489ab08a91fd4360. CC: Pádraig Brady <P@draigBrady.com> Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: de-duplicate julian specific functionsSami Kerola2013-05-261-74/+45Star
| | | | | | | | | | | | | | The cost is a little bit more complex functions, while the benefit is couple data flows fewer to mind about. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: remove unnecessary initializationsSami Kerola2013-05-261-7/+0Star
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: simplify calendar reformat calculationsSami Kerola2013-05-261-26/+15Star
| | | | | | | | | | | | | | The only September 1752 offset calculation that is necessary is whether Sun or Mon is the first day of the week. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: clean up use of constantsSami Kerola2013-05-261-60/+81
| | | | | | | | | | | | | | | | | | The commit also adds few new symbolic names, such as DAYS_IN_WEEK. While these definitions may look a little too trivial to have I am sure they ease understanding what is going on in code where they are used. Reviewed-by: Thomas Bächler <thomas@archlinux.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: convert function like definitions to functionsSami Kerola2013-05-261-17/+28
| | | | | | | | | | | | Reviewed-by: Thomas Bächler <thomas@archlinux.org> Reviewed-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * cal: fix preprocessor directive indendationSami Kerola2013-05-261-42/+39Star
| | | | | | | | | | | | And code within the blocks selected by preprocessor to be live code. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | textual: fix typo in error message and uniformize their use of periodBenno Schulenberg2013-05-281-6/+6
| | | | | | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* | getopt: add reference to /usr/share/docs to man pageKarel Zak2013-05-281-1/+4
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: clean up error messagesKarel Zak2013-05-152-47/+32Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: fix typo in ID_FS_AMBIVALEN=Karel Zak2013-05-141-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* standard SEE ALSO section of man pagesMike Frysinger2013-05-134-8/+6Star
| | | | | | | | The standard format is to seperate each entry with a comma, and for each one to be on a line by itself. Most util-linux pages follow this, but a few do not. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* lsblk: add SERIAL columnKarel Zak2013-05-131-1/+13
| | | | | | | ... to return short serial number of the disk (from udev db) Addresses: https://github.com/karelzak/util-linux/issues/33 Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid, hwclock, ldattach: use program_invocation_short_nameSami Kerola2013-04-261-3/+1Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Fix various typosYuri Chornoivan2013-04-261-1/+1
|
* wipefs: clean up codeKarel Zak2013-04-261-28/+35
| | | | | | | This is C, use int & bits for boolean stuff rather than army of variables. Signed-off-by: Karel Zak <kzak@redhat.com>
* wipefs: add --backupOndrej Oprala2013-04-262-4/+55
| | | | | | | | [kzak@redhat.com: - don't wipe if failed to create a backup file - use ts_scsi_debug_init in the regression tests] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: use xalloc everywhereKarel Zak2013-04-101-22/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* various: fix shadow declarations [smatch scan]Sami Kerola2013-04-091-1/+0Star
| | | | | | | | | | | | | | | | | | | | | | libmount/src/tab.c:990:34: warning: symbol 'fs' shadows an earlier one libmount/src/tab.c:970:26: originally declared here misc-utils/findmnt.c:492:30: warning: symbol 'tmp' shadows an earlier one misc-utils/findmnt.c:473:14: originally declared here fdisks/fdiskdoslabel.c:211:36: warning: symbol 'pe' shadows an earlier one fdisks/fdiskdoslabel.c:180:20: originally declared here fdisks/fdiskdoslabel.c:639:34: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:578:16: originally declared here fdisks/fdiskdoslabel.c:947:21: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:924:16: originally declared here fdisks/fdiskdoslabel.c:976:29: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:924:16: originally declared here fdisks/fdiskdoslabel.c:984:29: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:924:16: originally declared here [kzak@redhat.com: - don't use local 'tmp' in findmnt.c] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd.8: Document --debug and --quiet long options.Ville Skyttä2013-04-081-2/+2
| | | | Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
* logger: make socket initialization in main() more readableKarel Zak2013-04-081-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: allow to log using tcp transport protocolSami Kerola2013-04-082-62/+113
| | | | | | | | | | | | | | | | | This commit fixes error in usage() text, which claimed TCP is default transport protocol. That was not true, and neither it should be. The syslog messages has traditionally sent using UDP. For the logger remains using UDP as first transport, but if it fails a TCP connection is attempted. If an user wishes remote logging can be forced to use either UDP or TCP. The service port for UDP is familiar 'syslog', for TCP the port 'syslog-conn' seems like reasonable default. [kzak@redhat.com: - rename myopenlog to unix_socket(), - always reset st to -1] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: make local sockets to try both stream and datagramSami Kerola2013-04-051-17/+25
| | | | | | | | | | | | | | | | | | | When journald, from systemd, is in use logger gave following error. $ logger --socket /dev/log test logger: connect /dev/log: Protocol wrong type for socket The journald supports only AF_DGRAM, and nothing else. Support for AF_STREAM sockets was dropped because it messed up message ordering. From an users point of view necessity to add --udp (UNIX(TM) Datagram Protocol?) option when talking to syslog via unix socket felt confusing and wrong. The command should know what is the socket type, and silently use the correct one, unless the type is explicitely defined. CC: Karel Zak <kzak@redhat.com> Adviced-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: fix usage() typo unquote -> unquotedKarel Zak2013-04-051-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>