On Fri, Jun 10, 2022 at 11:52:30AM +0200, Alejandro Colomar wrote: > Hi, Ingo and Branden! > > As far as I know, there's currently no tool that warns on "foo. bar" in > filled test. Not `mandoc -Tlint`, and not `groff -ww`, and not `groff > -rCHECKSTYLE=999`. I know that CHECKSTYLE is not designed in a way that > could catch this easily, but maybe -ww or -Tlint could. Do you think you > could add some semantic newlines warnings so that writers could realize by > themselves that their text could be improved? > > The tool could have a secondary warning, not so important, for "foo, bar". > > Also, as far as I know, neither of -ww nor -Tlint have something equivalent > to -Wno-switch (or -Wno-error=switch), which could be nice to silence (or > make non-fatal) some warnings on purpose. Do you think that could be > implemented in groff(1) or mandoc(1)? > [...]
"groff" is not the right tool for such things, but "grep" is. The attachment contains a shell script that tests various cases of defects in man pages. It can test for just one or few cases or all of them. For example create a file with foo. bar foo. bar foo. Bar foo. Bar or more examples and run <name of script> all <file> Later you can use the reported test numbers to just run those tests. The script can (still) produce a lot of wrong positive results.
#!/bin/bash # Input # 1) one number, one or more files # 2) "all", one or more files # In $SEDLIB: "groff.comment.sed", "groff.TH.sed", "groff.hyphen-minus.sed", # "check_manuals", "strings_gt" # # "chk_manuals" uses: "in_out_put.sh", "mandoc", "groff.lint", and # "roff.singleword.sed" # Environmental variable: MANWIDTH (see man(1)) with 'm' unit # # Instead of "test-groff" (in the git repository) #set -x set -f SEDLIB=$HOME/bin # Check arguments case "$1" in all|[1-9]|[1-9][0-9]) : ;; *) echo 'First argument is not a number or the word "all", but "'"$1"'"' >&2 exit 1 ;; esac Cmd_name=${0##*/} #echo $Cmd_name total=0 declare -a command do_what patch_explain #n+1 1 total=$((total + 1)) #regexp[${total}]=" -e ' $'" do_what[${total}]='Remove space at end of lines.' patch_explain[${total}]=\ 'Remove space characters at the end of lines. Use "git apply ... --whitespace=fix" to fix extra space issues, or use global configuration "core.whitespace".' command[${total}]="grep -n -e ' \$'" #n+1 2 #set -f while false; do total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Fix warnings from test-groff.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ "Enable and fix warnings from 'test-groff'." #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='chk_manuals' done #n+1 3 total=$((total + 1)) #regexp[${total}]=" -e '\`-'" do_what[${total}]='Change \`- to '"'"'"\-".' patch_explain[${total}]=\ 'Change \`- (prints as a grave and a hyphen) to '"'"'\-. \` (grave) is sometimes used as a left single quote (in ASCII text), but is easily confused with the start of a command substitution in the shell.' command[${total}]="grep -n -e '\\\\\`-'" #n+1 4 while false; do total=$((total + 1)) #regexp[${total}]="-e '\\\`'" #eval echo \"\${regexp[${total}]}\" do_what[${total}]="Change \\\` or '\`' (grave) to ', if it is a quotation mark." #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Change \` or ` (grave) to '"'"', if it is a quotation mark.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="sed -e \"/^[.'] *.*\\*[^\\]/d\" \$file | \ grep -n --label=\${file} --exclude=\${file##\*/} -e '^[\\]\`' \ -e '[ (][\\]\`' -e '^\`' -e '[ (]\`' -" done #n+1 4 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]="Change \\' (acute) to \\[aq] (single straight quote) or ', if used as a single quote. Change \\' (acute) to a ', if used as an apostrophe." #eval echo do_what, single straight quote: \"\${do_what[${total}]}\"; patch_explain[${total}]=\ "Change \\' (acute) to \\[aq], if used as a quote. Change \\' (acute) to ', if used as an apostrophe." #eval echoh \"single straight quote:\" \"\${patch_explain[${total}]}\"; command[${total}]="grep -n -e '\\\\'\"'\"" #echo without " eval", change "acute": "\"\${command[${total}]}\"" #eval echo change " acute: "\"\${command[${total}]}\"" #eval echo command[$total] er \""\${command[$total]}"\" #n+1 5 #total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" #do_what[${total}]='Add .tr '"'"'\\[aq] at the top of the file.' #eval echo \"\${do_what[${total}]}\" #patch_explain[${total}]=\ #'Add command .tr '"'"'\[aq] at the top of the source file to use only #straight single quotes (nondirectional ones)[1]. #[1] man-pages(7) [package "manpages"' #eval echo \"\${patch_explain[${total}]}\"; exit # Not in comment or command lines #command[${total}]="sed -e \"/^[.']/d\" \$file | \ # grep -q -e \" '\" -e \"' \" -e \"'$\" " # grep -q -n --label=\$file --exclude=\${file##\*/} -e \" '\" \ #-e \"' \" -e \"'\$\" -" #n+1 5 total=$((total + 1)) #regexp[${total}]='[0-9]-[0-9]' #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change <number>[\]-<number> to <number>\(en<number> if it is a numeric range.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]="Change '-' (\-) to '\(en' (en-dash) for a numeric range." #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="sed -f $SEDLIB/groff.comment.sed -f $SEDLIB/groff.TH.sed \\ -f $SEDLIB/groff.hyphen-minus.sed \$file | \\ grep -n --label=\$file --exclude=\${file##\*/} -e '[0-9][\]*-[0-9]' - " # -e '[0-9][\]*-[[:alpha:]]' -e '[[:alpha:]][\]*-[0-9]' - " #n+1 6 total=$((total + 1)) #regexp[${total}]=' -- ' #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change " -- " to " \(en ", if it is an en-dash, otherwise to "\(em".' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Change two HYPHEN-MINUSES (code 0x055, 2D) to an em-dash (\[em]), if one is intended. An en-dash is usually surrounded by a space, while an em-dash is used without spaces. "man" (1 byte characters) transforms an en-dash (\[en] to one HYPHEN-MINUS, and an em-dash to two HYPHEN-MINUSES without considering the space around it.' #eval echo \"\${patch_explain[${total}]}\"; exit # Had "| tee $copy" at the end of next line command[${total}]="sed -f $SEDLIB/groff.comment.sed \$file | \ grep -n --label=\$file --exclude=\${file##\*/} -e ' -- '" #n+1 while false; do total=$((total + 1)) #regexp[${total}]='[[:alpha:]]\\-[[:alpha:]]' #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change \- to - if inside names (words) (surrounded by letters.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Change a minus sign (\-) in(side) names to a HYPHEN-MINUS (-) (code 0x55, 2D). Names or (compound) words are not written with a minus sign (which is an operator).' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -E -n -e '[^\][^f]([[:upper:]]|[a-pr-z])[\\]-[[:alpha:]]'" done #n+1 7 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change misused metric prefixes to binary ones, Ki, Mi, Gi, or Ti, if indicated.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Change (or include a "FIXME" paragraph about) misused SI (metric) numeric prefixes (or names) to the binary ones, like Ki (kibi), Mi (mebi), Gi (gibi), or Ti (tebi), if indicated. If the metric prefixes are correct, add the definitions or an explanation to avoid misunderstanding.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[kK]ilo' -e 'kiB' -e Mega -e Giga -e Tera\ -e '[[0-9] '\"'\"'\\\"][kKMGT]B\*[ '\"'\"'\\\"]' -e '[^+-][0-9][bBkKMGT]' " #echo command nr. $total is: "${command[${total}]}" #exit #n+1 8 #while false ; do total=$((total + 1)) echo checking test case nr $total #regexp[${total}]=' [^.]*\.[])' #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Mark "." as a not-ending-sentence, if not an end of sentence.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Mark a full stop (.) with "\&", if it does not mean an end of a sentence. This is a preventive action, the paragraph could be reshaped, e.g., after changes. When typing, one does not always notice when the line wraps after the period. There are too many examples of input lines in manual pages, that end with an abbreviation point. This marking is robust, and independent of the position on the line. It corresponds to "\ " in TeX, and to "@:" in Texinfo. ' #eval echo \"\${patch_explain[${total}]}\"; exit regularexp='[^ ][.][])]* [^ [:upper:]]' #echo regularexp="$regularexp"; exit # Drop line if of the format "^\. *[BIR][BIR].* .$" # Drop line if it is a request and has a space in front of a period # Drop line if a capital is after the '. ' command[${total}]="grep -n -e '${regularexp}'" # tee /tmp/athman.new.test.8 | \ # grep -v -E -e '^[0-9]+:\\. *[BIR][BIR].* \\. *$' | \ # tee /tmp/athman.new.test.8.second | \ # grep -v -E -e '^[0-9]+:\\..* \\.' | \ # tee $copy | cat | \ # grep -v -E \ # --exclude=\${file} -e '^[0-9]+:.*\\. [[:upper:]]' | : " #echo without: eval: protect full stop: "\"\${command[${total}]}\"" #eval echo protect full stop: "\"\${command[${total}]}\"" #exit 2 #done #n+1, = 9 while false ; do total=$((total + 1)) #regexp[${total}]=' [^.]*\.[])' #eval echo \"\${regexp[${total}]}\" do_what[${total}]="Protect an aphostrophe (', 0x27), if it can become a control character." #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Protect an apostrophe (0x27, '"'"') with "\&", if it can become a control character (for example when a line is reformatted).' #eval echo \"\${patch_explain[${total}]}\"; exit # Drop line if of the format "^\. *[BIR][BIR].* .$" # Drop line if it is a request and has a space in front of a period # Drop line if a capital is after the '. ' command[${total}]="grep -n -e \"^[^.].* '\"" # -e \"^'\"" #echo without eval: protect full stop: "\"\${command[${total}]}\"" #eval echo protect full stop: "\"\${command[${total}]}\"" #exit 2 #n+1, 12 done #n+1, = 13 while false; do total=$((total + 1)) #regexp[${total}]='[^ "][;,][^ "]' #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Correct space around a semicolon or a comma.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Correct the space around a semicolon or a comma.' #eval echo \"\${patch_explain[${total}]}\"; exit # Eliminate font changes after the punctuation # Drop lines with alternate font changes command[${total}]="grep -n -e ' [;,]' -e '[0-9],[0-9][0-9][^0-9]' \ \$file | grep -v -E -e '^[0-9]+:\\..* [,;] *$'" done #n+1 10 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Define a string "El" for an ellipsis.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Define a string "El" for an ellipsis, to avoid problems with the full stops (can act as a control character or indicate the end of a sentence). Simplifies changes around this string (character) .ds El \&.\^.\^.\&\" or .ds El \&.\|.\|.\&\" ' #eval echo \"\${patch_explain[${total}]}\"; exit # had " | tee $copy " at the end of next line command[${total}]="sed -f $SEDLIB/groff.comment.sed \$file \\ | grep -n --label=\${file} --exclude=\${file##\*/} -e '[^,][.][.][.]' -e '[.]\\[|^]'" #echo command: \""$command[13]"\" #n+1 10 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Separate an ellipsis from the preceding string with a space.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Separate an ellipsis from the preceding string with a space character, if it does not mean a continuation of it. See a manual of style about the difference between "abc..." and "abc ...".' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[^\" &~][.][.][.]' \ -e '[^ &|~][.]\\\\[|^]' -e '\\\\[*](el' -e '\\\\[*]\\[el\\]'" #n+1 11 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Show an ellipsis in the same font as the argument it refers to.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Show an ellipsis in the same font as the argument it refers to in the synopsis part (meaning: more arguments of the same type can be used). (Style guides).' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[^ ][.][.][.]' \ -e '[^ ][.][|^]' -e '\\*(El' -e '\\*\[El\]' -e '[\"][ ][.]\\[|^]'" #n+1 12 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Reduce space between words or start the sentence on a new line.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Reduce space between words.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'^[^.][^\][^"].*[^.?!:)\] [^ ]'"'" #N+1 13 total=$((total + 1)) #regexp[${total}]= #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change -- in x--y to \(em (em-dash), or, if an option, to "\-\-".' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Change -- in x--y to \(em (em-dash), or, if an option, to \-\-' #eval echo \"\${patch_explain[${total}]}\"; exit #command[${total}]="grep -n -e '[^ \"]--[^ ]'" command[${total}]="grep -n -e '[[:alpha:] ]--[[:alpha:]]'" #n+1 14 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Make ~ (tilde) bigger in troff output by using \(ti' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Increase size of ~ (tilde) to make it more visible\ with "troff" by using character \(ti.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[^\\]~[^\\][^s]'" #n+1 15 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Add a no-break space between a number and a unit.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Add a (no-break, "\ " or "\~") space between a number and a unit, as these are not one entity.' #eval echo \"\${patch_explain[${total}]}\"; exit #groff_units='cHimnpPsuvz\"' # Add octal unit x #command[${total}]="grep -n -e '[^\][^s][+-][0-9][0-9]*[^[:blank:]0-9'${groff_units}'[:punct:]\\-]'" # Skip this command without change the number "total" #command[${total}]="grep -n -e '[0-9][^${groff_units}0-9.,)(/ -]' \$file | grep \ # -v --label=\${file} --exclude=\${file##\*/} -e '[0-9]\$'" #command[${total}]='/bin/false' command[${total}]="grep -n -e '[0-9]dpi'" #n+1 16 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change a two-fonts macro to an one-font macro for a single argument.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Use the correct macro for the font change of a single argument or split the argument into two.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '^[.] *[BIR][BIR] *[^ ]*[^[:punct:]] *$' \ -e '^[.] *[BIR][BIR] *\"[^\"]*[\"]*$' \ -e '^[.] *[BIR][BIR] *\"[^\"]*\"[^ ].*$' " #Change "\ " to "no-break space" before grepping #command[${total}]="sed -e 's/\\ / /g' \$file | \ # grep -n --label=\${file} --exclude=\${file##\*/} \ # -e '^[.] *[BIR][BIR] *[^ ]* *$' \ # -e '^[.] *[BIR][BIR] *\"[^\"]*[\"]*$'" #n+1 17 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Add a backslash if line ends in "\{".' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Add a backslash, if it is missing after \{ at the end of a line.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[\\]{$'" #n+1 nr. 18 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change - to \- if it shall be printed as a minus.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Change - to \- if it shall be printed as a minus sign.' #eval echo \"\${patch_explain[${total}]}\"; exit # Not +-[digit] UTF-8 # Not size changes, \s-[:digit:] # Not argument of .IX #command[${total}]="sed -f $SEDLIB/groff.comment.sed -f $SEDLIB/groff.TH.sed \ # -f $SEDLIB/groff.hyphen-minus.sed \$file | \ command[${total}]="sed -f $SEDLIB/groff.comment.sed -f \ $SEDLIB/groff.TH.sed \$file | \ grep -n --label=\${file} --exclude=\${file##\*/} \ -e '^[^.][^I][^X].*[^\\+F][^s\\]-[[:digit:]]' \ -e '[^[:alpha:]\\]-[[:digit:]]' -e '[[:digit:]]-\\\\f'" #n+1 19 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Start an empty line with ".sp 1" or just a period (.).' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Empty (or only spaces) lines cause a break. Change such lines to only contain "." (no), ".sp 1" (one) empty line in the output.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="sed -e '/^\.EX/,/^\.EE/ { s/^.*\$/\./ }' \ -e '/^\.nf/,/^\.fi/ { s/^.*\$/\./ }' \ -e '/^\.ig\$/,/^\.\.\$/ { s/^.*\$/\./ }' \$file |\ grep -n --label=\${file} --exclude=\${file##\*/} -e '^ *$'" #command[${total}]="grep -n -e '^ *$'" #n+1 20 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change \\ to \e to print the escape character.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Use "\e" to print the escape character instead of "\\" (which gets interpreted in copy mode).' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '^[^.].*\\\\\\\\[^$]'" #n+1, = 21 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Use a macro to change to the italic font.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Use a macro to change to the italic font, instead of \fI [1], if possible. The macros have the italic corrections, but "\c" removes the "\/" part, which is in the macro. So "\/" must be added to the argument before the "\c" string. Or add the italic corrections. [1] man-pages(7)' #eval echo \"\${patch_explain[${total}]}\"; exit #command[${total}]="cat -n \$file | sed -n -e '/\\\\fI/p'" # |\ # grep -e '\\\\fI' -" command[${total}]="grep -n -e '^[^.].*\\\\fI' -e '^\\\\fI'" #n+1 22 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Use (in)valid instead of "(il)legal" (GNU coding standard).' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Use the word (in)valid instead of (il)legal if not related to legal matters. See "www.gnu.org/prep/standards". Think about translations into other languages!' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="sed -e '"'/\\" Legal Terms/d'"' \$file | \ grep -n -i -F --label=\${file} --exclude=\${file##\*/} legal" #n+1 23 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Avoid space at the beginning of a text line.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Remove space in the first column, if not indented. Use ".in +<number>n" and ".in", ".nf" and ".fi" for an extra indention.' # #eval echo \"\${patch_explain[${total}]}\"; exit # User "Placeholder" to keep line number correct command[${total}]="sed -e '/^\.EX/,/^\.EE/ s/^.*$/Placeholder/' \ -e '/^\.nf/,/^\.fi/ s/^.*$/Placeholder/' \$file |\ grep -n --label=\${file} --exclude=\${file##\*/} -e '^ *[^ ]'" #n+1 24 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Move a full stop (period) and a comma outside of a quoted text.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Move a full stop (period) and a comma outside of a quoted text, if it is at the end of the quote and does not end a quoted sentence.' #eval echo \"\${patch_explain[${total}]}\"; exit # Exclude arguments of a macro command[${total}]="grep -n -e '^[^.].*[,.][\"]' -e \"[,.]'\"" #n+1 25 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change a HYPHEN-MINUS (code 0x55, 2D) to a dash (minus) if it matches " -[:alpha:]" or \[aq]-[:alpha:] (for options).' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Change a HYPHEN-MINUS (code 0x55, 2D) to a minus (\-), if in front of a name for an option.' #eval echo \"\${patch_explain[${total}]}\"; exit prefix='^[^.].[^X].*' command[${total}]="grep -n -e '${prefix} -[[:alpha:]]' -e \ '\\(\\\\[aq]\\| \\|\"\\)-[[:alpha:]]' -e '\\\\f.-[[:alpha:]]' \ -e \"'-[^0-9.]\" -e'\"-[^0-9.]' " #n+1 26 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change " to "\ in" (\ inch(es) if it means an inch.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Change " to "\ in" if it means an inch, or to "\ inch(es)" in a running text.' #eval echo \"\${patch_explain[${total}]}\"; exit # Do not mark quotation after a number command[${total}]="grep -n -e '"'^[^"]*[0-9]"'"'" #n+1 27 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Delete repeated words.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Find a repeated word' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='tviord' #n+1 28 #total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" #do_what[${total}]="Change \\[aq] and \\(aq into '." #eval echo \"\${do_what[${total}]}\" #patch_explain[${total}]=\ #"Change \\[aq] and \\(aq into ' if it is a genuine apostrophe. #Read a book on typography and style guides." # #eval echo \"\${patch_explain[${total}]}\"; exit #command[${total}]="grep -n -e '\\[aq]' -e '\\(aq'" #n+1 29 while false ; do total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Check existence of "\c" in a macro call and its surroundings.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Check if "\c" is correctly used. It removes italic corrections, if they are applied in the macro at the end of last last argument.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -B 1 -A 3 -n -e '^\(\\!\)*\\..*\\\\c\$'" done #n+1 while false; do total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Surround a block of comments with the macros ".ig" and "..".' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Surround a block of comments with the macros ".ig" and "..". The .\" (\#) at the beginning of each line is then not needed. Makes it easier to add and remove text and adjust length of lines. NO PATCH' #eval echo \"\${patch_explain[${total}]}\"; exit #command[${total}]='count_comments maxcount=10' command[${total}]="grep -n -e '"'^\.\\"'"'"" -e '"'^\\#'"'" #n+1 37 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Check for the font name "C".' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Check for the font name "C" as that is not standard in "groff"' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[\\]fC' -e '[\\]f\\[C\\]' -e '[\\]f(C[^BIRW]' -e \ '\\\\f\\[C[^BIRW]\\]' -e '[.] *ft C[^BIRW]' -e '[.] *ft *C$'" done while false ; do #n+1 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Find long strings of numbers.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Search for long numbers to add a period to increase readability.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[0-9]\\{5,\\}'" done #n+1 39 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Change misused \- in dates into "-".' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Search for \- in dates' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -E -n -e '[0-9]\\\\-[0-9]+\\\\-[0-9]'" #n+1 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Use three periods for an ellipsis.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Three full stops (periods) are used for an ellipsis' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[^.][.][.][^.]'" #n+1 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Add a hair space (\^) around "|" to increases readability.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Add a hair space (\^) around "|" to increase readability' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e \"[[:alpha:]']|[[:alpha:]]\"" #n+1 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Correct spelling of prefixes for units.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Prefixes like "Kibi", "Mebi", "Gibi" and "Tebi" are written with a small initial letter' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -F -e Kibi -e Mebi -e Gibi -e Tebi" while false ; do #n+1 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Add a space after a comma.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Have a space after a comma in an argument to an alternating fonts macro. The space belongs to the comma, so ", ".' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'\.[ ]*[BIR][BIR].*\([^\],[^ ]\| , "\)'"'" done total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Use macros "MT" and "ME" for e-mails addresses.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Email addresses use the macro ".MT" and end with ".ME".' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'\.UR .*@'"'" while false ; do total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Add a space after a comma.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Have a space after a comma' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[^0-9],[^ \0-9]'" done #total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Add a comma after "or" and "and".' #eval echo \"\${do_what[${total}]}\" #patch_explain[${total}]=\ #'Add a comma before "and", "or", or "nor" if a series contains three or #more words' #eval echo \"\${patch_explain[${total}]}\"; exit #command[${total}]="grep -n -e ',.*[^,] "'\(and\|or\|nor\) '"' -e ',.*[^,] "'\(and\|or\|nor\)$'"'" # -e '[^,] "'\(and\|or\|nor\)$ '"'" #eval command[${total}]='Eitthvad' #eval echo command is \"\${command[${total}]}\" ; exit 1 #n+1 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Shorten (split) long strings.' #eval echo \"\${do_what[${total}]}\" limit=$((3*${MANWIDTH%m}/4)) patch_explain[${total}]=\ 'Strings longer than 3/4 of a standard line length (80)' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="sed -e '"'s/^\.\\".*$/./'"' \$file | \ strings_gt $limit # " #n+1 38 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Add a comma (or \&) after "e.g." and "i.e.", or use English words.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Add a comma after "e.g." and "i.e.", or use English words (man-pages(7). Abbreviation points should be protected against being interpreted as an end of sentence, if they are not, and that independent of the current place on the line.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -i -e '"'"'e\.g\.[^,:\]'"'"' -e '"'"'i\.e\.[^,\]'"'"\ ' -e '"'"'e\.g\.$'"'"' -e '"'"'i\.e\.$'"'" #n+1 39 total=$((total + 1)) #regexp[${total}]=" -e '.[.] [^ ]' -e '.[.] '" do_what[${total}]='Begin a sentence on a new line.' patch_explain[${total}]=\ 'Wrong distance between sentences or protect the indicator. a) Separate the sentences and subordinate clauses; each begins on a new line. See man-pages(7) and "info groff". The best procedure is to always start a new sentence on a new line, at least, if you are typing on a computer. Remember coding: Only one command ("sentence") on each (logical) line. E-mail: Easier to quote exactly the relevant lines. Generally: Easier to edit the sentence. Patches: Less unaffected text. ### Or (not recommended) b) Adjust space between sentences (two spaces), c) or protect the indicator by adding "\&" after it. The "indicator" is an "end-of-sentence character" (.!?). The amount of space between sentences in the output can then be controlled with the ".ss" request.' #endofline='[.?!][]")]*' endofline='[.?!][)]*' #endofline='[.]' command[${total}]="grep -n -e '^[^.].*${endofline} [^ ]' \ -e '^[^.].*${endofline} '" #eval echo space between sentences: "\"\${command[${total}]}\"" #n+1 37 total=$((total + 1)) longest_line=${MANWIDTH%m} do_what[${total}]="Split long lines (> ${longest_line})." patch_explain[${total}]=\ 'Split lines longer than '"$longest_line"' characters into two or more lines. Appropriate break points are the end of a sentence and a subordinate clause; after punctuation marks.' #$(cat $HOME/doc/sentence-space)" command[${total}]="lines_gt $longest_line " #echo "${command[1]}"; exit #n+1 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Use the name of prefixes for units in text.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Write the name for numeric prefixes if used with a unit, for example "kilobytes", not "kbytes"' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[kKMGT]byte'" #n+1 39 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Use \(en for a dash where appropriate.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Use \(en for a dash (en-dash) between space characters, not a minus (\-) or a hyphen (-), except in the NAME section.' #eval echo \"\${patch_explain[${total}]}\"; exit # exclude comments command[${total}]="sed -e 's%[\\]\".\*\$%%' \$file | \ grep -n --label=\${file} --exclude=\${file##\*/} -e ' - ' \ -e '^- '" #eval printf '%s %s\n' 'command[total]' \"\$command[$total]\" #n+1 40 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Add a missing left italic correction or use a macro.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Add a missing left italic correction in front of \fI, or use a macro' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[^ ]\\\\fI[^\\ ][^,]' \$file" # | \ # grep -e '[^\\][^, ]\\\\fI'" #n+1 41 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]='Add a missing right italic correction or use a macro.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Add a missing right italic correction after \fI (and before "\f[BPR]"), or use a macro' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'[^ ]\\fI[^\]*[^f]*[^\][^/]\\f[RP][^ ]'"'" while false; do #n+1 42 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=\ 'Remove superfluous quotation marks \("\) from the argument of a single-font macro.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Remove superfluous quotation marks \(") from the argument of a single-font macro.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'^\.[ ]*[BI] *"[^ ]*"'"'" done #n+1 43 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=\ 'Use an absolute number for restoring the font size with the escape "\s".' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Do not use "\s0" but an absolute number, as the size of the string could be changed.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '"'\\s0'"'" #n+1 44 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=\ 'Remove reverse slash (\) in front of a period (.) that is to be printed as such' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Remove reverse slash (\) in front of a period (.) that is to be printed as such' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '"'\\\.'"'" #n+145 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=\ 'Do not begin a sentence with a digit (see a style manual)' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Rephrase the beginning of a sentence, if it starts with a digit (see a style manual).' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '"'\. *[0-9]'"'" #n+1 46 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=' Use just two space character or a new line between sentences.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Do not use more than two space characters between sentences or (better) only a new line character.' #eval echo \"\${patch_explain[${total}]}\"; exit EOS='[.?!][)]*' # End of sentence character command[${total}]="grep -n -e '"^[^.].*$EOS' '"'" #n+1 47 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=' Split a punctuation from a single argument for a two-fonts macro' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Split a punctuation mark from a single argument for a two-fonts macro' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'^[.] *[BIR][BIR] *[^ ]*[.,;:] *$'"'" #n+1 48 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=' Set the name of a manual page in bold but the section in roman.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'The name of a manual page is set in bold and the section in roman (see man-pages(7).' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'^[^.][^\][^"].*[[:alpha:]]([0-9])[^\]'"'" #n+1 49 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=' Remove unnecessary second font change.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Remove unnecessary second font change in a row.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'\\f[BIR]\\f[BIR]'"'" #n+1 50 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=' Print quotation marks \("\) in regular style' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Print quotation marks \("\) in regular style' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'[^"]"""\([.,]\|[^".,]\|$\)'"'" #n+1 51 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=' Add a zero (0) in front of a decimal fraction that begins with a period (.)' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Add a zero (0) in front of a decimal fraction that begins with a period (.)' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"' \.[0-9]'"'" #n+1 52 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=' Missing substitution of a variable' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Missing substitution of a variable from the "make" stage' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'^[^.].*\$[[:upper:]]'"'" #n+1 53 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=' Missing roman font for the section of a manual page' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'The section part for a manual page is set in roman font.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '\.[BI] *[[:alnum:]]* *([1-9])'" #n+1 54 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=' Use the name of units in text not the symbol' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Use the name of units in text; use symbols in tables and calculations' #eval echo \"\${patch_explain[${total}]}\"; exit #command[${total}]='grep -n -E -e '"'^[^.].*[0-9][[:alpha:]][[:alpha:]]?[,.]'" command[${total}]='grep -n -E -e '"'^[^.].*[0-9][[:alpha:]][[:alpha:]]?'" #n+1 55 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regexp[${total}]}\" do_what[${total}]=' Change of point size could be too large' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Change of point size could be too large' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'\\\\s[([][+-][13-9]'" #n+1 56 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${#regexp[${total}]}\" do_what[${total}]=' The "\&" escape should be next to the period to show, that its purpose is not an end of line' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Use ".\&", not ".['"'"'"]\&" to signal that the period is not an end of line.' #eval echo \"\${patch_explain[${total}]}\"; exit # grep gets \.['"]\\& # grep -e '\.[' "'" '"]\\&' #command[${total}]='grep -n -e ' "'" '\.[' "'" \" "'" \" "'" '"' ']\\&' command[${total}]='grep -n -e '"'"'\.['"'"\""'"\""'"'"'']\\&'"'" #eval printf "'%s\\n'" \"\$command[${total}]\" #n+1 57 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${#regexp[${total}]}\" do_what[${total}]=' Use the "\s(ij" form for two digit point sizes. Use the "\s(0i" form for one digit point sizes.' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'The escape "\s[1-9][0-9]" is fragile, use "(" with two digits: "\s(ij. Use the "\s(0[1-9]" form for one digit cases' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'\\\\s[1-9]'" #n+1 57 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${#regexp[${total}]}\" do_what[${total}]=' Check for the presence of "\n" (new line character)' #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Use "\\n", not "\n"' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'\\n[^([]'"'" #n+1 58 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ "Protect a period (.) or a apostrophe (') with '\\&' from becoming a control character, if it could end up at the start of a line" #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"\"^[^.].* [.']\"" #n+1 59 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Split a punctuation from a single argument, if a two-fonts macro is meant' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '\\.[BI] *[^ ]*[.,;]\$'" #n+1 60 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'The macro .MT is for e-mail, not the .UR macro' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'\. *UR .*@'"'" while false; do #n+1 61 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Bold or italic for a punctuation mark at the end of text' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '\\. *[BI] *.*[.,;]\$'" done #n+1 61 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Name of a manual is set in bold, the section in roman.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'[^ ]([1-9])\([^\][f]\|$\)'"'" while false; do #n+1 63 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Only use "\c" to join output from macros' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'[^\][^~]\\c$'"'" done #n+1 62 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Do not use margin adjustments without an explanation of its necessity.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -A2 -B2 -n -e '\\. *ad\$' -e '\\. *ad *[blr]'" #n+1 63 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'An italic correction (\/) is missing in front of "\c", as the correction in the macro will be removed by "\c".' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -E -n -e '"'"'\. *(I[RB]|[RB]I).*[^\][^/]\\c'"'" #n+1 64 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Show if docman-to-man created this' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -i -e 'docbook'" #command[${total}]='grep -n -i -e '"'"'created by instant / docbook-to-man'"'" #n+1 66 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'End of a block is marked with a "\}" without a period in front of it. That creates a space character, which forces "groff" to waste processing time to remove.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '^\\\\}' -e '^[^.] *\\\\}'" #n+1 67 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ '"\~" at the end of a line is treated as a normal space. It must be protected with "\c" to be effective.' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'\\~$'"'" #n+1 68 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ "Use character '\\(+-' instead of plain '+-'" #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e '"'"'[^\][^([][+]-'"'" #n+1 79 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Do not use overstriking (\o) for characters that groff can handle by itself' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -F -e '\\o'" #n+1 80 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Use a word instead of a number plus suffix for ordinal numbers' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '1st' -e '2nd' -e '[0-9]th'" #n+1 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ 'Space in front of \" in a pure text line becomes a trailing space' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]="grep -n -e '[^.] *[ad]s .* \\\"'" # grep --label=\${file} --exclude=\${file##\*/} -v -e '\. *[ad]s '" while false; do #n+1 total=$((total + 1)) #regexp[${total}]=b #eval echo \"\${regex[${total}]}\" do_what[${total}]=b #eval echo \"\${do_what[${total}]}\" patch_explain[${total}]=\ '' #eval echo \"\${patch_explain[${total}]}\"; exit command[${total}]='grep -n -e ' done # FIXME, number count or 'all' may only be 1 #echo Number of arguments is "$#" >&2 #if test $# -gt 2; then # echo $Cmd_name: Too many arguments, are $#, maximum is 2 >&2 # exit 2 #fi #etc type="$1" shift time=$(mjd).$(date '+%H%M%S') case "$type" in all) # temp=$(echo "$1" | sed -e 's%^\./%%' -e 's%/%_%g'; ) diff_file=${TMPDIR}/${Cmd_name}.all.diff.new.$time prof_listi=$(seq -s' ' $total) ;; *) if test "$type" -gt $total; then echo "$Cmd_name: test number \"$type\" is greater than defined \($total\)" >&2 exit 1 else diff_file=${TMPDIR}/type.${type}.diff.new.$time prof_listi="$type" fi ;; esac #printf '%s\n\n' "prof_listi: $prof_listi" | fmt - #echo inputfiles are $* #echo diff_file is "$diff_file" : > "$diff_file" #ls -l "$diff_file"; exit 1 tempfile=$(mktemp --tmpdir "${Cmd_name}"."${USER}".XXXXXX) evaluate () { #set +x # eval echo command is: \"\${command[${prof}]}\", and prof is $prof # Use " for the second eval, to avoid reducing of spaces to one space # if eval echo \"\${command[${prof}]}\" | grep -q ' $file ' ; then # echo "prof: $prof ; input is standard input" # input='-' # else # echo "prof: $prof ; input is a file: $file" # input=$file # fi input=$file #eval echo file in commandline \${command[${prof}]} #echo input=\"$input\" #echo tempfile is $tempfile #eval echo prof is $prof: \${do_what[${prof}]} if eval eval \""\${command[${prof}]}"\" "$input" > "$tempfile" ; then # eval printf "'%s\n\n'" \"Test nr. ${prof}: \${do_what[${prof}]}\" # if test "$old_filename" != "$file" ; then if test "$filename_printed" = 'no'; then printf '%s\n' "Input file is $input, case 1" filename_printed=yes fi if test "$print_test_nr" = 'yes'; then printf '%s\n' "Test nr. ${prof}:" fi eval printf "'\n%s\n\n' \"\${patch_explain[${prof}]}\"" eval printf "'%s\n\n' \"\${do_what[${prof}]}\"" >> "$TMPDIR/${file##*/}".summary case "$1" in file) : ;; test) if [ -s "$tempfile" ] ; then : # printf '####\n\n%s\n\n' "Input file is $file, case 2" # printf '%s\n' '#### evaluate: case "test"' fi ;; *) echo "$Cmd_name"': function evaluate: case "'"$1"'" is missing' >&2 exit 1 ;; esac # eval printf "'%s\n\n'" \"\${patch_explain[${prof}]}\"\ # | tee -a "$diff_file" cat "$tempfile" printf '\n#####\n\n' return 0 else return 1 fi old_filename=$file } # End of evaluate() #echo Number of arguments is $# if test "$type" = all ; then #set +x nr_file=0 old_filename='' export filename_printed export print_test_nr=yes for file in "$@"; do if test -d "$file"; then continue; fi nr_file=$((nr_file + 1)) filename_printed=no for prof in $prof_listi; do evaluate file || continue # "file" is a case variable # printf '%s\n\n' "Input file is $file, case 3" done done #set -x else # One or more tests for prof in $prof_listi; do #echo prof er $prof # eval printf "'%s\n\n'" \"Test nr. ${prof}: \${do_what[${prof}]}\" # eval printf "'%s\n\n'" \"\${do_what[${prof}]}\" >> $TMPDIR/${file}.summary old_filename='' for file in "$@"; do #printf '%s\n' "TEST_1: $file" if test -d "$file"; then continue; fi if test "${file##*.}" = gz ; then gzip -d -c "$file" > /tmp/"${file}".tempfile file=/tmp/${file}.tempfile fi evaluate file || continue #>&2 #echo case 4, return value is $? # printf '%s\n\n' "Input file is $file, case 4" done done fi while false; do if test -f "make.${type}.latest"; then cp -p "make.${type}.latest" "make.${type}.previous" rm -f "make.${type}.latest" else ln "make.${type}.$time" "make.${type}.oldest" fi printf '\n%s\n' 'End of summary' >> "$TMPDIR/${file}.summary" ln "make.${type}.$time" "make.${type}.latest" done rm "$tempfile" if test \! -s "$diff_file" ; then rm "$diff_file" fi