summaryrefslogtreecommitdiff
path: root/lib/am/mans.am
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-03-07 01:06:18 +0100
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>2009-03-07 01:07:09 +0100
commitb34573760e626b558a59ea30f8ab58b76b43082a (patch)
tree2effaf80f9dd8002e8d9f8b19becd2b0dee22474 /lib/am/mans.am
parent32defaf039f2ee42cca07d079412f4e554f461b5 (diff)
downloadautomake-b34573760e626b558a59ea30f8ab58b76b43082a.tar.gz
Extract correct man section from files in man_MANS.
* lib/am/mans.am: Extract correct man section in the presence of multiple dots in the file base name and/or directory components. * tests/man5.test: New test case. * tests/Makefile.am: Update. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Diffstat (limited to 'lib/am/mans.am')
-rw-r--r--lib/am/mans.am30
1 files changed, 13 insertions, 17 deletions
diff --git a/lib/am/mans.am b/lib/am/mans.am
index 803a89227..d3891451f 100644
--- a/lib/am/mans.am
+++ b/lib/am/mans.am
@@ -1,5 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1998, 2001, 2003, 2004, 2006, 2008 Free Software
+## Copyright (C) 1998, 2001, 2003, 2004, 2006, 2008, 2009 Free Software
## Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
@@ -38,10 +38,9 @@ if %?NOTRANS_MANS%
{ for i in $$list; do echo "$$i"; done; \
## Extract all items from notrans_man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
-?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; for i in $$l2; do \
-## Accept files like `foo.1c'.
-?HAVE_NOTRANS? case $$i in *.%SECTION%*) echo "$$i";; esac; \
-?HAVE_NOTRANS? done; \
+?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
+## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'.
+?HAVE_NOTRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \
## Extract basename of manpage, change the extension if needed.
} | while read p; do \
## Find the file.
@@ -71,10 +70,9 @@ if %?TRANS_MANS%
{ for i in $$list; do echo "$$i"; done; \
## Extract all items from notrans_man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
-?HAVE_TRANS? l2='%TRANS_LIST%'; for i in $$l2; do \
-## Accept files like `foo.1c'.
-?HAVE_TRANS? case $$i in *.%SECTION%*) echo "$$i";; esac; \
-?HAVE_TRANS? done; \
+?HAVE_TRANS? l2='%TRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
+## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'.
+?HAVE_TRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \
## Extract basename of manpage, change the extension if needed.
} | while read p; do \
## Find the file.
@@ -116,10 +114,9 @@ if %?NOTRANS_MANS%
files=`{ for i in $$list; do echo "$$i"; done; \
## Extract all items from notrans_man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
-?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; for i in $$l2; do \
-## Accept files like `foo.1c'.
-?HAVE_NOTRANS? case $$i in *.%SECTION%*) echo "$$i";; esac; \
-?HAVE_NOTRANS? done; \
+?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
+## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'.
+?HAVE_NOTRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \
## Extract basename of manpage, change the extension if needed.
} | sed 's,.*/,,;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,'`; \
test -n "$$files" || exit 0; \
@@ -132,10 +129,9 @@ if %?TRANS_MANS%
files=`{ for i in $$list; do echo "$$i"; done; \
## Extract all items from man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
-?HAVE_TRANS? l2='%TRANS_LIST%'; for i in $$l2; do \
-## Accept files like `foo.1c'.
-?HAVE_TRANS? case $$i in *.%SECTION%*) echo "$$i";; esac; \
-?HAVE_TRANS? done; \
+?HAVE_TRANS? l2='%TRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
+## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'.
+?HAVE_TRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \
## Extract basename of manpage, run it through the program rename
## transform, and change the extension if needed.
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^%SECTION%][0-9a-z]*$$,%SECTION%,;x' \