Date: Sat, 22 Sep 2012 11:43:19 +0200 From: "Klaus T. Aehlig" <aehlig@linta.de> To: Stephen Montgomery-Smith <stephen@missouri.edu> Cc: "ctm-users@freebsd.org" <ctm-users@freebsd.org> Subject: Re: svn-cur Message-ID: <20120922094319.GA55036@curry.linta.de> In-Reply-To: <505C6570.8060801@missouri.edu> References: <4EF55B2B.9010700@missouri.edu> <20120921044729.GA47944@curry.linta.de> <505C6570.8060801@missouri.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
--h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Dear Stephen, > Can you think of a way that ctm_rmail would work in both instances > (check both for 4 and 5 digit numbers, and check gz and xz)? I think > that is what is needed if the tool is to be universal. yes, you're right. One should take care of all cases. See a new version of the patch attached. Best, Klaus --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-for-ctm_rmail --- /usr/src/usr.sbin/ctm/ctm_rmail/ctm_rmail.c.orig 2012-09-22 08:59:08.000000000 +0200 +++ /usr/src/usr.sbin/ctm/ctm_rmail/ctm_rmail.c 2012-09-22 11:37:21.000000000 +0200 @@ -150,6 +150,7 @@ char fname[PATH_MAX]; char here[PATH_MAX]; char buf[PATH_MAX*2]; + char *deltanamescheme[] = { "%s.%04d.gz", "%s.%04d.xz", "%s.%05d.gz", "%s.%05d.xz", NULL }; /* * Grab a lock on the ctm mutex file so that we can be sure we are @@ -198,10 +199,16 @@ */ for (;;) { - sprintf(delta, "%s.%04d.gz", class, ++dn); - mk_delta_name(fname, delta); + ++dn; + for (i=0; deltanamescheme[i]; i++) + { + sprintf(delta, deltanamescheme[i], class, dn); + mk_delta_name(fname, delta); - if (stat(fname, &sb) < 0) + if (stat(fname, &sb) >= 0) + break; + } + if (!deltanamescheme[i]) break; sprintf(buf, "(cd %s && ctm %s%s%s%s) 2>&1", base_dir, --h31gzZEtNLTqOjlF--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120922094319.GA55036>