Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 5061f77de52746bb0415efa957819dda > files > 4

mmv-1.01b-13.mga3.src.rpm

--- mmv-1.01b.orig/mmv.c	1993-10-25 06:29:39.000000000 -0400
+++ mmv-1.01b/mmv.c	2005-08-23 20:25:08.000000000 -0400
@@ -62,7 +62,8 @@
 %s [-m|x%s|c|o|a|z] [-h] [-d|p] [-g|t] [-v|n] [from to]\n\
 \n\
 Use #N in the ``to'' pattern to get the string matched\n\
-by the N'th ``from'' pattern wildcard.\n";
+by the N'th ``from'' pattern wildcard.\n\
+Use -- as the end of options.\n";
 
 #define OTHEROPT (_osmajor < 3 ? "" : "|r")
 
@@ -75,7 +76,9 @@
 string matched by the N'th ``from'' pattern wildcard.\n\
 \n\
 A ``from'' pattern containing wildcards should be quoted when given\n\
-on the command line.\n";
+on the command line. Also you may need to quote ``to'' pattern.\n\
+\n\
+Use -- as the end of options.\n";
 
 #ifdef IS_SYSV
 #define OTHEROPT ""
@@ -85,6 +88,7 @@
 
 #endif
 
+#include <unistd.h>
 #include <stdio.h>
 #include <ctype.h>
 
@@ -120,14 +124,11 @@
 #else
 /* for various flavors of UN*X */
 
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/file.h>
 
-extern char *getenv();
-extern long lseek();
-extern char *malloc();
-
 #ifdef HAS_DIRENT
 #include <dirent.h>
 typedef struct dirent DIRENTRY;
@@ -390,7 +391,7 @@
 static int snap(/* REP *first, REP *p */);
 static void showdone(/* REP *fin */);
 static void breakout(/*  */);
-static int breakrep(/* */);
+static void breakrep(int);
 static void breakstat(/* */);
 static void quit(/*  */);
 static int copymove(/* REP *p */);
@@ -436,7 +437,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 +498,8 @@
 {
 	char *frompat, *topat;
 
+	outfile = stdout;
+
 	init();
 	procargs(argc, argv, &frompat, &topat);
 	domatch(frompat, topat);
@@ -575,6 +578,11 @@
 	for (argc--, argv++; argc > 0 && **argv == '-'; argc--, argv++)
 		for (p = *argv + 1; *p != '\0'; p++) {
 			c = mylower(*p);
+			if (c == '-') {
+				argc--;
+				argv++;
+				goto endargs;
+			}
 			if (c == 'v' && !noex)
 				verbose = 1;
 			else if (c == 'n' && !verbose)
@@ -618,6 +626,7 @@
 			}
 		}
 
+endargs:
 	if (op == DFLT)
 		if (strcmp(cmdname, MOVENAME) == 0)
 			op = XMOVE;
@@ -999,20 +1008,16 @@
 				printf(TRAILESC, from, to, ESC);
 				return(-1);
 			}
+#ifdef IS_MSDOS
 		default:
 			if (
-#ifdef IS_MSDOS
 				c <= ' ' || c >= 127 ||
 				strchr(":/\\*?[]=+;,\"|<>", c) != NULL
-#else
-				c & 0x80
-#endif
 			) {
 				printf("%s -> %s : illegal character '%c' (0x%02X).\n",
 					from, to, c, c);
 				return(-1);
 			}
-#ifdef IS_MSDOS
 			if (isupper(c))
 				*p = c + ('a' - 'A');
 #endif
@@ -2578,10 +2583,10 @@
 }
 
 
-static int breakrep()
+static void breakrep(int signum)
 {
 	gotsig = 1;
-	return(1);
+	return;
 }
 
 
@@ -2624,7 +2629,7 @@
 
 static int copy(ff, len)
 	FILEINFO *ff;
-	long len;
+	off_t len;
 {
 	char buf[BUFSIZE], c;
 	int f, t, k, mode, perm;
@@ -2672,7 +2677,7 @@
 		return(-1);
 	}
 	if (op & APPEND)
-		lseek(t, 0L, 2);
+		lseek(t, (off_t)0, SEEK_END);
 #ifdef IS_MSDOS
 	if (op & ZAPPEND && filelength(t) != 0) {
 		if (lseek(t, -1L, 1) == -1L || read(t, &c, 1) != 1) {
@@ -2684,10 +2689,10 @@
 			lseek(t, -1L, 1);
 	}
 #endif
-	if ((op & APPEND) && len != -1L) {
+	if ((op & APPEND) && len != (off_t)-1) {
 		while (
 			len != 0 &&
-			(k = read(f, buf, len > BUFSIZE ? BUFSIZE : (unsigned)len)) > 0 &&
+			(k = read(f, buf, (len > BUFSIZE) ? BUFSIZE : (size_t)len)) > 0 &&
 			write(t, buf, k) == k
 		)
 			len -= k;
--- mmv-1.01b.orig/mmv.1	1990-09-11 15:59:24.000000000 -0400
+++ mmv-1.01b/mmv.1	2005-08-23 20:29:59.000000000 -0400
@@ -2,7 +2,7 @@
 .\" To print the MS-DOS version, use option -rO2.
 .\" Under System V, take out the '.\"  ' from the next line.
 .\" .nr O 1
-.TH MMV 1 "November 20, 1989 (v1.0)"
+.TH MMV 1 "November 20, 2001 (v1.0lfs)"
 .ie !'\nO'2' \{\
 .SH NAME
 mmv \- move/copy/append/link multiple files by wildcard patterns
@@ -28,6 +28,7 @@
 [\fB-d\fP|\fBp\fP]
 [\fB-g\fP|\fBt\fP]
 [\fB-v\fP|\fBn\fP]
+[\fB--\fP]
 [\fBfrom to\fP]
 .if '\nO'2' \{\
 .br
@@ -56,7 +57,8 @@
 and gives the user the choice of either
 proceeding by avoiding the offending parts
 or aborting.
-
+.I mmv does support large files (LFS) but it does *NOT* support 
+sparse files (i.e. it explodes them).
 .ce
 The Task Options
 .PP
@@ -332,8 +334,9 @@
 .IR mmv ,
 it is usually necessary to enclose the command-line
 .I from
-pattern
-in quotes.
+and
+.I to
+patterns in quotes.
 \}
 
 .ce