[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] better way to get a file mtime from the OS?

From: Bernd Paysan
Subject: Re: [gforth] better way to get a file mtime from the OS?
Date: Thu, 05 Feb 2015 00:45 +0100
User-agent: KMail/4.14.4 (Linux/3.16.7-7-desktop; KDE/4.14.4; x86_64; ; )

Am Mittwoch, 4. Februar 2015, 22:34:57 schrieb Marcos Cruz:
> I need to compare the modification time of files.  It seems there's no
> way to get it but using the host OS, right?  I've written this:
>       : file-mtime  ( ca1 len1 -- ca2 len2 )
>         \ Modification time of a file
>         \ ca1 len1 = filename
>         \ ca2 len2 = modification time, as an ISO date string
>         s" stat --format=%y " 2swap s+ s" > /tmp/galope.file-mtime" s+ system
>         s" /tmp/galope.file-mtime" slurp-file
>         ;
> Is there a better way to get the data from the shell than writing and
> reading a temporary file? 'getenv' and pipes are useless in this case, I
> think.

The C interface is the right thing to get access to stat/lstat/fstat.
Gforth git head has those already in unix/filestat.fs

Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o ID: kQusJzA;address@hidden(dQ*

reply via email to

[Prev in Thread] Current Thread [Next in Thread]