COIN-OR::LEMON - Graph Library

Ticket #138: improvement1_cdbff91c2166.patch

File improvement1_cdbff91c2166.patch, 3.2 KB (added by Peter Kovacs, 16 years ago)

Small improvements for [e05633b02e40]

  • scripts/unify-sources.sh

    # HG changeset patch
    # User Peter Kovacs <kpeter@inf.elte.hu>
    # Date 1224497844 -7200
    # Node ID cdbff91c2166a1222fc3a1295f1f4597b6412425
    # Parent  e05633b02e40f0c854b73c0c6c988ad79ff41e43
    Small improvements in the unifier script
    
    diff --git a/scripts/unify-sources.sh b/scripts/unify-sources.sh
    a b  
    212212    TMP_FILE=`mktemp`
    213213    cat $1 | sed -e 's/ \+$//g' >$TMP_FILE
    214214
    215     "$ACTION"_action "$TMP_FILE" "$1" 'spaces'
     215    "$ACTION"_action "$TMP_FILE" "$1" 'trailing spaces'
    216216}
    217217
    218218function long_lines_check() {
     
    225225# process the file
    226226
    227227function process_file() {
    228     echo -n "    $ACTION " $1...
     228    echo -n "    $ACTION $1..."
    229229
    230230    CHECKING="header tabs spaces long_lines"
    231231
     
    259259  --dry-run|-n
    260260     Check the given files, but do not modify them.
    261261  --interactive|-i
    262      If --dry-run is specified and files are warned then a message is
     262     If --dry-run is specified and files are warned, then a message is
    263263     prompted whether the warnings should be turned to errors.
    264264  --werror|-w
    265      If --dry-run is specified and the warnings are turned to errors.
     265     If --dry-run is specified, the warnings are turned to errors.
    266266  --all|-a
    267      All files in the repository will be checked.
     267     Check all source files in the repository.
    268268  --modified|-m
    269269     Check only the modified source files. This option is proper to
    270270     use before a commit. E.g. all files which are modified or added
     
    282282  --help|-h
    283283     Print this help message.
    284284  files
    285      The files to check/unify. If no file names are given, the
    286      modified source will be checked/unified
    287 
     285     The files to check/unify. If no file names are given, the modified
     286     source files will be checked/unified (just like using the
     287     --modified|-m option).
    288288"
    289289        exit 0
    290290    elif [ "$1" == '--dry-run' ] || [ "$1" == '-n' ]
    291291    then
    292         [ -n "$ACTION" ] && echo "Invalid option $1" >&2 && exit 1
     292        [ -n "$ACTION" ] && echo "Conflicting action options" >&2 && exit 1
    293293        ACTION=check
    294294    elif [ "$1" == "--all" ] || [ "$1" == '-a' ]
    295295    then
    296         [ -n "$FILES" ] && echo "Invalid option $1" >&2 && exit 1
     296        [ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1
    297297        FILES=all_files
    298298    elif [ "$1" == "--changed" ] || [ "$1" == '-c' ]
    299299    then
    300         [ -n "$FILES" ] && echo "Invalid option $1" >&2 && exit 1
     300        [ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1
    301301        FILES=changed_files
    302302    elif [ "$1" == "--modified" ] || [ "$1" == '-m' ]
    303303    then
    304         [ -n "$FILES" ] && echo "Invalid option $1" >&2 && exit 1
     304        [ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1
    305305        FILES=modified_files
    306306    elif [ "$1" == "--interactive" ] || [ "$1" == "-i" ]
    307307    then
    308         [ -n "$WARNING" ] && echo "Invalid option $1" >&2 && exit 1
     308        [ -n "$WARNING" ] && echo "Conflicting warning options" >&2 && exit 1
    309309        WARNING='INTERACTIVE'
    310310    elif [ "$1" == "--werror" ] || [ "$1" == "-w" ]
    311311    then
    312         [ -n "$WARNING" ] && echo "Invalid option $1" >&2 && exit 1
     312        [ -n "$WARNING" ] && echo "Conflicting warning options" >&2 && exit 1
    313313        WARNING='WERROR'
    314     elif [ $(echo $1 | cut -c 1) == '-' ]
     314    elif [ $(echo x$1 | cut -c 2) == '-' ]
    315315    then
    316316        echo "Invalid option $1" >&2 && exit 1
    317317    else