Commit Graph

28 Commits

Author SHA1 Message Date
Karel Zak c9eea1b354 ipcs: check errno after strto..()
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:20:20 +02:00
Sami Kerola 364de8f4f5 lib/randutils: rename random_get_bytes()
Rename random_get_bytes() to avoid colliding a Solaris library function that
has the same name.

Reported-by: Sad Clouds <cryintothebluesky@gmail.com>
Reference: https://lore.kernel.org/util-linux/20201101141608.ba365cf67d92ee3973226de9@gmail.com/
Reference: https://blogs.oracle.com/solaris/solaris-random-number-generation-v2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-11-03 12:38:45 +01:00
Karel Zak f1970cc557 docs: improve size arguments description in --help output
Let's add "Arguments:" section to the --help output and describe
{K,M,G...}iB suffixes there.

Addresses: https://github.com/karelzak/util-linux/pull/917
Co-Author: ed <ed@s5h.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-05 11:01:36 +01:00
Karel Zak 2c308875a7 misc: consolidate version printing and close_stdout()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 15:14:13 +02:00
Ruediger Meier f45f3ec34a misc: consolidate macro style USAGE_HELP_OPTIONS
changed in include/c.h and applied via sed:

  sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
  sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-29 16:54:33 +02:00
Ruediger Meier b1a294c448 misc: introduce print_usage_help_options()
Consolidate --help and --version descriptions. We are
now able to align them to the other options.

We changed include/c.h. The rest of this patch was
generated by sed, plus manually setting the right
alignment numbers. We do not change anything but
white spaces in the --help output.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 12:26:19 +02:00
Ruediger Meier 6e1eda6f22 misc: never use usage(stderr)
Here we fix all cases where we have usage(FILE*)
functions.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Karel Zak 677ec86cef Use --help suggestion on invalid option
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>
2016-12-19 13:13:34 +01:00
Karel Zak 79f4c272cf ipcmk: support <size>{K,M,G,...}
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-07-20 12:05:32 +02:00
Benno Schulenberg 7009af0e0d ipc*: use customary fputs() instead of fprintf() with the usage macros
Also use the clearer word <number> with the --semaphore option.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:50:18 +01:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
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>
2015-01-06 11:27:38 +01:00
Karel Zak 96f6ad889b ipcmk: use random_get_bytes() to generate IPC keys
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-24 16:27:04 +01:00
Karel Zak d918c13c4c ipcmk: fix compiler warning [-Wmissing-prototypes]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-16 18:49:36 +02:00
Karel Zak 20a3998222 sys-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:45:17 +02:00
Sami Kerola efb8854f4c sys-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:49:40 +02:00
Sami Kerola 7cebf0bb4f docs: corrections to FSF license files, and postal address
The COPYING and Documentation/licenses/COPYING* files are being
replaced by files from GNU web site.

http://www.gnu.org/licenses/gpl-2.0.txt
http://www.gnu.org/licenses/lgpl-2.1.txt

Postal addresses to FSF in other files are updated to match with the
address in license files.

Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-24 14:13:35 +01:00
Sami Kerola 6f162034d0 build-sys: fixes to USAGE_* macros
The USAGE_BEGIN_TAIL is removed as unnecessary.

In between command specific options and --help & --version
USAGE_SEPARATOR is inserted. For now the separator is empty line.

The USAGE_MAN_TAIL is changed to take an argument.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-17 15:07:52 +02:00
Sami Kerola b332ef44cf ipcmk: allow high speed ipc creation
This commit will allow user to create quickly plenty of ipc
resources. Earlier the line bellow gave no satisfaction.

for i in $(seq 0 42); do ipcmk -Q; done

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-17 15:07:52 +02:00
Sami Kerola c20b68231c ipcmk: include-what-you-use header check
Three removes & a sort to alphabetical order.

ipcmk.c should remove these lines:
- #include <string.h>  // lines 24-24
- #include <sys/types.h>  // lines 30-30
- #include <unistd.h>  // lines 29-29

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-12 21:27:07 +02:00
Sami Kerola 0eeec4152a ipcmk: remove camel casing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-12 21:27:07 +02:00
Sami Kerola c821a1256b ipcmk: validate numeric option arguments
Use strtoul_or_err() instead of atoi().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-12 21:27:07 +02:00
Sami Kerola f5b0684e34 ipcmk: remove useless code
Checking same return value twice does not make command any
better. Secondly the program_invocation_short_name is known to
work, so global progname variable does not add anything extra.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-12 21:27:06 +02:00
Sami Kerola 003f497604 ipcmk: add long options & fix usage()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-12 21:26:56 +02:00
Karel Zak fe931e05bc ipcmk: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:34:42 +02:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
Solaris lacks err, errx, warn and warnx.  This also means the err.h header
doesn't exist.  Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-02-14 17:45:24 +01:00
Karel Zak f635c336c4 ipcmk: add NLS support
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-09-10 16:03:43 +02:00
Karel Zak cc41c0a33e ipcmk: fix error codes and error messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-09-10 16:00:17 +02:00
Hayden James 1b3f133043 ipcmk: new command
Small patch to create an application that can easily create ad-hoc ipc
resources, along with man page.

[kzak@redhat.com: - rename from ipccreat to ipcmk
                  - minor coding style changes]

Signed-off-by: Hayden James <hayden.james@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-09-10 15:36:50 +02:00