]> err.no Git - moreutils/commitdiff
ifne: If no command is specified, print usage information.
authorJoey Hess <joey@kodama.kitenet.net>
Mon, 12 May 2008 20:04:36 +0000 (16:04 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Mon, 12 May 2008 20:04:36 +0000 (16:04 -0400)
debian/changelog
ifne.c
ifne.docbook

index e617044f2a3dc020ec68255ba6e4b69db5331780..6e7b813cee3005752798edab6c19ed95de5c1254 100644 (file)
@@ -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 <joeyh@debian.org>  Sat, 26 Apr 2008 19:23:10 -0400
 
diff --git a/ifne.c b/ifne.c
index a7abd21f18fae0d856226e8259c64165008876c7..d8ecea9b8bc416154533572e1ce85a0385b7af10 100644 (file)
--- 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")) {
index 38e38897c780935e426eb3d1bc1ddb0479aae3a3..41fa9abe7a23b63f5afd110dcd0b3f78b0e4c531 100644 (file)
@@ -67,6 +67,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
                                <term><option>-n</option></term>
                                <listitem>
                                        <para>Reverse operation. Run the command if the standard input is empty.</para>
+                                       <para>Note that if the standard input is not empty, it is passed through ifne
+                                       in this case.</para>
                                </listitem>
                        </varlistentry>
                </variablelist>