+++ /dev/null
-#!/bin/bash
-original_file=$1
-new_file=$2
-
-if [ -z "$(diff -q "$original_file" "$new_file")" ]
-then
- echo "Les fichiers sont identiques, aucune modification apportée."
-else
- # COMPARISON
- diff -D allo_change "$original_file" "$new_file" > /tmp/tmpfile
-
- # MAGIC (uggly but works...)
- sed -e 's/\(.*\)ADD_VALUE/allo_change\n\1\n^#else allo_change/' /tmp/tmpfile > /tmp/tmpfile2
- sed -e 's/\(.*\)REWRITE/allo_change\n\1REWRITE\n^#else allo_change/' /tmp/tmpfile2 > /tmp/tmpfile1
- sed '/^#else/,/allo_change/d' /tmp/tmpfile1 | sed '/^#ifdef/,/allo_change/d' | sed '/allo_change/d' > /tmp/tmpfile2
- sed -e 's/\(.*\)REWRITE/DELETE\n\1/' /tmp/tmpfile2 > /tmp/tmpfile
- awk '{l[m=NR]=$0}/DELETE/{for(i=NR-1;i<=NR;i++)delete l[i]}END{for(i=1;i<=m;i++)if(i in l)print l[i]}' /tmp/tmpfile > $new_file
- rm /tmp/tmpfile*
-fi