home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.sys5.r4
- Path: sparky!uunet!mcsun!chsun!osnbe!
- From: rheiger@renext.open.ch (Richard H. E. Eiger)
- Subject: Problems with "dirent"
- Message-ID: <1992Dec13.193122.22173@osnbe.Olivetti.ch>
- Sender: @osnbe.Olivetti.ch
- Nntp-Posting-Host: renext
- Reply-To: rheiger@renext.open.ch
- Organization: Olivetti (Schweiz) AG, Branch Office Berne
- Date: Sun, 13 Dec 1992 19:31:22 GMT
- Lines: 47
-
- While trying to compile and install tayllor uucp I stumbled over a very strange
- behaveiour of the dirent directory reading routines (opendir and readdir).
- Basically what's happening is that a directory is opened:
-
- static DIR *topdir;
- ..
- func1()
- {
- topdir = opendir(".");
- ..
- }
-
- Then, in a second function of the same module the directory entries are being
- read in a loop:
-
- func2()
- {
- struct dirent *dp;
- ..
- for(;;){
-
- dp = readdir(topdir);
- perform(dp->d_name);
- ..
- }
-
- Now, for some strange reason the first two characters of the entries are
- missing. Actually they are there, just at (dp-d_name[-2])! In order to
- reproduce the problem I tried to write a program which just reads the current
- directory. There it works flawlessly. I added a few debugging statements
- through which I have been able to conclude that the structure itself really is
- identical including the offsets for dp->d_name...
-
- I can only assume that there has to be something depending on additional
- libraries (I have to use -lsocket -lnsl -lucb). Can anyone confirm?
-
- BTW. I use Olivetti SVR4 (Olivetti release 2.1.1)
-
- Richard
-
- --
-
- ___ _____2
- / ) / / / Richard H. E. Eiger
- /_ _/ /__/ /__ Ing. Informatik HTL
- /\ / / / Unregistered NeXT fan
- / \ / / /_____ rheiger@renext.eiger.olivetti.ch (NeXT mail welcome)
-