From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: recursing through directories Date: Mon, 22 Apr 2002 11:09:30 -0700 (PDT) Sender: emacs-devel-admin@gnu.org Message-ID: <200204221809.g3MI9Uh07012@shade.twinsun.com> References: NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1019499948 29026 127.0.0.1 (22 Apr 2002 18:25:48 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 22 Apr 2002 18:25:48 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from mail-relay.eunet.no ([193.71.71.242]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16ziVX-0007Y2-00 for ; Mon, 22 Apr 2002 20:25:48 +0200 Original-Received: from quimby.gnus.org (quimby.gnus.org [80.91.224.244]) by mail-relay.eunet.no (8.12.2/8.12.2/GN) with ESMTP id g3MIPmQn089251 for ; Mon, 22 Apr 2002 20:25:48 +0200 (CEST) (envelope-from emacs-devel-admin@gnu.org) Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16ziJc-0003P1-00 for ; Mon, 22 Apr 2002 20:13:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16ziIO-0001v4-00; Mon, 22 Apr 2002 14:12:12 -0400 Original-Received: from alcor.twinsun.com ([198.147.65.9]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16ziFp-0001fD-00; Mon, 22 Apr 2002 14:09:33 -0400 Original-Received: from shade.twinsun.com ([192.54.239.27]) by alcor.twinsun.com (8.12.1/8.12.1) with ESMTP id g3MI9UPd009108; Mon, 22 Apr 2002 11:09:30 -0700 (PDT) Original-Received: (eggert@localhost) by shade.twinsun.com (8.11.6+Sun/8.11.6) id g3MI9Uh07012; Mon, 22 Apr 2002 11:09:30 -0700 (PDT) Original-To: pot@gnu.org In-Reply-To: Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:3044 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:3044 > From: Francesco Potorti` > 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. 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); }