From: Joey Hess Date: Mon, 12 May 2008 20:04:36 +0000 (-0400) Subject: ifne: If no command is specified, print usage information. X-Git-Tag: 0.30~1 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99e7bc2550ca8fc57af19410e28958e46a2d6f15;p=moreutils ifne: If no command is specified, print usage information. --- diff --git a/debian/changelog b/debian/changelog index e617044..6e7b813 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ moreutils (0.30) UNRELEASED; urgency=low * debhelper v7; rules file minimisation * Use DESTDIR instead of PREFIX. * Add a DOCBOOK2XMAN setting. (Greg KH) + * ifne: Add -n which makes it run the command if stdin is empty. + * ifne: If no command is specified, print usage information. -- Joey Hess Sat, 26 Apr 2008 19:23:10 -0400 diff --git a/ifne.c b/ifne.c index a7abd21..d8ecea9 100644 --- a/ifne.c +++ b/ifne.c @@ -50,8 +50,8 @@ int main(int argc, char **argv) { FILE *outf; if ((argc < 2) || ((argc == 2) && streq(argv[1], "-n"))) { - /* Noop */ - return EXIT_SUCCESS; + fprintf(stderr, "Usage: ifne [-n] command [args]\n"); + return EXIT_FAILURE; } if (streq(argv[1], "-n")) { diff --git a/ifne.docbook b/ifne.docbook index 38e3889..41fa9ab 100644 --- a/ifne.docbook +++ b/ifne.docbook @@ -67,6 +67,8 @@ with this program; if not, write to the Free Software Foundation, Inc., Reverse operation. Run the command if the standard input is empty. + Note that if the standard input is not empty, it is passed through ifne + in this case.