From - Thu Oct 17 09:45:15 1996
Received: by naja.natlab.research.philips.com ; Wed, 16 Oct 1996 19:55:42 +0200
Received: by natlab.research.philips.com; Wed, 16 Oct 1996 19:55:41 +0200
Received: from gw-nl1.philips.com (gw-nl1.philips.com [130.144.65.3]) by smtp.nl.cis.philips.com (8.6.10/8.6.10-0.9z-02May95) with ESMTP id SAA28925 for <waterlan@natlab.research.philips.com>; Wed, 16 Oct 1996 18:58:55 +0100
Received: (from nobody@localhost) 
	by gw-nl1.philips.com (8.6.10/8.6.10-0.994n-08Nov95) id TAA04921
	for <waterlan@natlab.research.philips.com>; Wed, 16 Oct 1996 19:55:38 +0200
Received: from nssdc.gsfc.nasa.gov(128.183.101.19) by gw-nl1.philips.com via smap (V1.3+ESMTP) with SMTP
	id sma004890; Wed Oct 16 19:55:10 1996
Received: by nssdc.gsfc.nasa.gov; id AA06554; Wed, 16 Oct 1996 13:55:06 -0400
From: Jason Mathews <mathews@nssdc.gsfc.nasa.gov>
Message-Id: <9610161755.AA06554@nssdc.gsfc.nasa.gov>
Subject: Re: recursive filelist in unix.
To: waterlan@natlab.research.philips.com (Erwin Waterlander)
Date: Wed, 16 Oct 1996 13:55:06 -0400 (GMT)
In-Reply-To: <3265008D.3BF1@natlab.research.philips.com> from "Erwin Waterlander" at Oct 16, 96 05:34:37 pm
X-Mailer: ELM [version 2.4 PL25]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Mozilla-Status: 0011

> Hi Jason,
> 
> I downloaded your Portable DOS/UNIX/VMS Directory Interface
> from the Simtel net (dosdir21.zip). 
> 
> I compiled the source-code on a HP-UX 10.10 system and
> it works fine.
> 
> I have one question:
> How can I prevent filelist to follow directory links?
> Here is an example were a ran filelist in my homedirectory.

You just need to change calls to stat() to lstat() in the file
dosdir.c

This way if the named file is a symbolic link then lstat returns information
about the link, while stat returns information about the file the link
references.

I would add the following to the file dosdir.c after the include
statements:

#ifdef UNIX
#  define STAT lstat /* don't expand symbolic links */
#else
#  define STAT stat
#endif

And then change the 3 references of stat( to STAT(

For example:

int dd_findnext(fb)
{
 ...

 if (STAT(fb->dd_dp->d_name, &dd_sstat))
        continue;
 ...
}

I think that should change the behavior.

Thanks for the question. I hadn't thought of sym links and that
could easily cause an infinite recursion if a cycle exists.

jason

> $ filelist -s
> 
> searches the directory's as follows:
> Directory of /tmp_mnt/home/waterlan/*
> Directory of /tmp_mnt/home/waterlan/.elm/*
> Directory of /tmp_mnt/home/waterlan/Mail/*
> Directory of /tmp_mnt/home/waterlan/.vue/*
> Directory of /tmp_mnt/home/waterlan/.vue/Desktop/*
> Directory of /tmp_mnt/home/waterlan/.vue/Desktop/One/*
> Directory of /tmp_mnt/home/waterlan/.vue/Desktop/Two/*
> Directory of /tmp_mnt/home/waterlan/.vue/Desktop/Three/*
> Directory of /tmp_mnt/home/waterlan/.vue/Desktop/Four/*
> Directory of /tmp_mnt/home/waterlan/.vue/apps/*
> Directory of /etc/vue/config/types/tools/*
> Directory of /etc/vue/config/types/tools/System_Info/*
> Directory of /etc/vue/config/types/tools/System_Admin/*
> Directory of /etc/vue/config/types/tools/Media/*
> etc.
> 
> 
> $ ll /tmp_mnt/home/waterlan/.vue/apps 
> total 0
> lrwxr-xr-x   1 waterlan roza          27 Oct  4 12:48 GeneralTools -> /etc/vue/config/types/tools
> lrwxr-xr-x   1 waterlan roza          22 Oct  4 12:48 NetworkTools -> /etc/vue/config/import
> 
> At the end filelist has only searched a small part
> of my directory-tree.
> Can you help me?
> 
> Kind regards,
> 
> -- 
> Erwin Waterlander
> 
> Address : Philips Research Laboratories
>           Building WAY-4.13
>           Prof. Holstlaan 4
>           5656 AA Eindhoven, The Netherlands
> 
> E-mail  : waterlan@natlab.research.philips.com

-- 
--------------------------------------------------------------------
Jason Mathews, Code 633         |National Space Science Data Center
NASA/Goddard Space Flight Center|email: mathews@nssdc.gsfc.nasa.gov
Greenbelt, MD 20771-0001  USA   |http://coney.gsfc.nasa.gov/Mathews/
--------------------------------+
