1 Description: Patches as of mmv 1.01b-15
2 This patch contains the functional patches as of mmv 1.01b-15 when it
3 has been 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-12-29
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,
346 ===================================================================
347 --- mmv.orig/Makefile 2012-09-16 18:24:31.375886230 +0200
348 +++ mmv/Makefile 2012-09-16 18:24:46.260122528 +0200
350 # Possible defines in CONF:
351 # IS_MSDOS IS_SYSV IS_V7 IS_BSD HAS_DIRENT HAS_RENAME MV_DIR
353 -CC =gcc -traditional
356 CONF =-DIS_SYSV -DHAS_DIRENT -DHAS_RENAME
357 -CFLAGS =-O2 -m486 $(CONF)
361 #IBIN =$(LOCAL)$(ARCH)/bin
362 #IMAN =$(LOCAL)$(ANY)/man
363 IBIN=$(DESTDIR)/usr/bin/
364 -IMAN=$(DESTDIR)/usr/man/
365 +IMAN=$(DESTDIR)/usr/share/man/