]>
gcc.gnu.org Git - gcc.git/blob - gcc/fixcpp
4 # fixcpp - fix CPP errors
7 # fixcpp [-c][-p patch_file][-b bak_dir][-n new_dir] files(s)
10 # For each named file, use sed(1) to fixup any descriptive
11 # text after #else or #endif or that is not properly
12 # commented as this causes ANSI compilers to generate
13 # unnecessary warnings.
15 # Naturally this script is not guaranteed to be bullet
16 # proof, use of -n or -b is advisable!
18 # -c causes fixcpp to make sure that only files that
19 # needed changing are affected by returning the original
20 # file to its original location if no changes were needed.
22 # -p causes fixcpp to append to a patch file the context
23 # diffs of the changes wrought.
29 # 90/08/08 22:46:32 (sjg)
32 # 90/08/08 22:46:34 v1.4
35 # @(#)fixcpp.sh 1.4 90/08/08 22:46:32 (sjg)
37 # @(#)Copyright (c) 1990 Simon J. Gerraty
39 # This is free software. It comes with NO WARRANTY.
40 # Everyone is granted permission to copy, modify and
41 # redistribute this source code provided that all
42 # recipients are given similar rights, and that the above
43 # copyright notice and this notice are preserved in all
52 set -- `getopt "cp:b:n:" $*`
54 echo "$0 [-c][-p patch_file][-b bakup_dir][-n new_dir] file [file ...]" >&2
60 -c) CHECK
=yes; shift;;
61 -p) PATCHF
=$2; shift 2;;
62 -b) BAKDIR
=$2; shift 2;;
63 -n) NEWDIR
=$2; shift 2;;
69 if [ ! -d $BAKDIR ]; then
70 echo "$0: no such directory -- $BAKDIR" >&2
83 if [ "$NEWDIR" = "." ]; then
90 sed -e 's;^#\([ ]*e[nl][^ ]*[ ][ ]*\)\([^/ ][^\*].*\);#\1/* \2 */;' -e 's;^#\([ ]*e[nl][^ ]*[ ][ ]*\)\([^/ ]\)$;#\1/* \2 */;' $infile >${NEWDIR}/$i
91 if [ "${CHECK}" = "yes" -o ${PATCHF} ]; then
92 if cmp -s $infile ${NEWDIR}/$i ; then
93 if [ "${CHECK}" = "yes" ]; then
95 mv $infile ${NEWDIR}/$i
102 diff -c $infile ${NEWDIR}/$i >> ${PATCHF}
This page took 0.044035 seconds and 5 git commands to generate.