key->next = NULL;
}
+/* Report a bad field specification SPEC, with extra info MSGID. */
+
+static void badfieldspec (char const *, char const *)
+ ATTRIBUTE_NORETURN;
+static void
+badfieldspec (char const *spec, char const *msgid)
+{
+ error (SORT_FAILURE, 0, _("%s: invalid field specification %s"),
+ _(msgid), quote (spec));
+ abort ();
+}
+
+/* Report incompatible options. */
+
+static void incompatible_options (char const *) ATTRIBUTE_NORETURN;
+static void
+incompatible_options (char const *opts)
+{
+ error (SORT_FAILURE, 0, _("options `-%s' are incompatible"), opts);
+ abort ();
+}
+
/* Check compatibility of ordering options. */
static void
if (key->random)
*p++ = 'R';
*p = '\0';
- error (SORT_FAILURE, 0, _("options `-%s' are incompatible"), opts);
+ incompatible_options (opts);
}
}
-/* Report a bad field specification SPEC, with extra info MSGID. */
-
-static void badfieldspec (char const *, char const *)
- ATTRIBUTE_NORETURN;
-static void
-badfieldspec (char const *spec, char const *msgid)
-{
- error (SORT_FAILURE, 0, _("%s: invalid field specification %s"),
- _(msgid), quote (spec));
- abort ();
-}
-
/* Parse the leading integer in STRING and store the resulting value
(which must fit into size_t) into *VAL. Return the address of the
suffix after the integer. If MSGID is NULL, return NULL after
if (checkonly)
{
if (nfiles > 1)
- {
- error (0, 0, _("extra operand %s not allowed with -c"),
- quote (files[1]));
- usage (SORT_FAILURE);
- }
+ error (SORT_FAILURE, 0, _("extra operand %s not allowed with -c"),
+ quote (files[1]));
+
+ if (outfile)
+ incompatible_options ("co");
/* POSIX requires that sort return 1 IFF invoked with -c and the
input is not properly sorted. */