diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2017-05-15 09:58:19 +0100 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2017-05-15 09:58:19 +0100 |
commit | ab16f768515c714660e8627eca3e350af70590c3 (patch) | |
tree | 2981dbc01da5143d0b91b4ce73c03cb1d819a0e7 | |
parent | 6e67937b51f5b52f0433e7d83e5dd14ac7456273 (diff) |
replace some string in code
-rwxr-xr-x | spice-server/sed.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spice-server/sed.sh b/spice-server/sed.sh new file mode 100755 index 0000000..1d8f157 --- /dev/null +++ b/spice-server/sed.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# replace a string with another in all sources (server +# directory) + +set -e + +error() { + echo "$@" >&2 + exit 1 +} + +from="$1" +to="$2" +test -n "$from" || error "From not specified" +test -n "$to" || error "To not specified" +cd server + +rm -f *.orig +for fn in *.[ch]; do + perl -pi.orig -e "s/\\b$from\\b/$to/g" $fn + if cmp -s $fn $fn.orig; then + mv -f $fn.orig $fn + fi +done +make -j3 +rm -f *.orig + +echo ok |