scripts/unify-sources.sh
changeset 328 cdbff91c2166
parent 324 e05633b02e40
child 329 d900fd1e760f
     1.1 --- a/scripts/unify-sources.sh	Sun Oct 19 16:19:32 2008 +0200
     1.2 +++ b/scripts/unify-sources.sh	Mon Oct 20 12:17:24 2008 +0200
     1.3 @@ -212,7 +212,7 @@
     1.4      TMP_FILE=`mktemp`
     1.5      cat $1 | sed -e 's/ \+$//g' >$TMP_FILE
     1.6  
     1.7 -    "$ACTION"_action "$TMP_FILE" "$1" 'spaces'
     1.8 +    "$ACTION"_action "$TMP_FILE" "$1" 'trailing spaces'
     1.9  }
    1.10  
    1.11  function long_lines_check() {
    1.12 @@ -225,7 +225,7 @@
    1.13  # process the file
    1.14  
    1.15  function process_file() {
    1.16 -    echo -n "    $ACTION " $1...
    1.17 +    echo -n "    $ACTION $1..."
    1.18  
    1.19      CHECKING="header tabs spaces long_lines"
    1.20  
    1.21 @@ -259,12 +259,12 @@
    1.22    --dry-run|-n
    1.23       Check the given files, but do not modify them.
    1.24    --interactive|-i
    1.25 -     If --dry-run is specified and files are warned then a message is
    1.26 +     If --dry-run is specified and files are warned, then a message is
    1.27       prompted whether the warnings should be turned to errors.
    1.28    --werror|-w
    1.29 -     If --dry-run is specified and the warnings are turned to errors.
    1.30 +     If --dry-run is specified, the warnings are turned to errors.
    1.31    --all|-a
    1.32 -     All files in the repository will be checked.
    1.33 +     Check all source files in the repository.
    1.34    --modified|-m
    1.35       Check only the modified source files. This option is proper to
    1.36       use before a commit. E.g. all files which are modified or added
    1.37 @@ -282,36 +282,36 @@
    1.38    --help|-h
    1.39       Print this help message.
    1.40    files
    1.41 -     The files to check/unify. If no file names are given, the
    1.42 -     modified source will be checked/unified
    1.43 -
    1.44 +     The files to check/unify. If no file names are given, the modified
    1.45 +     source files will be checked/unified (just like using the
    1.46 +     --modified|-m option).
    1.47  "
    1.48          exit 0
    1.49      elif [ "$1" == '--dry-run' ] || [ "$1" == '-n' ]
    1.50      then
    1.51 -	[ -n "$ACTION" ] && echo "Invalid option $1" >&2 && exit 1
    1.52 +	[ -n "$ACTION" ] && echo "Conflicting action options" >&2 && exit 1
    1.53  	ACTION=check
    1.54      elif [ "$1" == "--all" ] || [ "$1" == '-a' ]
    1.55      then
    1.56 -	[ -n "$FILES" ] && echo "Invalid option $1" >&2 && exit 1
    1.57 +	[ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1
    1.58  	FILES=all_files
    1.59      elif [ "$1" == "--changed" ] || [ "$1" == '-c' ]
    1.60      then
    1.61 -	[ -n "$FILES" ] && echo "Invalid option $1" >&2 && exit 1
    1.62 +	[ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1
    1.63  	FILES=changed_files
    1.64      elif [ "$1" == "--modified" ] || [ "$1" == '-m' ]
    1.65      then
    1.66 -	[ -n "$FILES" ] && echo "Invalid option $1" >&2 && exit 1
    1.67 +	[ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1
    1.68  	FILES=modified_files
    1.69      elif [ "$1" == "--interactive" ] || [ "$1" == "-i" ]
    1.70      then
    1.71 -	[ -n "$WARNING" ] && echo "Invalid option $1" >&2 && exit 1
    1.72 +	[ -n "$WARNING" ] && echo "Conflicting warning options" >&2 && exit 1
    1.73  	WARNING='INTERACTIVE'
    1.74      elif [ "$1" == "--werror" ] || [ "$1" == "-w" ]
    1.75      then
    1.76 -	[ -n "$WARNING" ] && echo "Invalid option $1" >&2 && exit 1
    1.77 +	[ -n "$WARNING" ] && echo "Conflicting warning options" >&2 && exit 1
    1.78  	WARNING='WERROR'
    1.79 -    elif [ $(echo $1 | cut -c 1) == '-' ]
    1.80 +    elif [ $(echo x$1 | cut -c 2) == '-' ]
    1.81      then
    1.82  	echo "Invalid option $1" >&2 && exit 1
    1.83      else