]> git.ipfire.org Git - thirdparty/man-pages.git/blame - scripts/FIXME_list.sh
nextafter.3: Since glibc 2.23, these functions do set errno
[thirdparty/man-pages.git] / scripts / FIXME_list.sh
CommitLineData
d7ad251c 1#!/bin/sh
87b8bb4e 2#
565495b1 3# FIXME_list.sh
d7ad251c
MK
4#
5# Display FIXME segments from man-pages source files
6#
404b6a03
MK
7# (C) Copyright 2007 & 2013, Michael Kerrisk
8# This program is free software; you can redistribute it and/or
9# modify it under the terms of the GNU General Public License
10# as published by the Free Software Foundation; either version 2
11# of the License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details
17# (http://www.gnu.org/licenses/gpl-2.0.html).
18#
19######################################################################
20#
21# (C) Copyright 2006 & 2013, Michael Kerrisk
22# This program is free software; you can redistribute it and/or
23# modify it under the terms of the GNU General Public License
24# as published by the Free Software Foundation; either version 2
25# of the License, or (at your option) any later version.
26#
27# This program is distributed in the hope that it will be useful,
28# but WITHOUT ANY WARRANTY; without even the implied warranty of
29# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30# GNU General Public License for more details
31# (http://www.gnu.org/licenses/gpl-2.0.html).
32#
33#
d7ad251c
MK
34
35show_all="n"
36while getopts "a" optname; do
37 case "$optname" in
38
39 a) # "all"
40 # Even show FIXMEs that aren't generally interesting. (Typically
41 # these FIXMEs are notes to the maintainer to reverify something
42 # at a future date.)
43
44 show_all="y"
45 ;;
46
47 *) echo "Unknown option: $OPTARG"
48 exit 1
49 ;;
50
51 esac
52done
53
3511dcdb 54shift $(( $OPTIND - 1 ))
d7ad251c
MK
55
56if test $# -eq 0; then
d6201831 57 echo "Usage: $0 [-a] pathname..." 1>&2
d7ad251c
MK
58 exit 1;
59fi
3511dcdb
MK
60
61for dir in "$@"; do
4fef468e
MK
62 for page in $(find "$dir" -type f -name '*.[1-9]' \
63 -exec grep -l FIXME {} \; | sort)
64 do
65 cat "$page" | awk -v SHOW_ALL=$show_all -v PAGE_NAME="$page" \
66 '
67 BEGIN {
68 page_FIXME_cnt = 0;
69 }
70
71 /FIXME/ {
72
73 # /.\" FIXME . / ==> do not display this FIXME, unless
74 # -a command-line option was supplied
75
f99f8b42
MK
76 if ($0 ~ /^\.\\\" FIXME \./ )
77 FIXME_type = "hidden"
78 else if ($0 ~ /^\.\\\" FIXME *\?/ )
79 FIXME_type = "question"
80 else
81 FIXME_type = "normal";
82 if (FIXME_type == "normal" || SHOW_ALL == "y") {
4fef468e
MK
83 if (page_FIXME_cnt == 0) {
84 print "==========";
85 print PAGE_NAME;
86 }
87 page_FIXME_cnt++;
d7ad251c 88
4fef468e
MK
89 finished = 0;
90 do {
91 print $0;
92
93 # Implicit end of FIXME is end-of-file or a line
94 # that is not a comment
d7ad251c 95
4fef468e
MK
96 if (getline == 0)
97 finished = 1;
d7ad251c 98
4fef468e
MK
99 if (!($0 ~ /^.\\\"/))
100 finished = 1;
101
102 # /.\" .$/ ==> Explicit end of FIXME
103
104 if ($0 ~ /^.\\\" \.$/)
105 finished = 1;
106 } while (!finished);
107
108 print "";
109 }
110 }
111 '
112 done | sed -e 's/^\.\\"/ /' | sed -e 's/ *$//' | cat -s
113done