home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / sys5 / r4 / 835 < prev    next >
Encoding:
Text File  |  1992-12-15  |  1.7 KB  |  60 lines

  1. Newsgroups: comp.unix.sys5.r4
  2. Path: sparky!uunet!mcsun!chsun!osnbe!
  3. From: rheiger@renext.open.ch (Richard H. E. Eiger)
  4. Subject: Problems with "dirent"
  5. Message-ID: <1992Dec13.193122.22173@osnbe.Olivetti.ch>
  6. Sender: @osnbe.Olivetti.ch
  7. Nntp-Posting-Host: renext
  8. Reply-To: rheiger@renext.open.ch
  9. Organization: Olivetti (Schweiz) AG, Branch Office Berne
  10. Date: Sun, 13 Dec 1992 19:31:22 GMT
  11. Lines: 47
  12.  
  13. While trying to compile and install tayllor uucp I stumbled over a very strange  
  14. behaveiour of the dirent directory reading routines (opendir and readdir).  
  15. Basically what's happening is that a directory is opened:
  16.  
  17. static DIR *topdir;
  18. ..
  19. func1()
  20. {
  21.     topdir = opendir(".");
  22. ..
  23. }
  24.  
  25. Then, in a second function of the same module the directory entries are being  
  26. read in a loop:
  27.  
  28. func2()
  29. {
  30.     struct dirent *dp;
  31. ..
  32.     for(;;){
  33.  
  34.         dp = readdir(topdir);
  35.         perform(dp->d_name);
  36. ..
  37. }
  38.  
  39. Now, for some strange reason the first two characters of the entries are  
  40. missing. Actually they are there, just at (dp-d_name[-2])! In order to  
  41. reproduce the problem I tried to write a program which just reads the current  
  42. directory. There it works flawlessly. I added a few debugging statements  
  43. through which I have been able to conclude that the structure itself really is  
  44. identical including the offsets for dp->d_name...
  45.  
  46. I can only assume that there has to be something depending on additional  
  47. libraries (I have to use -lsocket -lnsl -lucb). Can anyone confirm?
  48.  
  49. BTW. I use Olivetti SVR4 (Olivetti release 2.1.1)
  50.  
  51.     Richard
  52.  
  53. --
  54.                          
  55.     ___           _____2
  56.    /   )  /  /   /        Richard H. E. Eiger
  57.   /_ _/  /__/   /__       Ing. Informatik HTL
  58.  /\     /  /   /          Unregistered NeXT fan
  59. /  \   /  /   /_____      rheiger@renext.eiger.olivetti.ch (NeXT mail welcome)
  60.