-------- Forwarded Message --------
> From: Wim Lewis <[EMAIL PROTECTED]>
> To: Wojciech Kazubski <[EMAIL PROTECTED]>, Peter Clifton <[EMAIL PROTECTED]>
> Subject: Fwd: gEDA-dev: gEDA 1.4.2 fixes - sch2eaglepos.sh
> Date: Sat, 22 Nov 2008 19:48:47 -0800
> 
> Hmm, my response to this didn't seem to make it to the list.  
> Apologies if you receive this twice.
> 
> -------- Begin forwarded message --------
> From: Wim Lewis <[EMAIL PROTECTED]>
> Date: November 21, 2008 3:29:41 PM PST
> To: gEDA developer mailing list <geda-dev@moria.seul.org>
> Subject: Re: gEDA-dev: gEDA 1.4.2 fixes - sch2eaglepos.sh
> 
> 
> On Nov 21, 2008, at 2:43 PM, Wojciech Kazubski wrote:
> > The patch should be applied before next release but I don't know if  
> > mktemp is
> > avalilable in all OS-es (BSD, Windows?).
> 
> In my experience it's pretty reliably available, but the invocation  
> varies from system to system. A quick survey:
> 
>    OpenBSD (4.2): available, works without args
>        Usage: mktemp [-dqtu] [-p prefix] [template]
> 
>    NetBSD (4.0): available, needs args
>       Usage: mktemp [-dqu] {-t prefix | template ...}
> 
>    MacOS X (10.4 and 10.5): available, needs args
>        usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
>              mktemp [-d] [-q] [-u] -t prefix
> 
> On netbsd and osx, "mktemp -t gnetlist" will do the right thing, but  
> on openbsd that will do the wrong thing (note that the -t flag has a  
> different meaning there) and on one Linux box I checked just now it  
> will simply fail (no -t flag). I don't have access to a cygwin install.
> 
> To summarize, AFAIK *either* `mktemp` or `mktemp -t gnetlist` should  
> work on the vast majority of systems, but I don't know offhand of an  
> easy way to check which. Maybe there's an autoconf macro that will  
> figure it out at configure time?
> 
> > ...[snip]...
> > TMP=`mktemp`
> > grep -B1 refdes= "$FNAME" |sed 's/=/ /' | cut -d" " -f2,3 |grep -v  
> > '^--' > $TMP
> > ...[snip]...
> 
> FWIW, the $TMP variable is often used to store the path to the  
> directory to make temp files *in* (like $TMPDIR). It might be better  
> to use a different name for the variable in this shell script, to  
> avoid a clash.
> 
> ... Actually, looking at the shell script, I don't think there's any  
> need to have a temporary file at all. Just pipe the output of grep  
> directly into the 'while' loop and remove the "-u 3":
> 
> grep blah blah sed cut grep etc  | while read X Y; do
>     stuff...
> 
> Simpler and more secure, I think, and avoids having to figure out how  
> to use mktemp(1).
> 
> 
> Wim.
> 
> 
-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to