scripts/update-copyright-header.sh
author Balazs Dezso <deba@inf.elte.hu>
Thu, 10 Jul 2008 16:03:23 +0200
changeset 199 e3aba2c72be4
permissions -rwxr-xr-x
Bug fix in GraphCopy (ticket #117)
alpar@38
     1
#!/bin/bash
alpar@38
     2
alpar@38
     3
YEAR=`date +2003-%Y`
alpar@38
     4
HGROOT=`hg root`
alpar@38
     5
alpar@38
     6
function update_file() {
alpar@38
     7
    TMP_FILE=`mktemp`
alpar@38
     8
    FILE_NAME=$1
alpar@38
     9
alpar@38
    10
    (echo "/* -*- C++ -*-
alpar@38
    11
 *
alpar@38
    12
 * This file is a part of LEMON, a generic C++ optimization library
alpar@38
    13
 *
alpar@38
    14
 * Copyright (C) "$YEAR"
alpar@38
    15
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@38
    16
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@38
    17
 *
alpar@38
    18
 * Permission to use, modify and distribute this software is granted
alpar@38
    19
 * provided that this copyright notice appears in all copies. For
alpar@38
    20
 * precise terms see the accompanying LICENSE file.
alpar@38
    21
 *
alpar@38
    22
 * This software is provided \"AS IS\" with no warranty of any kind,
alpar@38
    23
 * express or implied, and with no claim as to its suitability for any
alpar@38
    24
 * purpose.
alpar@38
    25
 *
alpar@38
    26
 */
alpar@38
    27
"
alpar@38
    28
	awk 'BEGIN { pm=0; }
alpar@38
    29
     pm==3 { print }
alpar@38
    30
     /\/\* / && pm==0 { pm=1;}
alpar@38
    31
     /[^:blank:]/ && (pm==0 || pm==2) { pm=3; print;}
alpar@38
    32
     /\*\// && pm==1 { pm=2;}
alpar@38
    33
    ' $1
alpar@38
    34
	) >$TMP_FILE
alpar@38
    35
    rm $FILE_NAME
alpar@38
    36
    mv $TMP_FILE $FILE_NAME
alpar@38
    37
}
alpar@38
    38
alpar@38
    39
alpar@38
    40
if [ $# == 0 ]; then
alpar@38
    41
    echo -n Update all source files...
alpar@38
    42
    for i in `hg manifest|grep -E  '\.(cc|h|dox)$'`
alpar@38
    43
    do
alpar@38
    44
	update_file $HGROOT/$i
alpar@38
    45
    done
alpar@38
    46
    echo ' done.'
alpar@38
    47
else
alpar@38
    48
    for i in $*
alpar@38
    49
    do
alpar@38
    50
	update_file $i
alpar@38
    51
    done
alpar@38
    52
fi