# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../mmv/qd-fix.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---

--- ./mmv.c.orig	Mon Oct 25 11:29:39 1993
+++ ./mmv.c	Sat Mar 24 04:10:46 2001
@@ -126,7 +126,7 @@
 
 extern char *getenv();
 extern long lseek();
-extern char *malloc();
+extern void *malloc();
 
 #ifdef HAS_DIRENT
 #include <dirent.h>
@@ -390,7 +390,7 @@
 static int snap(/* REP *first, REP *p */);
 static void showdone(/* REP *fin */);
 static void breakout(/*  */);
-static int breakrep(/* */);
+static __sighandler_t breakrep(/* */);
 static void breakstat(/* */);
 static void quit(/*  */);
 static int copymove(/* REP *p */);
@@ -436,7 +436,7 @@
 static SLICER slicer[2] = {{NULL, NULL, 0}, {NULL, NULL, 0}};
 
 static int badreps = 0, paterr = 0, direrr, failed = 0, gotsig = 0, repbad;
-static FILE *outfile = stdout;
+static FILE *outfile;
 
 static char IDF[] = "$$mmvdid.";
 static char TEMP[] = "$$mmvtmp.";
@@ -497,6 +497,7 @@
 {
 	char *frompat, *topat;
 
+	outfile = stdout;
 	init();
 	procargs(argc, argv, &frompat, &topat);
 	domatch(frompat, topat);
@@ -2383,7 +2384,7 @@
 #ifdef IS_MSDOS
 	ctrlbrk(breakrep);
 #else
-	signal(SIGINT, breakrep);
+	signal(SIGINT, (void(*)(int))breakrep);
 #endif
 
 	for (first = hrep.r_next, k = 0; first != NULL; first = first->r_next) {
@@ -2578,10 +2579,10 @@
 }
 
 
-static int breakrep()
+static __sighandler_t breakrep()
 {
 	gotsig = 1;
-	return(1);
+	return(SIG_IGN);
 }
 
 
--- ./Makefile.orig	Mon Oct 25 11:35:35 1993
+++ ./Makefile	Sat Mar 24 04:05:06 2001
@@ -1,22 +1,20 @@
 # Possible defines in CONF:
 #	IS_MSDOS IS_SYSV IS_V7 IS_BSD HAS_DIRENT HAS_RENAME MV_DIR
 
-CC		=gcc -traditional
+CC		=gcc
 LD		=$(CC)
 CONF		=-DIS_SYSV -DHAS_DIRENT -DHAS_RENAME
-CFLAGS		=-O2 -m486 $(CONF)
-LDFLAGS		=-s -N
+CFLAGS		=-O2 $(CONF)
+LDFLAGS		=
 
-IBIN		=$(LOCAL)$(ARCH)/bin
-IMAN		=$(LOCAL)$(ANY)/man
+BINDIR = /usr/bin
+MANDIR = /usr/share/man/man1/
 
 mmv:		mmv.o
 
 clean:
 	rm -f mmv mmv.o
 
-install:	$(DEST)$(IBIN)/mmv
-install:	$(DEST)$(IMAN)/man1/mmv.1
-
-$(DEST)$(IBIN)/mmv:		mmv;	cp $? $@
-$(DEST)$(IMAN)/man1/mmv.1:	mmv.1;	cp $? $@
+install: mmv
+	install -s mmv $(BINDIR)
+	cp mmv.1 $(MANDIR)