scripts/update-copyright-header.sh
changeset 76 fc178a057bbd
equal deleted inserted replaced
-1:000000000000 0:4ea6e8a6b8a7
       
     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