"Fossies" - the Fresh Open Source Software Archive

Member "leafnode-1.12.0/cindent" (30 Jan 2009, 1280 Bytes) of package /linux/misc/leafnode-1.12.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #! /bin/sh
    2 
    3 # cindent -- indent, fixing GNU indent's breaking of splint comments.
    4 # Copyright (C) 2002 Matthias Andree
    5 #
    6 # This program is free software; you can redistribute it and/or modify
    7 # it under the terms of version 2 of the GNU General Public License as
    8 # published by the Free Software Foundation. 
    9 #
   10 # NOTE: redistributing this under newer versions of the license requires
   11 # the PRIOR WRITTEN CONSENT of the copyright holder!
   12 #
   13 # This program is distributed in the hope that it will be useful, but
   14 # WITHOUT ANY WARRANTY; without even the implied warranty of
   15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   16 # General Public License for more details.
   17 #
   18 # You should have received a copy of the GNU General Public License
   19 # along with this program (in the COPYING.GPL file); if not, write to
   20 # the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
   21 # Boston, MA  02111-1307 USA
   22 
   23 doindent() {
   24     set -e
   25     rm -f "$1".bak
   26     cp -p "$1" "$1".bak
   27     indent "$1"
   28     perl -p -l -i -e 's,@ \*/,@*/,g;' "$1"
   29 }
   30 
   31 if [ x"$1" = x -o x"$1" = "x-h" ] ; then
   32     echo >&2 "Usage: $0 file [file [file [...]]]"
   33     exit 1
   34 fi
   35 
   36 while [ x"$1" != x ] ; do
   37     case "$1" in
   38     *.[ch])
   39         echo >&2 "formatting $1"
   40         doindent "$1"
   41         ;;
   42     *)
   43         echo >&2 "skipping $1"
   44         ;;
   45     esac
   46     shift
   47 done