csplit accepts a new option: --suppressed-matched, to elide the lines
used to identify the split points.
+** Changes in behavior
+
+ stdbuf now requires at least one buffering mode option to be specified,
+ as per the documented interface.
+
** Improvements
stat and tail work better with EFIVARFS, EXOFS, F2FS, SNFS and UBIFS.
}
}
-/* Populate environ with _STDBUF_I=$MODE _STDBUF_O=$MODE _STDBUF_E=$MODE */
+/* Populate environ with _STDBUF_I=$MODE _STDBUF_O=$MODE _STDBUF_E=$MODE.
+ Return TRUE if any environment variables set. */
-static void
+static bool
set_libstdbuf_options (void)
{
- unsigned int i;
+ bool env_set = false;
+ size_t i;
for (i = 0; i < ARRAY_CARDINALITY (stdbuf); i++)
{
_("failed to update the environment with %s"),
quote (var));
}
+
+ env_set = true;
}
}
+
+ return env_set;
}
int
usage (EXIT_CANCELED);
}
- /* FIXME: Should we mandate at least one option? */
-
- set_libstdbuf_options ();
+ if (! set_libstdbuf_options ())
+ {
+ error (0, 0, _("you must specify a buffering mode option"));
+ usage (EXIT_CANCELED);
+ }
/* Try to preload libstdbuf first from the same path as
stdbuf is running from. */
test $? = 125 || fail=1
stdbuf -iL true # line buffering stdin disallowed
test $? = 125 || fail=1
+stdbuf true # a buffering mode must be specified
+test $? = 125 || fail=1
stdbuf -i0 -o0 -e0 true || fail=1 #check all files
stdbuf -o1 . # invalid command
test $? = 126 || fail=1