Author: Isomer <Isomer@undernet.org>
[ircu2.10.12-pk.git] / ircd-patch
index f91c1bafb83b9df3c1e4310dc0843866bd5d8288..cdfe53ae5e035283dd9d73d675b15274d9731b61 100755 (executable)
@@ -1,11 +1,27 @@
 #!/bin/sh
 #
-# ircd-patch
+# IRC - Internet Relay Chat, ircd-patch
 # Copyright (C) 2002 Alex Badea <vampire@p16.pub.ro>
 #
-# $Id: ircd-patch,v 1.3 2002-04-02 11:24:29 isomer Exp $
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 1, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# $Id: ircd-patch,v 1.5 2002-04-12 13:00:35 vampire Exp $
+#
 #
 # Experimental centralized patch system for ircu
+# Run with no arguments to get help.
 #
 # Return codes:
 #   0 - success
@@ -43,7 +59,8 @@ update_patchlist() {
 [ ! -d $MARKS ] && (echo "*** Missing $MARKS, creating it" ; mkdir -p $MARKS)
 
 dry_run() {
-       patch -p0 -N -t --dry-run $2 >/dev/null < $1
+       rejects=`patch -p0 -N -t --dry-run $2 < $1 | grep "hunk FAILED" | sed -e 's/.*to file /  /;s/\.rej$//'`
+       test -z "$rejects"
 }
 
 patch_list() {
@@ -102,6 +119,8 @@ patch_add() {
                echo -n "Testing $fname... "
                if ! dry_run $fname ; then
                        echo "Failed (use -f to force)."
+                       echo "The following files failed patching:"
+                       echo "$rejects"
                        retcode=2
                        return
                fi
@@ -137,6 +156,8 @@ patch_del() {
                echo -n "Testing $fname... "
                if ! dry_run $fname -R ; then
                        echo "Failed (use -f to force)."
+                       echo "The following files failed patching:"
+                       echo "$rejects"
                        retcode=2
                        return
                fi