From 08262804615de4989aae0ab59eacb103b23c39fb Mon Sep 17 00:00:00 2001 From: Gerfried Fuchs Date: Sat, 30 May 2009 18:08:18 +0200 Subject: [PATCH] Imported Debian patch 1.01b-15 --- debian/changelog | 19 ++++++++ debian/control | 5 +- debian/copyright | 8 +++- debian/rules | 34 +++++++++----- mmv.1 | 118 ++++++++++++++++++++++++----------------------- mmv.c | 5 +- 6 files changed, 115 insertions(+), 74 deletions(-) diff --git a/debian/changelog b/debian/changelog index 981b68d..fd8adb6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,22 @@ +mmv (1.01b-15) unstable; urgency=low + + * New Maintainer (closes: #485999) + * Update to Standards-Version 3.8.1: + - Switch from DEB_BUILD_OPTIONS debug to noopt, add support for parallel. + * Replace call to dh_md5sums with direct creation and remove Build-Depends + on debhelper. + * Don't ignore make clean errors anymore and use $(MAKE) instead of make in + debian/rules. + * Add empty line before .ce The Task Options (closes: #411182) + * Initialize tv_usec (closes: #452993) + * Add mising linebreak to an italic line (closes: #411181) + * Wrap cmdname in basename() (closes: #452989) + * Add reference to the full text of the GPL file in the common-licenses + directory. + * Escape all relevant dashes in the manpage to not turn them into hyphens. + + -- Gerfried Fuchs Sat, 30 May 2009 18:08:18 +0200 + mmv (1.01b-14) unstable; urgency=low * Thanks for NMU to Joey, Ai and Uwe diff --git a/debian/control b/debian/control index 7260474..203cc52 100644 --- a/debian/control +++ b/debian/control @@ -1,9 +1,8 @@ Source: mmv -Maintainer: Bernd Eckenfels +Maintainer: Gerfried Fuchs Section: utils -Build-Depends: debhelper Priority: optional -Standards-Version: 3.5.6 +Standards-Version: 3.8.1 Package: mmv Architecture: any diff --git a/debian/copyright b/debian/copyright index 1bee46c..5a6643e 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,10 +3,12 @@ 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 +It was maintained by Bernd Eckenfels with some enhancements (NLS Char Support, glibc compiles) from Bernd and kind contributions from Hartmut Koptein . +At the moment it is maintained by Gerfried Fuchs . + Copyright (c) 1989 Vladimir Lanin Mmv is freeware. That means that the entire package of software and @@ -40,3 +42,7 @@ Vladimir Lanin vlad@brm.com Thanks to Joost for getting into touch with him. + +On Debian systems, the complete text of the GNU Library General +Public License can be found in /usr/share/common-licenses/LGPL-2 file, +later versions can be found in the same directory. diff --git a/debian/rules b/debian/rules index 82666b8..b706505 100755 --- a/debian/rules +++ b/debian/rules @@ -3,16 +3,24 @@ INSTALL_PROGRAM=install CC = gcc LDFLAGS = -CFLAGS = -O2 -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +CFLAGS = -g -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) -CFLAGS += -g +ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 endif -ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) -INSTALL_PROGRAM += -s -LDFLAGS += -s +ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s + LDFLAGS += -s + STRIP = true +endif + +ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + MAKEFLAGS += -j$(NUMJOBS) endif @@ -28,13 +36,13 @@ dir = `pwd` build: # Builds the binary package. $(checkdir) - make CC="$(CC)" LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" + $(MAKE) CC="$(CC)" LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" touch build clean: # Undoes the effect of `make -f debian/rules build'. $(checkdir) - -make clean + [ ! -f Makefile ] || $(MAKE) clean -rm -f debian/files* debian/substvars* debian/*~ core */core *~ rm -rf debian/tmp -rm build @@ -46,16 +54,19 @@ binary-indep: binary-arch: build $(checkdir) - test -f build || make -f debian/rules build + 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 + 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 + test "$(STRIP)" != true || strip \ + --remove-section=.comment --remove-section=.note \ + debian/tmp/usr/bin/mmv 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;\ @@ -78,7 +89,8 @@ binary-arch: build chown -R root.root debian/tmp/usr/share/doc/$(p) dpkg-shlibdeps debian/tmp/usr/bin/mmv dpkg-gencontrol -isp - dh_md5sums + cd debian/tmp && find * -type f ! -regex '^DEBIAN/.*' -print0 | \ + xargs -r0 md5sum > DEBIAN/md5sums dpkg --build debian/tmp && dpkg-name -o -s .. debian/tmp.deb define checkdir diff --git a/mmv.1 b/mmv.1 index 4c707a3..9e1e5d3 100644 --- a/mmv.1 +++ b/mmv.1 @@ -21,14 +21,14 @@ mmv \- move/copy/append multiple files by wildcard patterns \} .SH SYNOPSIS .B mmv -.if '\nO'2' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBz\fP] -.if '\nO'0' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP|\fBs\fP] -.if '\nO'1' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP] -[\fB-h\fP] -[\fB-d\fP|\fBp\fP] -[\fB-g\fP|\fBt\fP] -[\fB-v\fP|\fBn\fP] -[\fB--\fP] +.if '\nO'2' [\fB\-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBz\fP] +.if '\nO'0' [\fB\-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP|\fBs\fP] +.if '\nO'1' [\fB\-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP] +[\fB\-h\fP] +[\fB\-d\fP|\fBp\fP] +[\fB\-g\fP|\fBt\fP] +[\fB\-v\fP|\fBn\fP] +[\fB\-\-\fP] [\fBfrom to\fP] .if '\nO'2' \{\ .br @@ -57,8 +57,10 @@ from the entire set of actions specified 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 +.I mmv +does support large files (LFS) but it does *NOT* support sparse files (i.e. it explodes them). + .ce The Task Options .PP @@ -73,7 +75,7 @@ If none of these are specified, .ie '\nO'2' \{\ a default (patchable by .IR mmvpatch , -and initially -x) +and initially \-x) determines the task. \} .el \{\ @@ -83,18 +85,18 @@ was invoked (argv[0]): command name default task - mmv -x + mmv \-x .br - mcp -c + mcp \-c .br - mad -a + mad \-a .br - mln -l + mln \-l \} .PP The task option choices are: .TP --m : +\-m : move source file to target name. Both must be on the same device. Will not move directories. @@ -104,8 +106,8 @@ moves the link without checking if the link's target from the new directory is different than the old. \} .TP --x : -same as -m, except cross-device moves are done +\-x : +same as \-m, except cross-device moves are done by copying, then deleting source. When copying, sets the .ie !'\nO'2' permission bits @@ -113,7 +115,7 @@ When copying, sets the and file modification time of the target file to that of the source file. .TP --r : +\-r : rename source file or directory to target name. The target name must not include a path: the file remains in the same directory in all cases. @@ -121,7 +123,7 @@ This option is the only way of renaming directories under .IR mmv . .if '\nO'2' It is only available under DOS version 3.0 or higher. .TP --c : +\-c : copy source file to target name. Sets the file modification time and .ie !'\nO'2' permission bits @@ -130,7 +132,7 @@ of the target file to that of the source file, regardless of whether the target file already exists. Chains and cycles (to be explained below) are not allowed. .TP --o : +\-o : overwrite target name with source file. .ie '\nO'2' \{\ If target file exists, its attributes are left unchanged. @@ -148,38 +150,38 @@ and the execute permission bits copied from the source file. In either case, the file modification time is set to the current time. \} .TP --a : +\-a : append contents of source file to target name. Target file modification time is set to the current time. If target file does not exist, it is created with .ie '\nO'2' attributes .el permission bits -set as under -o. -Unlike all other options, -a allows multiple source files to have the -same target name, e.g. "mmv -a +set as under \-o. +Unlike all other options, \-a allows multiple source files to have the +same target name, e.g. "mmv \-a .ie '\nO'2' *.c .el \\*.c big" will append all ".c" files to "big". -Chains and cycles are also allowed, so "mmv -a f f" will double up "f". +Chains and cycles are also allowed, so "mmv \-a f f" will double up "f". .ie '\nO'2' \{\ .TP --z : -same as -a, but if the target file exists, and its last character is a ^Z, +\-z : +same as \-a, but if the target file exists, and its last character is a ^Z, and the source file is not empty, this ^Z is truncated before doing the append. \} .el \{\ .TP --l : +\-l : link target name to source file. Both must be on the same device, and the source must not be a directory. Chains and cycles are not allowed. .if '\nO'0' \{\ .TP --s : -same as -l, but use symbolic links instead of hard links. +\-s : +same as \-l, but use symbolic links instead of hard links. For the resulting link to aim back at the source, either the source name must begin with a '/', or the target must reside in either the current or the source directory. @@ -192,7 +194,7 @@ and the source can be a directory. Only one of these option may be given, and it applies to all matching files. Remaining options need not be given separately, -i.e. "mmv -mk" is allowed. +i.e. "mmv \-mk" is allowed. .ce Multiple Pattern Pairs @@ -234,7 +236,7 @@ a b a c .in -3 -would give the error message "a -> c : no match" because file "a" +would give the error message "a \-> c : no match" because file "a" (even if it exists) was already matched by the first pattern pair. @@ -257,10 +259,10 @@ matching any single character, and matching any one of a set of characters. .PP Between the '[' and ']', a range from character 'a' through character 'z' -is specified with "a-z". +is specified with "a\-z". The set of matching characters can be negated by inserting a '^' after the '['. -Thus, "[^b-e2-5_]" +Thus, "[^b\-e2\-5_]" will match any character but 'b' through 'e', '2' through '5', and '_'. .if '\nO'2' \{\ .PP @@ -307,13 +309,13 @@ However, the '~' is not treated as a wildcard, in the sense that it is not assigned a wildcard index (see below). \} .PP -Since matching a directory under a task option other than -r or -s +Since matching a directory under a task option other than \-r or \-s would result in an error, -tasks other than -r and -s +tasks other than \-r and \-s match directories only against completely explicit .I from patterns (i.e. not containing wildcards). -Under -r and -s, this applies only to "." and "..". +Under \-r and \-s, this applies only to "." and "..". .PP .ie '\nO'2' \{\ Hidden and system files are also only matched @@ -326,7 +328,7 @@ Files beginning with '.' are only matched against .I from patterns that begin with an explicit '.'. \} -However, if -h is specified, they are matched normally. +However, if \-h is specified, they are matched normally. .if !'\nO'2' \{\ .PP Warning: since the shell normally expands wildcards @@ -366,7 +368,7 @@ pattern is "abc*.*" and the pattern is "xyz#2.#1", then "abc.txt" is targeted to "xyztxt.". (The first '*' matched "", and the second matched "txt".) -Similarly, for the pattern pair ";*.[clp]" -> "#1#3\*(SL#2", +Similarly, for the pattern pair ";*.[clp]" \-> "#1#3\*(SL#2", "foo1\*(SLfoo2\*(SLprog.c" is targeted to "foo1\*(SLfoo2\*(SLc\*(SLprog". Note that there is no '\*(SL' following the "#1" in the .I to @@ -400,7 +402,7 @@ expands the '~' in the exact same manner as does not expand it at all). \} .PP -For all task options other than -r, if the target name is a directory, +For all task options other than \-r, if the target name is a directory, the real target name is formed by appending a '\*(SL' followed by the last component of the source file name. @@ -437,7 +439,7 @@ a b .br b c -specifies the chain "a" -> "b" -> "c". +specifies the chain "a" \-> "b" \-> "c". A cycle is a chain where the last target name refers back to the first source file, e.g. "mmv a a". @@ -464,9 +466,9 @@ Furthermore, .I mmv checks if any of its actions will result in the destruction of existing files. -If the -d (delete) option is specified, +If the \-d (delete) option is specified, all file deletions or overwrites are done silently. -Under -p (protect), all deletions or overwrites +Under \-p (protect), all deletions or overwrites (except those specified with "(*)" on the standard input, see below) are treated as errors. And if neither option is specified, @@ -490,16 +492,16 @@ Once all errors are detected, queries the user whether he wishes to continue by avoiding the erroneous actions or to abort altogether. This and all other queries may be avoided by specifying either the --g (go) or -t (terminate) option. +\-g (go) or \-t (terminate) option. The former will resolve all difficulties by avoiding the erroneous actions; the latter will abort .I mmv if any errors are detected. Specifying either of them defaults .I mmv -to -p, unless -d is specified +to \-p, unless \-d is specified (see above). -Thus, -g and -t are most useful when running +Thus, \-g and \-t are most useful when running .I mmv in the background or in a shell script, @@ -511,28 +513,28 @@ Reports Once the actions to be performed are determined, .I mmv performs them silently, -unless either the -v (verbose) or -n (no-execute) option is specified. +unless either the \-v (verbose) or \-n (no-execute) option is specified. The former causes .I mmv to report each performed action on the standard output as -a -> b : done. +a \-> b : done. Here, "a" and "b" would be replaced by the source and target names, respectively. If the action deletes the old target, a "(*)" is inserted after the the target name. -Also, the "->" symbol is modified when a cycle has to be broken: +Also, the "\->" symbol is modified when a cycle has to be broken: the '>' is changed to a '^' on the action prior to which the old target is renamed to a temporary, -and the '-' is changed to a '=' on the action where the temporary is used. +and the '\-' is changed to a '=' on the action where the temporary is used. .PP -Under -n, none of the actions are performed, +Under \-n, none of the actions are performed, but messages like the above are printed on the standard output with the ": done." omitted. .PP -The output generated by -n can (after editing, if desired) +The output generated by \-n can (after editing, if desired) be fed back to .I mmv on the standard input @@ -548,9 +550,9 @@ To facilitate this, ignores lines on the standard input that look like its own error and "done" messages, as well as all lines beginning with white space, -and will accept pattern pairs with or without the intervening "->" -(or "-^", "=>", or "=^"). -Lines with "(*)" after the target pattern have the effect of enabling -d +and will accept pattern pairs with or without the intervening "\->" +(or "\-^", "=>", or "=^"). +Lines with "(*)" after the target pattern have the effect of enabling \-d for the files matching this pattern only, so that such deletions are done silently. When feeding @@ -599,11 +601,11 @@ on a copy of .I mmv named as follows: - -x, -m, -r mmv.exe + \-x, \-m, \-r mmv.exe .br - -c, -o mcp.exe + \-c, \-o mcp.exe .br - -a, -z mad.exe + \-a, \-z mad.exe .PP .I Mmvpatch also determines the best way to uniquely identify directories. diff --git a/mmv.c b/mmv.c index 200392c..ac1bb76 100644 --- a/mmv.c +++ b/mmv.c @@ -124,6 +124,7 @@ extern unsigned _stklen = 10000; #else /* for various flavors of UN*X */ +#include #include #include #include @@ -565,7 +566,7 @@ static void procargs(argc, argv, pfrompat, ptopat) char **pfrompat, **ptopat; { char *p, c; - char *cmdname = argv[0]; + char *cmdname = basename(argv[0]); #ifdef IS_MSDOS #define CMDNAME (patch.ph_name) @@ -2727,7 +2728,9 @@ static int copy(ff, len) tim.modtime = fstat.st_mtime, #else tim[0].tv_sec = fstat.st_atime, + tim[0].tv_usec = 0, tim[1].tv_sec = fstat.st_mtime, + tim[1].tv_usec = 0, #endif utimes(fullrep, tim) ) -- 2.39.2