From owner-freebsd-current Tue Jun 25 2:36:46 2002 Delivered-To: freebsd-current@freebsd.org Received: from axl.seasidesoftware.co.za (axl.seasidesoftware.co.za [196.31.7.201]) by hub.freebsd.org (Postfix) with ESMTP id 7D8F637B6A2 for ; Tue, 25 Jun 2002 02:34:22 -0700 (PDT) Received: from sheldonh by axl.seasidesoftware.co.za with local (Exim 3.36 #1) id 17MmiX-000JFy-00; Tue, 25 Jun 2002 11:34:33 +0200 Date: Tue, 25 Jun 2002 11:34:33 +0200 From: Sheldon Hearn To: Mark Murray Cc: Jonathan Belson , current@freebsd.org Subject: Re: Perl scripts that need rewiting - Any volunteers? Message-ID: <20020625093433.GF73283@starjuice.net> Mail-Followup-To: Mark Murray , Jonathan Belson , current@freebsd.org References: <3D17770E.1060904@witchspace.com> <200206250920.g5P9KJnG005006@grimreaper.grondar.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200206250920.g5P9KJnG005006@grimreaper.grondar.org> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On (2002/06/25 10:20), Mark Murray wrote: > How's this? > > int handle; > template = "/tmp/mumbleXXXXXXXX"; > char *cmd; > handle = mkstemp(template); // template is modified > asprintf(cmd, "prog > %s", template); > system(cmd); > close(handle); // bye-bye file It would be failsafe if you tested that mkstemp() had not returned an error. Ciao, Sheldon. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message