Add check for swprintf() and a workaround when it is missing
[pacman-ng.git] / contrib / pacdiff
blob64936491191d216bd68f9a4703736b1ea435c2b5
1 #!/bin/sh
2 # pacdiff : a simple pacnew/pacorig/pacsave updater for /etc/
4 # Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # Original http://phraktured.net/config/bin/pacdiff
22 diffprog=${DIFFPROG:-vimdiff}
23 for x in $(find /etc/ -name "*.pacnew" -o -name "*.pacorig" -o -name "*.pacsave")
25 echo "File: ${x%.pac*}"
26 chk="$(cmp $x ${x%.pac*})"
27 if [ -z "${chk}" ]; then
28 echo " Files are identical, removing..."
29 rm $x
30 else
31 echo -n " File differences found. (V)iew, (S)kip, (R)emove: [v/s/r] "
32 read c
33 c="$(echo $c| tr A-Z a-z)" #tolower
34 if [ "$c" = "r" ]; then
35 rm $x
36 elif [ "$c" = "s" ]; then
37 continue
38 else
39 [ "$c" = "n" -o "$c" = "N" ] || $diffprog $x ${x%.pac*}
40 echo -n " Remove file? [Y/n] "
41 read c
42 [ "$c" = "n" -o "$c" = "N" ] || rm $x
45 done