vdso.7: Update CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE info for powerpc
[man-pages.git] / scripts / find_slashes_no_parens.sh
blob086faac070093f925ac854765a512cb6038bc03e
1 #!/bin/sh
3 # find_slashes_no_parens.sh
5 # Look for function names inside \f[BI]...\f[PB] that aren't
6 # followed by "()".
8 # This script is designed to help with "by hand" tidy-ups after
9 # the automated changes made by add_parens_for_own_funcs.sh.
11 # The first argument to this script names a manual page directory where
12 # 'man2' and 'man3' subdirectories can be found. The pages names in
13 # these directories are used to generate a series of regular expressions
14 # that can be used to search the manual page files that are named in
15 # the remaining command-line arguments.
17 # Example usage:
19 # cd man-pages-x.yy
20 # sh find_slashes_no_parens.sh . man?/*.? > matches.log
22 ######################################################################
24 # (C) Copyright 2005 & 2013, Michael Kerrisk
25 # This program is free software; you can redistribute it and/or
26 # modify it under the terms of the GNU General Public License
27 # as published by the Free Software Foundation; either version 2
28 # of the License, or (at your option) any later version.
30 # This program is distributed in the hope that it will be useful,
31 # but WITHOUT ANY WARRANTY; without even the implied warranty of
32 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 # GNU General Public License for more details
34 # (http://www.gnu.org/licenses/gpl-2.0.html).
37 if test $# -lt 2; then
38 echo "Usage: $0 man-page-root-dir file file..." 1>&2
39 exit 1
42 dir=$1
44 if ! test -d $dir/man2 || ! test -d $dir/man3; then
45 echo "Can't find man2 and man3 under $dir" 1>&2
46 exit 1
49 shift 1
51 echo "This will probably take a few minutes..." 1>&2
53 regexp_file=tmp.$0.regexp
54 rm -f $regexp_file
56 # We grep out a few page names that are likely to generate false
57 # positives...
59 for page in $(
61 find $dir/man2/* $dir/man3/* -type f -name '*.[23]' |
62 egrep -v '/(stderr|stdin|stdout|errno|termios|string)\..$'); do
64 base=$(basename $page | sed -e 's/\.[23]$//')
66 echo "\\\\f[BI]$base\\\\f[PB][^(]" >> $regexp_file
67 echo "\\\\f[BI]$base\\\\f[PB]\$" >> $regexp_file
68 done
70 sort -o $regexp_file $regexp_file # Not really needed
72 echo "Built regexp file; now about to grep..." 1>&2
74 grep -f $regexp_file $*
76 rm -f $regexp_file
77 exit 0