Script for updating the copyright headers
authorAlpar Juttner <alpar@cs.elte.hu>
Mon, 07 Jan 2008 14:12:55 +0100
changeset 38a0cd9917c5a2
parent 37 582c594ecd01
child 39 0a01d811071f
Script for updating the copyright headers
scripts/update-copyright-header.sh
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/update-copyright-header.sh	Mon Jan 07 14:12:55 2008 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +#!/bin/bash
     1.5 +
     1.6 +YEAR=`date +2003-%Y`
     1.7 +HGROOT=`hg root`
     1.8 +
     1.9 +function update_file() {
    1.10 +    TMP_FILE=`mktemp`
    1.11 +    FILE_NAME=$1
    1.12 +
    1.13 +    (echo "/* -*- C++ -*-
    1.14 + *
    1.15 + * This file is a part of LEMON, a generic C++ optimization library
    1.16 + *
    1.17 + * Copyright (C) "$YEAR"
    1.18 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.19 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.20 + *
    1.21 + * Permission to use, modify and distribute this software is granted
    1.22 + * provided that this copyright notice appears in all copies. For
    1.23 + * precise terms see the accompanying LICENSE file.
    1.24 + *
    1.25 + * This software is provided \"AS IS\" with no warranty of any kind,
    1.26 + * express or implied, and with no claim as to its suitability for any
    1.27 + * purpose.
    1.28 + *
    1.29 + */
    1.30 +"
    1.31 +	awk 'BEGIN { pm=0; }
    1.32 +     pm==3 { print }
    1.33 +     /\/\* / && pm==0 { pm=1;}
    1.34 +     /[^:blank:]/ && (pm==0 || pm==2) { pm=3; print;}
    1.35 +     /\*\// && pm==1 { pm=2;}
    1.36 +    ' $1
    1.37 +	) >$TMP_FILE
    1.38 +    rm $FILE_NAME
    1.39 +    mv $TMP_FILE $FILE_NAME
    1.40 +}
    1.41 +
    1.42 +
    1.43 +if [ $# == 0 ]; then
    1.44 +    echo -n Update all source files...
    1.45 +    for i in `hg manifest|grep -E  '\.(cc|h|dox)$'`
    1.46 +    do
    1.47 +	update_file $HGROOT/$i
    1.48 +    done
    1.49 +    echo ' done.'
    1.50 +else
    1.51 +    for i in $*
    1.52 +    do
    1.53 +	update_file $i
    1.54 +    done
    1.55 +fi