From owner-ctm-users@FreeBSD.ORG Sat Sep 22 09:43:41 2012 Return-Path: Delivered-To: ctm-users@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F01A81065670 for ; Sat, 22 Sep 2012 09:43:40 +0000 (UTC) (envelope-from aehlig@linta.de) Received: from linta.de (isilmar-3.linta.de [188.40.101.200]) by mx1.freebsd.org (Postfix) with ESMTP id 20E228FC0A for ; Sat, 22 Sep 2012 09:43:38 +0000 (UTC) Received: (qmail 14293 invoked by uid 10); 22 Sep 2012 09:43:31 -0000 Received: from curry.linta.de by isilmar.linta.de with BSMTP; 22 Sep 2012 09:43:31 -0000 Received: by curry.linta.de (Postfix, from userid 1001) id 72FAA1CC1D; Sat, 22 Sep 2012 11:43:19 +0200 (CEST) Date: Sat, 22 Sep 2012 11:43:19 +0200 From: "Klaus T. Aehlig" To: Stephen Montgomery-Smith Message-ID: <20120922094319.GA55036@curry.linta.de> References: <4EF55B2B.9010700@missouri.edu> <20120921044729.GA47944@curry.linta.de> <505C6570.8060801@missouri.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline In-Reply-To: <505C6570.8060801@missouri.edu> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "ctm-users@freebsd.org" Subject: Re: svn-cur X-BeenThere: ctm-users@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CTM User discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Sep 2012 09:43:41 -0000 --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--