home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.20 / text0077.txt < prev    next >
Encoding:
Text File  |  1990-08-02  |  2.5 KB  |  63 lines

  1. Moderator!:  Delete most of these lines (begin):
  2. Return-Path: <uunet!goanna.cs.rmit.OZ.AU!ok>
  3. Submitted-From: uunet!goanna.cs.rmit.OZ.AU!ok (Richard A. O'Keefe)
  4. Moderator!:  Delete most of these lines (end).
  5.  
  6. From:  ok@goanna.cs.rmit.OZ.AU (Richard A. O'Keefe)
  7.  
  8.  
  9. >In <385@usenix.ORG> From: jsh@usenix.org, Paul Rabin <rabin@osf.org>
  10. > reports on the April 23-27 meeting in Salt Lake City, UT:
  11. >...
  12. > There was a discussion about whether it is possible (and preferable)
  13. > to improve the low-level directory interfaces instead of adding new,
  14. > high-level interfaces.  Do the high-level interfaces really add new
  15. > functionality for portable applications?  Do they belong with the
  16. > low-level operating system interfaces specified in 1003.1?
  17.  
  18. In article <754@longway.TIC.COM>, gwyn@smoke.brl.mil (Doug Gwyn) writes:
  19. > From:  Doug Gwyn <gwyn@smoke.brl.mil>
  20. > No, definitely not.  However, they would be appropriate at the 1003.2
  21. > level.
  22.  
  23. If I want file tree walking, what's wrong with something on the order of
  24.     FILE *files_selected = popen("find ......");
  25. Presumably popen() and 'find' have to be in 1003.2 anyway.  There is
  26. precisely one reason why I can't use this right now, and that is that
  27. 'find' doesn't quote its output, so if there is a file name with an
  28. embedded \n things break.  That might be addressed by any number of
  29. methods; one simple method would be to add a
  30.     -length
  31. subcommand which would do the equivalent of
  32.     printf("%d %s\n", strlen(pathname), pathname);
  33. where the existing
  34.     -print
  35. subcommand does the equivalent of
  36.     printf("%s\n", pathname);
  37.  
  38. If I understand Doug Gwyn correctly, that's the kind of thing he has
  39. in mind.  It is, after all, no more than the traditional UNIX Way.
  40.  
  41. By the way, I don't quite understand the file tree walking problem.
  42. Unless one has some absolutely compelling reason for requiring a
  43. depth-first search and not using /tmp files, something like 'find'
  44. can be done using
  45.     - one file descriptor to send file names to
  46.       (used sequentially)
  47.     - one file descriptor for a work file
  48.       (random access)
  49.     - one directory descriptor or whatever
  50.       (each directory being opened once, scanned once, and
  51.        never looked at again)
  52. Basically you do a breadth-first search of directories, using the work
  53. file to hold the queue.  If you want some other order, sort the output.
  54. This is, of course, vulnerable to directories being renamed while the
  55. walk is in progress, but so is a depth-first walker that can't hang on
  56. to all the directories in the current branch.
  57.  
  58. -- 
  59. "private morality" is an oxymoron, like "peaceful war".
  60.  
  61. Volume-Number: Volume 20, Number 76
  62.  
  63.