texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6159] accept output of man if it is long enough


From: Gavin D. Smith
Subject: [6159] accept output of man if it is long enough
Date: Thu, 26 Feb 2015 18:24:20 +0000

Revision: 6159
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6159
Author:   gavin
Date:     2015-02-26 18:24:19 +0000 (Thu, 26 Feb 2015)
Log Message:
-----------
accept output of man if it is long enough

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/man.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-02-26 15:56:42 UTC (rev 6158)
+++ trunk/ChangeLog     2015-02-26 18:24:19 UTC (rev 6159)
@@ -5,6 +5,11 @@
 
 2015-02-26  Gavin Smith  <address@hidden>
 
+       * info/man.c (get_manpage_from_formatter): Accept output of 
+       "man" despite a failing exit status if it is long enough.
+
+2015-02-26  Gavin Smith  <address@hidden>
+
        * info/session.c (display_startup_message): Startup message 
        changed.  Note added for translators.
        * po/Makevars (XGETTEXT_OPTIONS): Add -cTRANSLATORS flag.

Modified: trunk/info/man.c
===================================================================
--- trunk/info/man.c    2015-02-26 15:56:42 UTC (rev 6158)
+++ trunk/info/man.c    2015-02-26 18:24:19 UTC (rev 6159)
@@ -392,16 +392,32 @@
   }
 #endif /* !PIPE_USE_FORK */
 
+  if (!formatted_page)
+    return 0;
+
   if (formatter_status != 0) /* Check for failure. */
     {
-      if (formatted_page)
-        free (formatted_page);
-      return NULL;
+      int i;
+      char *p;
+      /* It is possible for "man -a" to output a man page and still to exit 
+         with a non-zero status.  This was found to happen when duplicate man 
+         pages were found.  Hence, still treat it as a success if more than 
+         three lines were output.  (A small amount of output could be error 
+         messages that were sent to standard output.) */
+      p = formatted_page;
+      for (i = 0; i < 3; i++)
+        {
+          p = strchr (p, '\n');
+          if (!p)
+            {
+              free (formatted_page);
+              return NULL;
+            }
+        }
     }
 
   /* If we have the page, then clean it up. */
-  if (formatted_page)
-    clean_manpage (formatted_page);
+  clean_manpage (formatted_page);
 
   return formatted_page;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]