_exit.2: Clarify the distinction between the raw syscall and the wrapper function
[man-pages.git] / scripts / find_dots_no_parens.sh
blob79d1c321cbaf03e891e456b27a422c8ea6467c37
1 #!/bin/sh
3 # find_dot_no_parens.sh
5 # Look for function names after /^.[BIR]/ 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_dots_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 take probably a few moments..." 1>&2
53 awk_script_file=tmp.$0.awk
54 rm -f $awk_script_file
56 # We grep out a few page names that are likely to generate false
57 # positives...
59 echo '{' >> $awk_script_file
60 echo ' myvar = $2;' >> $awk_script_file
61 echo ' gsub("[^a-z_0-9]*$", "", myvar);' >> $awk_script_file
62 echo ' if ( myvar == "NOMATCHESFORTHIS" || ' >> $awk_script_file
64 for page in $(
66 find $dir/man2/* $dir/man3/* -type f -name '*.[23]' |
67 egrep -v '/(stderr|stdin|stdout|errno|termios|string)\..$'); do
69 base=$(basename $page | sed -e 's/\.[23]$//')
70 echo " myvar == \"$base\" ||" >> $awk_script_file
72 done
74 echo ' myvar == "NOMATCHESFORTHIS" )' >> $awk_script_file
75 echo ' print $0' >> $awk_script_file
76 echo '}' >> $awk_script_file
78 grep '^\.[BRI][BRI]* [a-zA-Z0-9_][a-zA-Z0-9_]*[^a-zA-Z_]*$' $* |
79 awk -f $awk_script_file | grep -v '([0-9]*)'
81 rm -f $awk_script_file
82 exit 0