source: trunk/ncurses/misc/ncu-indent@ 3022

Last change on this file since 3022 was 2621, checked in by bird, 19 years ago

GNU ncurses 5.5

File size: 1.7 KB
Line 
1#!/bin/sh
2# $Id: ncu-indent,v 1.12 2004/11/23 00:45:48 tom Exp $
3NOOP=no
4OPTS='
5--blank-lines-after-procedures
6--braces-on-if-line
7--continuation-indentation0
8--continue-at-parentheses
9--cuddle-else
10--indent-level4
11--leave-preprocessor-space
12--no-blank-lines-after-commas
13--no-blank-lines-after-declarations
14--no-space-after-function-call-names
15--procnames-start-lines
16--space-special-semicolon
17--swallow-optional-blank-lines
18--tab-size8
19
20-T NCURSES_EXPORT_VAR
21-T SCREEN
22-T TERMTYPE
23-T attr_t
24-T cchar_t
25-T chtype
26-T inline
27-T wchar_t
28-T wint_t
29
30-T BUFFER
31-T CHARTYPE
32-T FILE
33-T GCC_NORETURN
34-T LINE
35-T MARK
36-T RETSIGTYPE
37-T TBUFF
38-T WINDOW
39-T size_t
40-T va_list
41
42-T Cardinal
43-T Widget
44-T XtPointer
45'
46for name in $*
47do
48 case $name in
49 -v|-n)
50 NOOP=yes
51 OPTS="$OPTS -v"
52 ;;
53 -*)
54 OPTS="$OPTS $name"
55 ;;
56 *.[ch])
57 save="${name}".a$$
58 test="${name}".b$$
59 rm -f "$save" "$test"
60 mv "$name" "$save"
61 sed \
62 -e '/MODULE_ID(/s/)$/);/' \
63 -e 's,\<GCC_NORETURN;,;//GCC_NORETURN;,' \
64 -e 's,\(\<NCURSES_EXPORT_VAR\>\),//\1,' \
65 "$save" >"$test"
66 cp "$test" "$name"
67 chmod u+w "$name"
68 # ${INDENT_PROG-indent} --version
69 ${INDENT_PROG-indent} -npro $OPTS "$name"
70 sed \
71 -e '/MODULE_ID(/s/);$/)/' \
72 -e 's,;[ ]*//GCC_NORETURN;, GCC_NORETURN;,' \
73 -e 's,//\(\<NCURSES_EXPORT_VAR\>\),\1,' \
74 "$name" >"$test"
75 mv "$test" "$name"
76 rm -f "${name}~"
77 if test $NOOP = yes ; then
78 if (cmp -s "$name" "$save" ) then
79 echo "** no change: $name"
80 else
81 diff -u "$save" "$name"
82 fi
83 rm -f "$name"
84 mv "$save" "$name"
85 elif ( cmp -s "$name" "$save" ) ; then
86 echo "** unchanged $name"
87 rm -f "${name}"
88 mv "$save" "$name"
89 else
90 echo "** updated $name"
91 rm -f "$save"
92 fi
93 ;;
94 *)
95 echo "** ignored: $name"
96 ;;
97 esac
98done
Note: See TracBrowser for help on using the repository browser.