Commit Graph

9 Commits

Author SHA1 Message Date
J William Piggott 9bf13750cb optutils.h: don't print non-graph characters
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>
2017-04-18 22:39:05 -04:00
Sami Kerola fdf8e1f595 include: fix compiler warning
./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>
2017-03-13 14:48:14 +01:00
Karel Zak d947f85df4 include/optutils: fix typo
Reported-by: Rafael Ferreira <rafael.f.f1@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-28 08:39:54 +02:00
Benno Schulenberg 1d23119072 textual: remove some inconsistent periods from error messages
While doing so, also improve translatability and some wordings.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-08-11 14:51:54 +02:00
Karel Zak 2c7bcdf868 include/optutils: make collisions detection between options more robust
- don't rely on the correct ul_excl_t usage
 - don't print --(null) for non-existing long options

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-13 13:04:02 +01:00
Karel Zak f69b4c5b62 include/optutils: remove unnecessary exclusive_option()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 09:27:42 +02:00
Karel Zak 217d20a73c include/optutils: add err_exclusive_options()
This is improved implementation of exclusive_option(). The new
implementation:

  - uses regular struct option to compose error messages
  - relationships between options are described in one const static array
  - the current status is stored in one int array

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 09:22:35 +02:00
Sami Kerola 8f77d454a9 include [optutils]: add exclusive_option() inline function
The exclusive_option() will unify how exclusive options are
determined.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 17:59:58 +02:00
Karel Zak 732a631126 include,optutils: add option_to_longopt()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-29 18:21:49 +01:00