scripts/update-copyright-header.sh
author Peter Kovacs <kpeter@inf.elte.hu>
Sun, 15 Jun 2008 22:05:23 +0200
changeset 171 02f4d5d9bfd7
permissions -rwxr-xr-x
Improve and redesign test programs + unify their output (ticket #25)
- Move graph related utilities form test_tools.h to graph_test.h.
- Move the contents of graph_utils_test.h to graph_utils_test.cc.
- Rename map_test.h -> graph_maps_test.h.
- Rename digraph_test.h -> graph_test.h.
- Many improvements in the following files:
* digraph_test.cc
* graph_test.cc
* graph_test.h
* graph_maps_test.h
* graph_utils_test.cc
* bfs_test.cc
* dfs_test.cc
* counter_test.cc
- Test programs print messages only if it really seems necessary.
- Remove \file commands form .cc test files.
     1 #!/bin/bash
     2 
     3 YEAR=`date +2003-%Y`
     4 HGROOT=`hg root`
     5 
     6 function update_file() {
     7     TMP_FILE=`mktemp`
     8     FILE_NAME=$1
     9 
    10     (echo "/* -*- C++ -*-
    11  *
    12  * This file is a part of LEMON, a generic C++ optimization library
    13  *
    14  * Copyright (C) "$YEAR"
    15  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    16  * (Egervary Research Group on Combinatorial Optimization, EGRES).
    17  *
    18  * Permission to use, modify and distribute this software is granted
    19  * provided that this copyright notice appears in all copies. For
    20  * precise terms see the accompanying LICENSE file.
    21  *
    22  * This software is provided \"AS IS\" with no warranty of any kind,
    23  * express or implied, and with no claim as to its suitability for any
    24  * purpose.
    25  *
    26  */
    27 "
    28 	awk 'BEGIN { pm=0; }
    29      pm==3 { print }
    30      /\/\* / && pm==0 { pm=1;}
    31      /[^:blank:]/ && (pm==0 || pm==2) { pm=3; print;}
    32      /\*\// && pm==1 { pm=2;}
    33     ' $1
    34 	) >$TMP_FILE
    35     rm $FILE_NAME
    36     mv $TMP_FILE $FILE_NAME
    37 }
    38 
    39 
    40 if [ $# == 0 ]; then
    41     echo -n Update all source files...
    42     for i in `hg manifest|grep -E  '\.(cc|h|dox)$'`
    43     do
    44 	update_file $HGROOT/$i
    45     done
    46     echo ' done.'
    47 else
    48     for i in $*
    49     do
    50 	update_file $i
    51     done
    52 fi