1 Description: Patches as of mmv 1.01b-15
2 This patch contains the patches as of mmv 1.01b-15 when it has been
3 converted to the source format "3.0 (quilt)"
4 Author: Multiple Authors. See changelog for details.
5 Reviewed-By: Axel Beckert <abe@debian.org>
6 Last-Update: 2012-09-16
8 --- mmv-1.01b.orig/mmv.c
10 @@ -62,7 +62,8 @@ static char USAGE[] =
11 %s [-m|x%s|c|o|a|z] [-h] [-d|p] [-g|t] [-v|n] [from to]\n\
13 Use #N in the ``to'' pattern to get the string matched\n\
14 -by the N'th ``from'' pattern wildcard.\n";
15 +by the N'th ``from'' pattern wildcard.\n\
16 +Use -- as the end of options.\n";
18 #define OTHEROPT (_osmajor < 3 ? "" : "|r")
20 @@ -75,7 +76,9 @@ Use #[l|u]N in the ``to'' pattern to get
21 string matched by the N'th ``from'' pattern wildcard.\n\
23 A ``from'' pattern containing wildcards should be quoted when given\n\
24 -on the command line.\n";
25 +on the command line. Also you may need to quote ``to'' pattern.\n\
27 +Use -- as the end of options.\n";
31 @@ -85,6 +88,7 @@ on the command line.\n";
39 @@ -120,14 +124,12 @@ extern unsigned _stklen = 10000;
41 /* for various flavors of UN*X */
45 #include <sys/types.h>
49 -extern char *getenv();
51 -extern char *malloc();
55 typedef struct dirent DIRENTRY;
56 @@ -390,7 +392,7 @@ static int movealias(/* REP *first, REP
57 static int snap(/* REP *first, REP *p */);
58 static void showdone(/* REP *fin */);
59 static void breakout(/* */);
60 -static int breakrep(/* */);
61 +static void breakrep(int);
62 static void breakstat(/* */);
63 static void quit(/* */);
64 static int copymove(/* REP *p */);
65 @@ -436,9 +438,11 @@ static CHUNK *freechunks = NULL;
66 static SLICER slicer[2] = {{NULL, NULL, 0}, {NULL, NULL, 0}};
68 static int badreps = 0, paterr = 0, direrr, failed = 0, gotsig = 0, repbad;
69 -static FILE *outfile = stdout;
70 +static FILE *outfile;
73 static char IDF[] = "$$mmvdid.";
75 static char TEMP[] = "$$mmvtmp.";
76 static char TOOLONG[] = "(too long)";
77 static char EMPTY[] = "(empty)";
78 @@ -456,12 +460,12 @@ char pathbuf[MAXPATH];
79 char fullrep[MAXPATH + 1];
80 static char *(start[MAXWILD]);
81 static int len[MAXWILD];
82 -static char hasdot[MAXWILD];
84 #define MISTAKE (&mistake)
88 +static char hasdot[MAXWILD];
89 static int olddevflag, curdisk, maxdisk;
92 @@ -497,6 +501,8 @@ int main(argc, argv)
94 char *frompat, *topat;
99 procargs(argc, argv, &frompat, &topat);
100 domatch(frompat, topat);
101 @@ -560,7 +566,7 @@ static void procargs(argc, argv, pfrompa
102 char **pfrompat, **ptopat;
105 - char *cmdname = argv[0];
106 + char *cmdname = basename(argv[0]);
109 #define CMDNAME (patch.ph_name)
110 @@ -575,6 +581,11 @@ static void procargs(argc, argv, pfrompa
111 for (argc--, argv++; argc > 0 && **argv == '-'; argc--, argv++)
112 for (p = *argv + 1; *p != '\0'; p++) {
119 if (c == 'v' && !noex)
121 else if (c == 'n' && !verbose)
122 @@ -618,7 +629,8 @@ static void procargs(argc, argv, pfrompa
129 if (strcmp(cmdname, MOVENAME) == 0)
131 else if (strcmp(cmdname, COPYNAME) == 0)
132 @@ -629,6 +641,8 @@ static void procargs(argc, argv, pfrompa
141 @@ -775,7 +789,7 @@ static void matchpat()
142 static int parsepat()
144 char *p, *lastname, c;
145 - int totwilds, instage, x, havedot;
146 + int totwilds, instage, x;
147 static char TRAILESC[] = "%s -> %s : trailing %c is superfluous.\n";
150 @@ -999,20 +1013,16 @@ static int parsepat()
151 printf(TRAILESC, from, to, ESC);
158 c <= ' ' || c >= 127 ||
159 strchr(":/\\*?[]=+;,\"|<>", c) != NULL
164 printf("%s -> %s : illegal character '%c' (0x%02X).\n",
170 *p = c + ('a' - 'A');
172 @@ -1042,7 +1052,7 @@ static int dostage(lastend, pathend, sta
175 int prelen, litlen, nfils, i, k, flags, try;
176 - FILEINFO **pf, *fdel;
177 + FILEINFO **pf, *fdel = NULL;
178 char *nto, *firstesc;
180 int wantdirs, ret = 1, laststage = (stage + 1 == nstages);
181 @@ -1172,11 +1182,12 @@ static int trymatch(ffrom, pat)
182 if (*p == '.' || (!matchall && ffrom->fi_attrib & (FA_HIDDEN | FA_SYSTEM)))
183 return(strcmp(pat, p) == 0);
187 if (p[1] == '\0' || (p[1] == '.' && p[2] == '\0'))
188 return(strcmp(pat, p) == 0);
189 else if (!matchall && *pat != '.')
195 @@ -1312,7 +1323,7 @@ static int checkto(hfrom, f, phto, pnto,
197 char tpath[MAXPATH + 1];
200 + FILEINFO *fdel = NULL;
204 @@ -1405,7 +1416,9 @@ static char *getpath(tpath)
205 static int badname(s)
214 @@ -1715,20 +1728,19 @@ static HANDLE *checkdir(p, pathend, whic
218 - DIRINFO **newdirs, *di;
221 + DIRINFO *di = NULL;
222 char *myp, *lastslash = NULL;
226 - if (hsearch(p, which, &h))
227 + if (hsearch(p, which, &h)) {
228 if (h->h_di == NULL) {
238 @@ -1899,7 +1911,10 @@ static int match(pat, s, start1, len1)
239 char *pat, *s, **start1;
250 @@ -2376,9 +2391,9 @@ static void goonordie()
254 - int k, printaliased = 0, alias;
255 + int k, printaliased = 0, alias = 0;
258 + long aliaslen = 0l;
262 @@ -2396,11 +2411,12 @@ static void doreps()
264 strcpy(fullrep, p->r_hto->h_name);
265 strcat(fullrep, p->r_nto);
266 - if (!noex && (p->r_flags & R_ISCYCLE))
267 + if (!noex && (p->r_flags & R_ISCYCLE)) {
269 aliaslen = appendalias(first, p, &printaliased);
271 alias = movealias(first, p, &printaliased);
273 strcpy(pathbuf, p->r_hfrom->h_name);
274 fstart = pathbuf + strlen(pathbuf);
275 if ((p->r_flags & R_ISALIASED) && !(op & APPEND))
276 @@ -2459,7 +2475,7 @@ static long appendalias(first, p, pprint
285 @@ -2578,10 +2594,10 @@ static void breakout()
289 -static int breakrep()
290 +static void breakrep(int signum)
298 @@ -2624,11 +2640,12 @@ static int copymove(p)
300 static int copy(ff, len)
305 - char buf[BUFSIZE], c;
307 int f, t, k, mode, perm;
313 @@ -2672,7 +2689,7 @@ static int copy(ff, len)
318 + lseek(t, (off_t)0, SEEK_END);
320 if (op & ZAPPEND && filelength(t) != 0) {
321 if (lseek(t, -1L, 1) == -1L || read(t, &c, 1) != 1) {
322 @@ -2684,10 +2701,10 @@ static int copy(ff, len)
326 - if ((op & APPEND) && len != -1L) {
327 + if ((op & APPEND) && len != (off_t)-1) {
330 - (k = read(f, buf, len > BUFSIZE ? BUFSIZE : (unsigned)len)) > 0 &&
331 + (k = read(f, buf, (len > BUFSIZE) ? BUFSIZE : (size_t)len)) > 0 &&
332 write(t, buf, k) == k
335 @@ -2711,7 +2728,9 @@ static int copy(ff, len)
336 tim.modtime = fstat.st_mtime,
338 tim[0].tv_sec = fstat.st_atime,
339 + tim[0].tv_usec = 0,
340 tim[1].tv_sec = fstat.st_mtime,
341 + tim[1].tv_usec = 0,
345 --- mmv-1.01b.orig/mmv.1
348 .\" To print the MS-DOS version, use option -rO2.
349 .\" Under System V, take out the '.\" ' from the next line.
351 -.TH MMV 1 "November 20, 1989 (v1.0)"
352 +.TH MMV 1 "November 20, 2001 (v1.0lfs)"
355 mmv \- move/copy/append/link multiple files by wildcard patterns
356 @@ -21,13 +21,14 @@ mmv \- move/copy/append multiple files b
360 -.if '\nO'2' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBz\fP]
361 -.if '\nO'0' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP|\fBs\fP]
362 -.if '\nO'1' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP]
367 +.if '\nO'2' [\fB\-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBz\fP]
368 +.if '\nO'0' [\fB\-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP|\fBs\fP]
369 +.if '\nO'1' [\fB\-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP]
378 @@ -56,6 +57,9 @@ from the entire set of actions specified
379 and gives the user the choice of either
380 proceeding by avoiding the offending parts
383 +does support large files (LFS) but it does *NOT* support
384 +sparse files (i.e. it explodes them).
388 @@ -71,7 +75,7 @@ If none of these are specified,
390 a default (patchable by
397 @@ -81,18 +85,18 @@ was invoked (argv[0]):
399 command name default task
414 The task option choices are:
418 move source file to target name.
419 Both must be on the same device.
420 Will not move directories.
421 @@ -102,8 +106,8 @@ moves the link without checking if the l
422 directory is different than the old.
426 -same as -m, except cross-device moves are done
428 +same as \-m, except cross-device moves are done
429 by copying, then deleting source.
430 When copying, sets the
431 .ie !'\nO'2' permission bits
432 @@ -111,7 +115,7 @@ When copying, sets the
433 and file modification time
434 of the target file to that of the source file.
438 rename source file or directory to target name.
439 The target name must not include a path:
440 the file remains in the same directory in all cases.
441 @@ -119,7 +123,7 @@ This option is the only way of renaming
443 .if '\nO'2' It is only available under DOS version 3.0 or higher.
447 copy source file to target name.
448 Sets the file modification time and
449 .ie !'\nO'2' permission bits
450 @@ -128,7 +132,7 @@ of the target file to that of the source
451 regardless of whether the target file already exists.
452 Chains and cycles (to be explained below) are not allowed.
456 overwrite target name with source file.
458 If target file exists, its attributes are left unchanged.
459 @@ -146,38 +150,38 @@ and the execute permission bits copied f
460 In either case, the file modification time is set to the current time.
465 append contents of source file to target name.
466 Target file modification time is set to the current time.
467 If target file does not exist,
469 .ie '\nO'2' attributes
472 -Unlike all other options, -a allows multiple source files to have the
473 -same target name, e.g. "mmv -a
475 +Unlike all other options, \-a allows multiple source files to have the
476 +same target name, e.g. "mmv \-a
479 big" will append all ".c" files to "big".
480 -Chains and cycles are also allowed, so "mmv -a f f" will double up "f".
481 +Chains and cycles are also allowed, so "mmv \-a f f" will double up "f".
485 -same as -a, but if the target file exists, and its last character is a ^Z,
487 +same as \-a, but if the target file exists, and its last character is a ^Z,
488 and the source file is not empty,
489 this ^Z is truncated before doing the append.
495 link target name to source file.
496 Both must be on the same device,
497 and the source must not be a directory.
498 Chains and cycles are not allowed.
502 -same as -l, but use symbolic links instead of hard links.
504 +same as \-l, but use symbolic links instead of hard links.
505 For the resulting link to aim back at the source,
506 either the source name must begin with a '/',
507 or the target must reside in either the current or the source directory.
508 @@ -190,7 +194,7 @@ and the source can be a directory.
509 Only one of these option may be given,
510 and it applies to all matching files.
511 Remaining options need not be given separately,
512 -i.e. "mmv -mk" is allowed.
513 +i.e. "mmv \-mk" is allowed.
516 Multiple Pattern Pairs
517 @@ -232,7 +236,7 @@ a b
521 -would give the error message "a -> c : no match" because file "a"
522 +would give the error message "a \-> c : no match" because file "a"
524 was already matched by the first pattern pair.
526 @@ -255,10 +259,10 @@ matching any single character,
527 and matching any one of a set of characters.
529 Between the '[' and ']', a range from character 'a' through character 'z'
530 -is specified with "a-z".
531 +is specified with "a\-z".
532 The set of matching characters can be negated by inserting
535 +Thus, "[^b\-e2\-5_]"
536 will match any character but 'b' through 'e', '2' through '5', and '_'.
539 @@ -305,13 +309,13 @@ However, the '~' is not treated as a wil
540 in the sense that it is not assigned a wildcard index (see below).
543 -Since matching a directory under a task option other than -r or -s
544 +Since matching a directory under a task option other than \-r or \-s
545 would result in an error,
546 -tasks other than -r and -s
547 +tasks other than \-r and \-s
548 match directories only against completely explicit
550 patterns (i.e. not containing wildcards).
551 -Under -r and -s, this applies only to "." and "..".
552 +Under \-r and \-s, this applies only to "." and "..".
555 Hidden and system files are also only matched
556 @@ -324,7 +328,7 @@ Files beginning with '.' are only matche
558 patterns that begin with an explicit '.'.
560 -However, if -h is specified, they are matched normally.
561 +However, if \-h is specified, they are matched normally.
564 Warning: since the shell normally expands wildcards
565 @@ -332,8 +336,9 @@ before passing the command-line argument
567 it is usually necessary to enclose the command-line
577 @@ -363,7 +368,7 @@ pattern is "abc*.*" and the
578 pattern is "xyz#2.#1",
579 then "abc.txt" is targeted to "xyztxt.".
580 (The first '*' matched "", and the second matched "txt".)
581 -Similarly, for the pattern pair ";*.[clp]" -> "#1#3\*(SL#2",
582 +Similarly, for the pattern pair ";*.[clp]" \-> "#1#3\*(SL#2",
583 "foo1\*(SLfoo2\*(SLprog.c" is targeted to "foo1\*(SLfoo2\*(SLc\*(SLprog".
584 Note that there is no '\*(SL' following the "#1" in the
586 @@ -397,7 +402,7 @@ expands the '~' in the exact same manner
587 does not expand it at all).
590 -For all task options other than -r, if the target name is a directory,
591 +For all task options other than \-r, if the target name is a directory,
592 the real target name is formed by appending
593 a '\*(SL' followed by the last component
594 of the source file name.
595 @@ -434,7 +439,7 @@ a b
599 -specifies the chain "a" -> "b" -> "c".
600 +specifies the chain "a" \-> "b" \-> "c".
601 A cycle is a chain where the last target name
602 refers back to the first source file,
604 @@ -461,9 +466,9 @@ Furthermore,
606 checks if any of its actions will result
607 in the destruction of existing files.
608 -If the -d (delete) option is specified,
609 +If the \-d (delete) option is specified,
610 all file deletions or overwrites are done silently.
611 -Under -p (protect), all deletions or overwrites
612 +Under \-p (protect), all deletions or overwrites
613 (except those specified with "(*)" on the standard input, see below)
614 are treated as errors.
615 And if neither option is specified,
616 @@ -487,16 +492,16 @@ Once all errors are detected,
617 queries the user whether he wishes
618 to continue by avoiding the erroneous actions or to abort altogether.
619 This and all other queries may be avoided by specifying either the
620 --g (go) or -t (terminate) option.
621 +\-g (go) or \-t (terminate) option.
622 The former will resolve all difficulties by avoiding the erroneous actions;
623 the latter will abort
625 if any errors are detected.
626 Specifying either of them defaults
628 -to -p, unless -d is specified
629 +to \-p, unless \-d is specified
631 -Thus, -g and -t are most useful when running
632 +Thus, \-g and \-t are most useful when running
634 in the background or in
636 @@ -508,28 +513,28 @@ Reports
637 Once the actions to be performed are determined,
639 performs them silently,
640 -unless either the -v (verbose) or -n (no-execute) option is specified.
641 +unless either the \-v (verbose) or \-n (no-execute) option is specified.
644 to report each performed action
645 on the standard output as
650 Here, "a" and "b" would be replaced by the source and target names,
652 If the action deletes the old target,
653 a "(*)" is inserted after the the target name.
654 -Also, the "->" symbol is modified when a cycle has to be broken:
655 +Also, the "\->" symbol is modified when a cycle has to be broken:
656 the '>' is changed to a '^' on the action prior to which the old target
657 is renamed to a temporary,
658 -and the '-' is changed to a '=' on the action where the temporary is used.
659 +and the '\-' is changed to a '=' on the action where the temporary is used.
661 -Under -n, none of the actions are performed,
662 +Under \-n, none of the actions are performed,
663 but messages like the above are printed on the standard output
664 with the ": done." omitted.
666 -The output generated by -n can (after editing, if desired)
667 +The output generated by \-n can (after editing, if desired)
670 on the standard input
671 @@ -545,9 +550,9 @@ To facilitate this,
672 ignores lines on the standard input that look
673 like its own error and "done" messages,
674 as well as all lines beginning with white space,
675 -and will accept pattern pairs with or without the intervening "->"
676 -(or "-^", "=>", or "=^").
677 -Lines with "(*)" after the target pattern have the effect of enabling -d
678 +and will accept pattern pairs with or without the intervening "\->"
679 +(or "\-^", "=>", or "=^").
680 +Lines with "(*)" after the target pattern have the effect of enabling \-d
681 for the files matching this pattern only,
682 so that such deletions are done silently.
684 @@ -596,11 +601,11 @@ on a copy of
689 + \-x, \-m, \-r mmv.exe
698 also determines the best way to uniquely identify directories.
699 --- mmv-1.01b.orig/Makefile
700 +++ mmv-1.01b/Makefile
702 # Possible defines in CONF:
703 # IS_MSDOS IS_SYSV IS_V7 IS_BSD HAS_DIRENT HAS_RENAME MV_DIR
705 -CC =gcc -traditional
708 CONF =-DIS_SYSV -DHAS_DIRENT -DHAS_RENAME
709 -CFLAGS =-O2 -m486 $(CONF)
713 #IBIN =$(LOCAL)$(ARCH)/bin