libtool-patches
[Top][All Lists]
Advanced

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

Re: libtool man page


From: Ralf Wildenhues
Subject: Re: libtool man page
Date: Sat, 20 Sep 2008 00:40:57 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

* Ralf Wildenhues wrote on Fri, Sep 19, 2008 at 08:59:37PM CEST:
> * Peter O'Gorman wrote on Fri, Sep 19, 2008 at 08:42:38PM CEST:
> > 
> > I have not applied the patch to check, but doesn't this just give a
> > manpage with the default --help output, and no information for the
> > various --mode options?
> 
> Yes.  And AFAICS it even breaks -h (short help) output.  :-/

Proposed addition (to be squashed on top of previous patch, so no need
for more Makefile.am ChangeLog bits).

OK?  Do we need testsuite tests for the various help options, and if
yes, how do I check them sensibly without having to adjust the
comparison pattern constantly?

(One minor nit against the patch is that 'func_help noexit' does not
return any error status that the output may have created.  But it is
late now, no call site of func_help cares so far, and me neither...)

Thanks,
Ralf

        * libltdl/config/getopt.m4sh (func_usage): Work with different
        indentations, but require comment hash in first column, when
        grepping for '-h' in usage to end short help.
        (func_help): Accept optional argument to not exit.
        * libltdl/config/ltmain.m4sh: New argument `--help-all'.
        If given, call func_help and func_mode_help several times,
        beating it in shape with sed.
        (func_mode_help): Do not exit here.

diff --git a/Makefile.am b/Makefile.am
index f261f5f..8570db4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -336,7 +336,7 @@ update_mans = \
   PATH=.$(PATH_SEPARATOR)$$PATH; export PATH; \
   $(HELP2MAN) --output=$@
 $(srcdir)/doc/libtool.1: $(srcdir)/$(auxdir)/ltmain.sh
-       $(update_mans) libtool
+       $(update_mans) --help-option=--help-all libtool
 $(srcdir)/doc/libtoolize.1: $(srcdir)/libtoolize.in
        $(update_mans) libtoolize
 
diff --git a/doc/.gitignore b/doc/.gitignore
index bc21901..5d0e852 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -6,3 +6,4 @@ notes.txt
 *.html
 *.ps
 *.pdf
+*.1
diff --git a/libltdl/config/getopt.m4sh b/libltdl/config/getopt.m4sh
index d9657e1..1348468 100644
--- a/libltdl/config/getopt.m4sh
+++ b/libltdl/config/getopt.m4sh
@@ -48,7 +48,7 @@ func_version ()
 # Echo short help message to standard output and exit.
 func_usage ()
 {
-    $SED -n '/^# Usage:/,/# -h/ {
+    $SED -n '/^# Usage:/,/^#  *-h/ {
         s/^# //
        s/^# *$//
        s/\$progname/'$progname'/
@@ -59,8 +59,9 @@ func_usage ()
     exit $?
 }
 
-# func_help
-# Echo long help message to standard output and exit.
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
 func_help ()
 {
     $SED -n '/^# Usage:/,/# Report bugs to/ {
@@ -77,7 +78,10 @@ func_help ()
        s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
        p
      }' < "$progpath"
-    exit $?
+    ret=$?
+    if test -z "$1"; then
+      exit $ret
+    fi
 }
 
 # func_missing_arg argname
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 29d8d48..0427acf 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -351,6 +351,7 @@ func_enable_tag ()
 
       -\?|-h)          func_usage                                      ;;
       --help)          opt_help=:                                      ;;
+      --help-all)      opt_help=': help-all'                           ;;
       --version)       func_version                                    ;;
 
       -*)              func_fatal_help "unrecognized option \`$opt'"   ;;
@@ -1003,7 +1004,7 @@ compiler."
 }
 
 $opt_help || {
-test "$mode" = compile && func_mode_compile ${1+"$@"}
+  test "$mode" = compile && func_mode_compile ${1+"$@"}
 }
 
 func_mode_help ()
@@ -1183,12 +1184,38 @@ Otherwise, only FILE itself is deleted using RM."
 
     $ECHO
     $ECHO "Try \`$progname --help' for more information about other modes."
-
-    exit $?
 }
 
-  # Now that we've collected a possible --mode arg, show help if necessary
-  $opt_help && func_mode_help
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test "$opt_help" = :; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for mode in compile link execute install uninstall clean; do
+       func_mode_help
+      done
+    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for mode in compile link execute install uninstall clean; do
+       echo
+       func_mode_help
+      done
+    } |
+    sed '1d
+      /^Report/{
+       h
+       d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
 
 
 # func_mode_execute arg...




reply via email to

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