--- mmv-1.01b.orig/mmv.1 +++ mmv-1.01b/mmv.1 @@ -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 --- mmv-1.01b.orig/mmv.c +++ mmv-1.01b/mmv.c @@ -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 #include #include @@ -120,14 +124,11 @@ #else /* for various flavors of UN*X */ +#include #include #include #include -extern char *getenv(); -extern long lseek(); -extern char *malloc(); - #ifdef HAS_DIRENT #include 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,9 +437,11 @@ 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; +#ifdef IS_MSDOS static char IDF[] = "$$mmvdid."; +#endif static char TEMP[] = "$$mmvtmp."; static char TOOLONG[] = "(too long)"; static char EMPTY[] = "(empty)"; @@ -456,12 +459,12 @@ char fullrep[MAXPATH + 1]; static char *(start[MAXWILD]); static int len[MAXWILD]; -static char hasdot[MAXWILD]; static REP mistake; #define MISTAKE (&mistake) #ifdef IS_MSDOS +static char hasdot[MAXWILD]; static int olddevflag, curdisk, maxdisk; static struct { char ph_banner[30]; @@ -497,6 +500,8 @@ { char *frompat, *topat; + outfile = stdout; + init(); procargs(argc, argv, &frompat, &topat); domatch(frompat, topat); @@ -575,6 +580,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,7 +628,8 @@ } } - if (op == DFLT) +endargs: + if (op == DFLT) { if (strcmp(cmdname, MOVENAME) == 0) op = XMOVE; else if (strcmp(cmdname, COPYNAME) == 0) @@ -629,6 +640,8 @@ op = HARDLINK; else op = DFLTOP; + } + if ( op & DIRMOVE && #ifdef IS_MSDOS @@ -775,7 +788,7 @@ static int parsepat() { char *p, *lastname, c; - int totwilds, instage, x, havedot; + int totwilds, instage, x; static char TRAILESC[] = "%s -> %s : trailing %c is superfluous.\n"; lastname = from; @@ -999,20 +1012,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 @@ -1042,7 +1051,7 @@ DIRINFO *di; HANDLE *h, *hto; int prelen, litlen, nfils, i, k, flags, try; - FILEINFO **pf, *fdel; + FILEINFO **pf, *fdel = NULL; char *nto, *firstesc; REP *p; int wantdirs, ret = 1, laststage = (stage + 1 == nstages); @@ -1172,11 +1181,12 @@ if (*p == '.' || (!matchall && ffrom->fi_attrib & (FA_HIDDEN | FA_SYSTEM))) return(strcmp(pat, p) == 0); #else - if (*p == '.') + if (*p == '.') { if (p[1] == '\0' || (p[1] == '.' && p[2] == '\0')) return(strcmp(pat, p) == 0); else if (!matchall && *pat != '.') return(0); + } #endif return(-1); } @@ -1312,7 +1322,7 @@ { char tpath[MAXPATH + 1]; char *pathend; - FILEINFO *fdel; + FILEINFO *fdel = NULL; int hlen, tlen; if (op & DIRMOVE) { @@ -1405,7 +1415,9 @@ static int badname(s) char *s; { +#ifdef IS_MSDOS char *ext; +#endif return ( #ifdef IS_MSDOS @@ -1715,20 +1727,19 @@ struct stat dstat; DIRID d; DEVID v; - DIRINFO **newdirs, *di; - int nfils; - FILEINFO **fils; + DIRINFO *di = NULL; char *myp, *lastslash = NULL; int sticky; HANDLE *h; - if (hsearch(p, which, &h)) + if (hsearch(p, which, &h)) { if (h->h_di == NULL) { direrr = h->h_err; return(NULL); } else return(h); + } if (*p == '\0') myp = "."; @@ -1899,7 +1910,10 @@ char *pat, *s, **start1; int *len1; { - char c, *olds; + char c; +#ifdef IS_MSDOS + char *olds; +#endif *start1 = 0; for(;;) @@ -2376,9 +2390,9 @@ static void doreps() { char *fstart; - int k, printaliased = 0, alias; + int k, printaliased = 0, alias = 0; REP *first, *p; - long aliaslen; + long aliaslen = 0l; #ifdef IS_MSDOS ctrlbrk(breakrep); @@ -2396,11 +2410,12 @@ } strcpy(fullrep, p->r_hto->h_name); strcat(fullrep, p->r_nto); - if (!noex && (p->r_flags & R_ISCYCLE)) + if (!noex && (p->r_flags & R_ISCYCLE)) { if (op & APPEND) aliaslen = appendalias(first, p, &printaliased); else alias = movealias(first, p, &printaliased); + } strcpy(pathbuf, p->r_hfrom->h_name); fstart = pathbuf + strlen(pathbuf); if ((p->r_flags & R_ISALIASED) && !(op & APPEND)) @@ -2459,7 +2474,7 @@ REP *first, *p; int *pprintaliased; { - long ret; + long ret = 0l; #ifdef IS_MSDOS int fd; @@ -2578,10 +2593,10 @@ } -static int breakrep() +static void breakrep(int signum) { gotsig = 1; - return(1); + return; } @@ -2624,11 +2639,12 @@ static int copy(ff, len) FILEINFO *ff; - long len; + off_t len; { - char buf[BUFSIZE], c; + char buf[BUFSIZE]; int f, t, k, mode, perm; #ifdef IS_MSDOS + char c; struct ftime tim; #else #ifdef IS_SYSV @@ -2672,7 +2688,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 +2700,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/Makefile +++ mmv-1.01b/Makefile @@ -1,10 +1,10 @@ # 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) +CFLAGS =-O2 $(CONF) LDFLAGS =-s -N #IBIN =$(LOCAL)$(ARCH)/bin --- mmv-1.01b.orig/debian/changelog +++ mmv-1.01b/debian/changelog @@ -0,0 +1,133 @@ +mmv (1.01b-14) unstable; urgency=low + + * Thanks for NMU to Joey, Ai and Uwe + * applied Patch to initialize var (Closes: Bug #316363) + * removed 2 dozent GCC warnings (uninitialized, unused, ambiquous else) + + -- Bernd Eckenfels Sat, 04 Feb 2006 23:58:43 +0100 + +mmv (1.01b-12.3) unstable; urgency=low + + * NMU + * Remove postinst and prerm, finishing /usr/doc transition. Closes: #322813 + + -- Joey Hess Tue, 10 Jan 2006 00:54:51 -0500 + +mmv (1.01b-12.2) unstable; urgency=low + + * NMU + * Fix segfault at startup on amd64 (and possibly other architectures) + due to implicit declaration of functions from stdlib.h. (Closes: #322541) + + -- Ari Pollak Sat, 13 Aug 2005 01:01:13 -0400 + +mmv (1.01b-12.1) unstable; urgency=low + + * Non-Maintainer Upload (BSP 2005-08-06). + * Fixed FTBFS with gcc 3.4 / 4.0 by applying patch from + Andreas Jochens (Closes: #260574). + + -- Uwe Hermann Sat, 6 Aug 2005 22:07:06 +0200 + +mmv (1.01b-12) unstable; urgency=low + + * LFS support! (not sure if this breaks something :) (Closes: Bug #106822) + * support -- as option terminator (Closes: Bug #52417) + + -- Bernd Eckenfels Tue, 20 Nov 2001 19:03:24 +0100 + +mmv (1.01b-11) unstable; urgency=medium + + * added Build-Depends (Closes: Bug #105025) + * bumped Standards Version from 3.0.1 to 3.6.5 + * make strig/-g depending on environemnt variable + * added a comment about quoting 'to' patter (Closes: Bug #106076) + + -- Bernd Eckenfels Sat, 10 Nov 2001 18:28:56 +0100 + +mmv (1.01b-10.1) unstable; urgency=LOW + + * reupload cause it was rejected + + -- Bernd Eckenfels Thu, 3 Aug 2000 02:38:20 +0200 + +mmv (1.01b-10) unstable; urgency=LOW + + * debian/rules clean will now kill *~ files + + -- Bernd Eckenfels Sun, 23 Jul 2000 04:28:46 +0200 + +mmv (1.01b-9) unstable; urgency=LOW + + * closes: #67605 (no special handling for char > 127 anymore) + * clsoes: #60128 (i think it was fixed by hartmut already) + * man page and doc now in /usr/share, new standards version + + -- Bernd Eckenfels Sun, 23 Jul 2000 04:08:19 +0200 + +mmv (1.01b-8.1) unstable; urgency=LOW + + * NMU + * fixed the invalid initializer for glibc-2.1 + * closes: #31929 + * changed in debian/rules in the clean target: + + /bin/rm -f into -rm -f + + make into -make + + added *~ + + -- Hartmut Koptein Fri, 9 Jul 1999 10:24:17 +0200 + +mmv (1.01b-8) unstable; urgency=LOW + + * should compile now with different headers (Bug#26955). + + -- Bernd Eckenfels Sun, 1 Nov 1998 05:36:36 +0100 + +mmv (1.01b-7) frozen unstable; urgency=LOW + + * Remove debian/files with make clean (Bug#21526). + + -- Michael Meskes Wed, 22 Apr 1998 16:19:30 +0200 + +mmv (1.01b-6) frozen unstable; urgency=LOW + + * Make lintian happy. + + -- Michael Meskes Fri, 17 Apr 1998 14:36:19 +0200 + +mmv (1.01b-5) unstable; urgency=LOW + + * Added new copyright notice and moved package back into main. + My thanks go to Joost for getting into touch with the upstream author. + + -- Michael Meskes Thu, 5 Mar 1998 10:42:42 +0100 + +mmv (1.01b-4) unstable; urgency=LOW + + * Updated standard + * Added man page links. + + -- Michael Meskes Fri, 27 Feb 1998 15:33:54 +0100 + +mmv (1.01b-3) unstable; urgency=LOW + + * Moved package to non-free. Sorry, I cannot reach the upstream author to + clarify the problems with his copyright. (#14908). + * Do not comress copyright file. (#14460) + + -- Michael Meskes Fri, 19 Dec 1997 10:47:37 +0100 + +mmv (1.01b-2) unstable; urgency=LOW + + * Put copyright file into /usr/doc/mmv/copyright (#10623) + * Removed -m486 option in Makefile (#10780). + * Corrected man page permission (#4913). + * Compiled against libc6. + + -- Michael Meskes Tue, 5 Aug 1997 13:11:36 +0200 + +mmv (1.01b-1) unstable; urgency=LOW + + * Initial release + + -- Michael Meskes Tue, 15 Oct 1996 13:02:46 +0200 --- mmv-1.01b.orig/debian/control +++ mmv-1.01b/debian/control @@ -0,0 +1,16 @@ +Source: mmv +Maintainer: Bernd Eckenfels +Section: utils +Build-Depends: debhelper +Priority: optional +Standards-Version: 3.5.6 + +Package: mmv +Architecture: any +Description: Move/Copy/Append/Link multiple files + mmv is a program to move/copy/append/link multiple files + according to a set of wildcard patterns. This multiple action is + performed safely, i.e. without any unexpected deletion of files due to + collisions of target names with existing filenames or with other + target names. +Depends: ${shlibs:Depends} --- mmv-1.01b.orig/debian/copyright +++ mmv-1.01b/debian/copyright @@ -0,0 +1,42 @@ +This is the Debian GNU/Linux prepackaged version of mmv. + +This package was put together by Michael Meskes , +from sources obtained from USENET. + +It is now maintained by Bernd Eckenfels with some +enhancements (NLS Char Support, glibc compiles) from Bernd and kind +contributions from Hartmut Koptein . + +Copyright (c) 1989 Vladimir Lanin + +Mmv is freeware. That means that the entire package of software and +documentation is copyrighted, and may not be distributed with any +modifications or for any charge (without the author's explicit written +permission). Other than that, it may be used and distributed freely. + +Vladimir Lanin +330 Wadsworth Ave, Apt 6F +New York, NY 10040 + +lanin@csd2.nyu.edu +...!cmcl2!csd2!lanin + +However, Vladimir told me: + +Michael, + +This message is to serve as an announcement that I am changing the +copyright of mmv to GPL. + +If this message is in any way insufficient to do so, please tell me what +I have to do. Please keep in mind that I do not have in hand either the +full GPL text or the source code of the last mmv release (oops). + +If there is any other way that I can help out, please tell me. + +Thanks, + +Vladimir Lanin +vlad@brm.com + +Thanks to Joost for getting into touch with him. --- mmv-1.01b.orig/debian/rules +++ mmv-1.01b/debian/rules @@ -0,0 +1,86 @@ +#! /usr/bin/make -f + +INSTALL_PROGRAM=install +CC = gcc +LDFLAGS = +CFLAGS = -O2 -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) +CFLAGS += -g +endif + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) +INSTALL_PROGRAM += -s +LDFLAGS += -s +endif + + +# The package +p = mmv +# The version +v = $(shell dpkg-parsechangelog | sed -n 's/^Version: //p') +# The architecture +a = $(shell dpkg --print-architecture) + +dir = `pwd` + +build: +# Builds the binary package. + $(checkdir) + make CC="$(CC)" LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" + touch build + +clean: +# Undoes the effect of `make -f debian/rules build'. + $(checkdir) + -make clean + -rm -f debian/files* debian/substvars* debian/*~ core */core *~ + rm -rf debian/tmp + -rm build + +binary: binary-arch binary-indep + +binary-indep: + $(checkdir) + +binary-arch: build + $(checkdir) + test -f build || make -f debian/rules build +# Makes a binary package. + /bin/rm -rf debian/tmp + test -f stamp-build || make -f debian/rules build + install -d -g root -m 755 -o root debian/tmp + chmod g-s debian/tmp + install -d -g root -m 755 -o root debian/tmp/DEBIAN + install -d -g root -m 755 -o root debian/tmp/usr/bin + install -d -g root -m 755 -o root debian/tmp/usr/share/man/man1 + $(INSTALL_PROGRAM) -g root -o root -m 755 mmv debian/tmp/usr/bin + install -g root -o root -m 644 mmv.1 debian/tmp/usr/share/man/man1 + gzip -9f debian/tmp/usr/share/man/man1/mmv.1 + (cd debian/tmp/usr/bin;\ + ln -s mmv mcp; \ + ln -s mmv mad; \ + ln -s mmv mln;) + (cd debian/tmp/usr/share/man/man1;\ + ln -s mmv.1.gz mcp.1.gz; \ + ln -s mmv.1.gz mad.1.gz; \ + ln -s mmv.1.gz mln.1.gz;) + install -d -g root -m 755 -o root debian/tmp/usr/share/doc/$(p) + install -g root -m 644 -o root READ.ME \ + debian/tmp/usr/share/doc/$(p) + install -g root -m 644 -o root debian/changelog \ + debian/tmp/usr/share/doc/$(p)/changelog.Debian + gzip -f9 debian/tmp/usr/share/doc/$(p)/* + install -g root -m 644 -o root debian/copyright \ + debian/tmp/usr/share/doc/$(p) + chmod -R g-sw debian/tmp/usr/share/doc/$(p) + chown -R root.root debian/tmp/usr/share/doc/$(p) + dpkg-shlibdeps debian/tmp/usr/bin/mmv + dpkg-gencontrol -isp + dh_md5sums + dpkg --build debian/tmp && dpkg-name -o -s .. debian/tmp.deb + +define checkdir + test -f mmv.1 +endef