unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@twinsun.com>
Cc: emacs-devel@gnu.org
Subject: Re: recursing through directories
Date: Mon, 22 Apr 2002 11:09:30 -0700 (PDT)	[thread overview]
Message-ID: <200204221809.g3MI9Uh07012@shade.twinsun.com> (raw)
In-Reply-To: <E16zf7I-0003hj-00@pot.cnuce.cnr.it>

> From: Francesco Potorti` <pot@gnu.org>
> Date: Mon, 22 Apr 2002 16:48:32 +0200
> 
> Looking at the libc functions, I think that scandir is the most useful
> for this job.  Is it standard enough?

Not really, unfortunately.  ftw is standard, but it's a portability
hassle too.  In practice, there are real problems in running out of
file descriptors when descending into deeply nested directories.

You might try taking a look at lib/savedir.[ch] from the GNU core
utilities, written by David MacKenzie.
<ftp://alpha.gnu.org/gnu/fetish/fileutils-4.1.8.tar.gz>
It's what I use in GNU tar.  Here's a precis:

  char *name_space = savedir (dir);
  if (! name_space)
    report_error (errno, dir);
  else
    {
      char *base;
      for (base = name_space; *base; base += strlen (base) + 1)
	operate_on (string_concat (dir, "/", base));
      free (name_space);
    }

  parent reply	other threads:[~2002-04-22 18:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-22 14:48 recursing through directories Francesco Potorti`
2002-04-22 15:06 ` Andreas Schwab
2002-04-22 18:09 ` Paul Eggert [this message]
2002-04-22 18:31   ` Eli Zaretskii
2002-04-23  9:45   ` Francesco Potorti`
2002-04-23 23:56     ` Paul Eggert
2002-04-24  1:11       ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200204221809.g3MI9Uh07012@shade.twinsun.com \
    --to=eggert@twinsun.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).