delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2021/04/22/05:57:56

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20161025;
h=from:date:to:subject:message-id:mail-followup-to:references
:mime-version:content-disposition:in-reply-to;
bh=r9xG+brj7KJ8UMqwrWZ91gZMMzVo/sL7ziBdDycuZZk=;
b=njRsoXDViEifsfdH0upkrUDHe3Q5PIH9JZK4cxZRc41SIIw2YMd3eK5WjEryYPcJin
1+ZaM16Lzwi4mhNwZ+6oj0H3Ys0tphjaGpPO6Xjo1WHRtZZDqPVZq27o2YAmTa5gpZo3
jt/7+NypxIKpn76E4P7rWIn1HPim1Vm8939KTa3aclny1c45//A1KlZRkdgGXvUkC0B4
gPkxfkjBYlRuC9altc7TX+wmM7tAX3Cg2Qr3gRST2msk66BurCsWHPISLI0gMu7VOSGF
crtbx0LQnxJcqVAMPoVlAClPi7k7OU0r3EcqCXpyoKo9XPYidCk2eQ4+4gp9OrnBFvcV
a6Cw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:date:to:subject:message-id:mail-followup-to
:references:mime-version:content-disposition:in-reply-to;
bh=r9xG+brj7KJ8UMqwrWZ91gZMMzVo/sL7ziBdDycuZZk=;
b=M7N3B0oHKv6IAdWuIcmjnFTkTmAmTl7VBuRyVMiQUZghTU5AVdY5f+gv7/hraY/i+m
P5k5qD7Uf141kLQ4SBQyLzKM4EXbrMFJHQrFSHGF4ena50ezKgnFZF063k2i1WehQBa8
+cvN2Ho4bx4JNiRSDla85mRN+sFLhr/W7NT+0/JPwVK6kSydlcSk2MBkCEfCh+sdOZWA
7n6WymvSb9jwS9riPbuYYRyGax3MUCGteh/Vv4iaKO+FVZD64Kst8BSeW5xz/1vsYuP8
TLzC83zFO2W2vnfBhw9AZ7U+UdJSbJzJbwSWgOH/G7ClKWz48zlfb8zBi8l9/AxCUvsu
3Ulw==
X-Gm-Message-State: AOAM5339HxvM3S5HvCnWKRvr0bHcoxK9JGGHC06mr6ZU8i96yFT6fhNB
jFfGbCXeo2FQfn/0JL4lGqolYykVCjE=
X-Google-Smtp-Source: ABdhPJyRKvZww1YsZFhObvcU+D48wNy5QeP/JrTX1excrDGrwv6sZ1LSk/rWRZxZykj6WgiOIOdLsA==
X-Received: by 2002:a2e:7d02:: with SMTP id y2mr1824205ljc.393.1619085384965;
Thu, 22 Apr 2021 02:56:24 -0700 (PDT)
From: "Vladimir Zhbanov (vzhbanov AT gmail DOT com) [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
X-Google-Original-From: Vladimir Zhbanov <vzh AT lepton>
Date: Thu, 22 Apr 2021 12:56:22 +0300
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] system wide config
Message-ID: <YIFIRh9ENXpQgVmB@lepton>
Mail-Followup-To: geda-user AT delorie DOT com
References: <20210417120805 DOT 37DAA824EAA0 AT turkos DOT aspodata DOT se>
<YHrjzpKEMOvXREuY AT lepton>
<20210417144426 DOT E4238824EAA0 AT turkos DOT aspodata DOT se>
<YH4IPPe+k4MZJJkm AT lepton>
<20210420004032 DOT 30A6980770A6 AT turkos DOT aspodata DOT se>
<YH6T5zzhba9AqGX9 AT lepton>
<20210420143556 DOT CC46580770AF AT turkos DOT aspodata DOT se>
<20210420144634 DOT 1456180770AF AT turkos DOT aspodata DOT se>
<20210422091632 DOT 7178ff90 AT demon>
MIME-Version: 1.0
In-Reply-To: <20210422091632.7178ff90@demon>
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, Apr 22, 2021 at 09:16:32AM +0300, dmn (graahnul DOT grom AT gmail DOT com) [via geda-user AT delorie DOT com] wrote:
> On Tue, 20 Apr 2021 16:46:34 +0200 (CEST)
> "karl AT aspodata DOT se [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
> wrote:
> 
> >  I think the following will suit me fine in the future.
> > 
> > (use-modules (ice-9 popen))
> > (use-modules (ice-9 rdelim))
> > 
> > (define (readlink file)
> >   (let*
> >    (
> >     (port (open-input-pipe (string-append "readlink -f " file)))
> >     (str  (read-line port))
> >     (close-pipe port)
> >    )
> >    str
> >   )
> > )
> > 
> > (define MK (readlink "Makefile"))
> > (define INC (dirname MK))
> > (define TOP (dirname INC))
> > ;(display MK)  (newline)
> > ;(display INC) (newline)
> > ;(display TOP) (newline)
> > 
> >  Thanks for the ideas and help.
> > 
> > Regards,
> > /Karl Hammar
> > 
> 
> Karl, first of all, I'd like to thank you for not using the "dog's
> breakfast coding style" (TM)! :-)
> Being not an expert in the bloody lisp programming language, I wonder
> does the call "(close-pipe port)" inside the "let" clause get executed?
> (It looks like a variable definition).

It's easy to check, use REPL and something like

(format #t "Closed? ~A\n" (port-closed? port))

before resulting 'str'.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019