summaryrefslogtreecommitdiffstats
path: root/misc-utils
Commit message (Collapse)AuthorAgeFilesLines
* look: slice up the usage text for ease of translationBenno Schulenberg2015-01-061-8/+9
| | | | | | | Also use the standard macros, and correct the synopsis: use angular brackets and show that look accepts multiple files. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: improve some wordings on the man page of wipefsBenno Schulenberg2015-01-061-16/+17
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-0615-0/+51
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* cal: fix signed integer overflow [AddressSanitizer]Sami Kerola2014-12-191-2/+4
| | | | | | | misc-utils/cal.c:811:16: runtime error: signed integer overflow: 2147483645 + 536870911 cannot be represented in type 'int' Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: adjust some formatting and wordings in a handful of man pagesBenno Schulenberg2014-12-195-65/+68
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: adjust the grammar, text, sorting and formatting of logger man pageBenno Schulenberg2014-12-191-142/+116Star
| | | | | | | | | | The message argument is not an option and should not be listed among those. Describe the optional argument of --rfc5424 better. Use the = and no space for optional option arguments. Don't italicize words unnecessarily. Use bold for literal things. And sort the options alphabetically (apart from -V and -h). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: don't use bold or italics for "[option]" in synopsis of man pagesBenno Schulenberg2014-12-1912-20/+25
| | | | | | | As per the convention shown in Documentation/howto-man-page.txt. Also make a few other tiny adjustments along the way. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: improve the sorting of the options in the man page of getoptBenno Schulenberg2014-12-191-9/+9
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: do not start option descriptions with a capitalBenno Schulenberg2014-12-191-14/+14
| | | | | | | This normalizes the help text of getopt, clarifies one description, and also adjust two comments. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* getopt: cleanup add_log_options()Karel Zak2014-12-091-6/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* getopt: rename function to keep code readableKarel Zak2014-12-091-6/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* getopt: fix compiler warningKarel Zak2014-12-091-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* getopt: avoid re-terminating long_option list at every updateSami Kerola2014-12-081-11/+10Star
| | | | | | | | | Terminating the ctl->long_options list once when adding options is completed is enough. This also allows moving ctl->long_options_nr increment to more appropriate location. CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: change --shell argument parsing functionSami Kerola2014-12-081-12/+10Star
| | | | | | | Avoid passing getopt_control stucture in when returning a value is enough. CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: prefer switch-case rather than long if statementSami Kerola2014-12-081-27/+37
| | | | | | | And avoid testing same thing time after time. CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: remove unnecessary codeSami Kerola2014-12-081-9/+1Star
| | | | | | | The control structure is initialized in main(). CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: make normalize() print stringsSami Kerola2014-12-081-14/+12Star
| | | | | | | A change towards less indirection, and a change to free allocated memory. CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: use xstrdup rather than malloc + strcpySami Kerola2014-12-081-12/+5Star
| | | | | CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: add struct getopt_control and remove global variablesSami Kerola2014-12-081-81/+83
| | | | | CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: remove function prototypesSami Kerola2014-12-081-10/+0Star
| | | | | | | | Functions are in right order so they do not need prototypes, with effect of not needing to keep function argument changes in sync in two locations. CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: make nonoptions optstring comment correctSami Kerola2014-12-081-2/+2
| | | | | | | | | | From manual page: 'If the first character of optstring is '-', then each nonoption argv-element is handled as if it were the argument of an option with character code 1.' Reference: http://man7.org/linux/man-pages/man3/getopt.3.html CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* getopt: sync with 1.1.6 releaseSami Kerola2014-12-081-4/+17
| | | | | | Reference: http://www.spinics.net/lists/util-linux-ng/msg10556.html CC: Frodo Looijaard <frodo@frodo.looijaard.name> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lsblk: add SUBSYSTEMS columnKarel Zak2014-12-021-0/+37
| | | | | | | | $ lsblk -oNAME,SIZE,TYPE,SUBSYSTEMS /dev/sr0 NAME SIZE TYPE SUBSYSTEMS sr0 7.8M rom block:scsi:usb:pci Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: add HOTPLUG columnKarel Zak2014-12-021-1/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: care about unsafe chars in cacheKarel Zak2014-11-272-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The high-level libblkid API uses /run/blkid/blkid.tab cache to store probing results. The cache format is <device NAME="value" ...>devname</device> and unfortunately the cache code does not escape quotation marks: # mkfs.ext4 -L 'AAA"BBB' # cat /run/blkid/blkid.tab ... <device ... LABEL="AAA"BBB" ...>/dev/sdb1</device> such string is later incorrectly parsed and blkid(8) returns nonsenses. And for use-cases like # eval $(blkid -o export /dev/sdb1) it's also insecure. Note that mount, udevd and blkid -p are based on low-level libblkid API, it bypass the cache and directly read data from the devices. The current udevd upstream does not depend on blkid(8) output at all, it's directly linked with the library and all unsafe chars are encoded by \x<hex> notation. # mkfs.ext4 -L 'X"`/tmp/foo` "' /dev/sdb1 # udevadm info --export-db | grep LABEL ... E: ID_FS_LABEL=X__/tmp/foo___ E: ID_FS_LABEL_ENC=X\x22\x60\x2ftmp\x2ffoo\x60\x20\x22 Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: add hint about lsblk to the man pageKarel Zak2014-11-191-1/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: Fixed a typo in daemon logging messageNikolay Sivov2014-11-181-1/+1
| | | | Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
* docs: Spelling fixesVille Skyttä2014-11-181-1/+1
| | | | | Signed-off-by: Ville Skyttä <ville.skytta@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: update info about env debug variablesKarel Zak2014-11-035-7/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: document --uniq option in man pageBernhard Voelker2014-10-311-0/+4
| | | | | * misc-utils/findmnt.8: Add an entry for the -U, --uniq option added in commit v2.24-132-gbebdda3.
* docs: spelling, wording, and grammar fixes in the man page of whereisBenno Schulenberg2014-10-311-18/+19
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* include/debug: fix typoKarel Zak2014-10-241-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: remove extra trailing spaces in outputKarel Zak2014-10-231-2/+3
| | | | | | | | | | | | | $ blkid | egrep -i 'sda.*label' | cat -A /dev/sda2: UUID="8382f307-fb43-489f-ab38-8d4cf37ca88c" SEC_TYPE="ext2" TYPE="ext3" LABEL="test" $ /dev/sda5: UUID="0b46d673-8c23-4709-b92c-3fdf460e1dd4" TYPE="ext3" LABEL="rescue" SEC_TYPE="ext2" $ /dev/sda6: UUID="cb9d814f-d885-435b-8e6d-ac17c0ac5aa1" TYPE="ext3" LABEL="root" $ /dev/sda8: UUID="1e2851bd-cc6f-4d72-bf9f-c6fa754155b1" TYPE="ext3" LABEL="data" SEC_TYPE="ext2" $ /dev/sda9: UUID="d16a2f42-9a50-4489-a788-8624c832a7f3" TYPE="ext3" LABEL="storage" SEC_TYPE="ext2" $ /dev/sda7: TYPE="swap" LABEL="swap" UUID="8393acfa-d4bd-40fc-8eb9-5ccd8d85e103" $ Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586179 Signed-off-by: Karel Zak <kzak@redhat.com>
* whereis: reset search mask more carefullyKarel Zak2014-10-232-17/+45
| | | | | | | | | | | | | | | | | | # whereis -m cal -M /usr/share/man/man1/ -f ls cal: /usr/share/man/man1/cal.1.gz /usr/share/man/man1p/cal.1p.gz ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz the -M also resets the search mask, so for 'ls' it returns also binaries. That's bug. Expected result is: # ./whereis -m cal -M /usr/share/man/man1/ -f ls cal: /usr/share/man/man1/cal.1.gz /usr/share/man/man1p/cal.1p.gz ls: /usr/share/man/man1/ls.1.gz the search mask has to be sensitive only to -b -m -s options, otherwise the semantic is pretty messy. Signed-off-by: Karel Zak <kzak@redhat.com>
* whereis: cleanup debug stuff, fix argv[] usageKarel Zak2014-10-231-33/+74
| | | | | | | | | | | | | | | | | | | | * use debug stuff from include/debug.h and make whereis(1) sensitive to WHEREIS_DEBUG=0xffff mask * fix problem with argv[] usage # whereis -b -m -M /usr/share/man/man1 -B /usr/bin -f gcc bin: /usr/local/bin gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz the code ignores "-B" and /usr/bin is interpreted as search pattern, expected result is: # whereis -b -m -M /usr/share/man/man1 -B /usr/bin -f gcc gcc: /usr/share/man/man1/gcc.1.gz /usr/bin/gcc Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765306 Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: fix compiler warningSami Kerola2014-10-011-4/+4
| | | | | | warning: ISO C forbids empty initializer braces [-Wpedantic] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: use usage() text element macrosSami Kerola2014-10-016-20/+15Star
| | | | | | | Translating these text elements should happen only once, which is more likely when the text macros are used properly. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: use manual tail usage() macroSami Kerola2014-10-015-2/+5
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: gettimeofday needs <sys/time.h>Andreas Henriksson2014-09-221-1/+1
| | | | | | | | | Either works on linux, but kfreebsd build fails if we don't use the <sys/time.h> include. According to man gettimeofday the correct include is <sys/time.h> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* cal: `color` option documentation should match actual behaviourEugene Yunak2014-09-211-1/+1
|
* lsblk: add notes about udev to the man pageKarel Zak2014-09-051-2/+13
| | | | | Reported-by: Francis Moreau <francis.moro@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: use generic --id=<id>Karel Zak2014-08-202-35/+17Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: mentintion default udp and tcp ports logger is usingSami Kerola2014-08-151-0/+7
| | | | | | | | The fact that 'syslog tcp/514' does not exist in RFS's, which has lead to 'syslog-conn 601/tcp' be used in place could be a suprice and should be told in manual. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: set function arguments read-only when possibleSami Kerola2014-08-151-9/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: optimize string initializationsSami Kerola2014-08-151-2/+4
| | | | | | | Setting whole array to be completely full of nulls cannot be as quick as making the only significant member of the array when needed. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: remove openlog(3) optionsSami Kerola2014-08-151-8/+8
| | | | | | | One variable less, and more importantly bit operations become unnecessary in if statements. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: allow use of --id=ppid when logging locallySami Kerola2014-08-151-11/+27
| | | | | | | | | | | There is no obvious way to make syslog(3) to print both pid or ppid, so duplicate the libc syslog() to logger. Making the ppid printing work using unix socket has side effect of local becoming capable to use both rfc format output, which is hopefully seen as good thing. The syslog_local() is format wise one-to-one copy with glibc syslog(3) format. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: remove some inconsistent periods from error messagesBenno Schulenberg2014-08-113-4/+4
| | | | | | While doing so, also improve translatability and some wordings. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: sort the options in the man pages of hwclock and uuiddBenno Schulenberg2014-07-291-26/+26
| | | | | | Also improve the formatting a bit. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* logger: fix untranslated messageKarel Zak2014-07-291-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>