On Thu, 6 Sep 2012 08:01:28 +0200
Alexander Burger <a...@software-lab.de> wrote:

> Hi Laurent,
> 
> back to your original mail:
> 
> > By the way, if anyone know what lib to use for (native) to make a
> > lstat syscall so I can replace the stat shell call, I'd be very
> > grateful: I can't find where it is! (contrary to what I thought, it
> > is NOT in libc...)
> 
> It seems the internal symbol is '__xstat'.
> 
> >From "/usr/include/x86_64-linux-gnu/sys/stat.h":
> 
>    __extern_inline int
>    __NTH (stat (__const char *__path, struct stat *__statbuf))
>    {
>      return __xstat (_STAT_VER, __path, __statbuf);
>    }
> 
> That's a pity, because it makes it rather unportable.
> 
> 
> 
> BTW, instead of using 'line', 'split' and 'pack' in
> 
> > (de stat (Path)
> >    (mapcar pack
> >       (split
> >          (in
> >             (list "stat" "-c" "%f %s %u %g %h %i %X %Y %Z" Path)
> >             (line) )
> >          " " ) ) )
> 
> and later parsing it with 'hex' and 'format', you could read it
> directly:
> 
> (in (list "stat" "-c" "%f %s %u %g %h %i %X %Y %Z" Path)
>    (make
>       (link (hex (till " "))
>       (do 8
>          (link (read)) ) ) ) ) 
> 
Why not just:

(in (list "stat" "-c" "(`(hex \"%f\") %s %u %g %h %i %X %Y %Z)" Path)
   (read) ) 

:D

> Cheers,
> - Alex

Cheers,
- José
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to