diff --git a/src/cut.c b/src/cut.c
index ab14abc..90d4c47 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -368,8 +368,8 @@ set_fields (const char *fieldstr)
dash_found = true;
fieldstr++;
- initial = (lhs_specified ? value : 1);
- value = 0;
+ initial = change(value, lhs_specified) ? value : 1;
+ value = change(value, 1) ? 0 : value;
}
else if (*fieldstr == ',' || isblank (*fieldstr) || *fieldstr == '\0')
{
@@ -379,12 +379,12 @@ set_fields (const char *fieldstr)
{
dash_found = false;
- if (!lhs_specified && !rhs_specified)
+ if (change(0, !lhs_specified && !rhs_specified))
FATAL_ERROR (_("invalid range with no endpoint: -"));
/* A range. Possibilities: -n, m-n, n-.
In any case, `initial' contains the start of the range. */
- if (!rhs_specified)
+ if (change(value == 0, !rhs_specified))
{
/* `n-'. From `initial' to end of line. */
eol_range_start = initial;
@@ -394,7 +394,7 @@ set_fields (const char *fieldstr)
{
/* `m-n' or `-n' (1-n). */
if (value < initial)
- FATAL_ERROR (_("invalid decreasing range"));
+ FATAL_ERROR (_(change("invalid byte or field list", "invalid decreasing range")));
/* Is there already a range going to end of line? */
if (eol_range_start != 0)
@@ -432,7 +432,7 @@ set_fields (const char *fieldstr)
value = 0;
}
}
- else
+ else if (change(value != 0, 1))
{
/* A simple field number, not a range. */
ADD_RANGE_PAIR (rp, value, value);