Re: Directory contents.

From: Kasper Dupont (kasperd_at_daimi.au.dk)
Date: 04/03/05


Date: Sun, 03 Apr 2005 12:07:27 +0200

Måns Rullgård wrote:
>
> Lorenzo Vaina <ducadimarteNOSPAM@toglimi-katamail.com> writes:
>
> > I'm developing a function in C that have to do something like "ls -R".
> > I tried using scandir() but i don't know how distinguish regular files by
> > other file and regular file against directory, over all.
> > Have you any suggestion, please?
>
> man stat

On my system that command will not give the desired
man page. It will give me stat(1), however in this
particular case it is really stat(2), which is of
interest. Actually I think stat is not even the
right function to use for this, lstat should be used
instead. So try:

man 2 lstat

(or just man lstat, since there usually isn't any
lstat man page in section 1.)

-- 
Kasper Dupont


Relevant Pages

  • Re: lstat/stat behaviour on symlink to "pipe"
    ... A segmentation fault from lstat shouldn't be possible ... be a symlink, ... > against it while scanning a directory? ... ignore anything but regular files and directories. ...
    (comp.os.linux.development.system)
  • Re: comp.unix.shell FAQ - Answers to Frequently Asked Questions
    ... For regular files, wc uses the stat or lseek system ... >> call that shouldn't be much slower than lstat. ... >> file the wc result is not the same as the lstat one. ...
    (comp.unix.shell)
  • Re: Directory contents.
    ... Lorenzo Vaina wrote: ... > I tried using scandir() but i don't know how distinguish regular files by ... to a flavour of Unix that don't has this function. ...
    (comp.os.linux.development.apps)
  • Re: Directory contents.
    ... Lorenzo Vaina writes: ... > I tried using scandir() but i don't know how distinguish regular files by ... Måns Rullgård ...
    (comp.os.linux.development.apps)