home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / stdwin / Doc / man / glob.3 < prev    next >
Encoding:
Text File  |  1986-06-29  |  2.2 KB  |  71 lines  |  [TEXT/????]

  1. .TH GLOB 3 "June 28, 1986"
  2. .AT 3
  3. .SH NAME
  4. glob \- expand meta-characters in file names
  5. .SH SYNOPSIS
  6. .nf
  7. .B "int glob(pattern, buffer, size)
  8. .B "char *pattern;
  9. .B "char *buffer;
  10. .B "unsigned int size;
  11. .fi
  12. .SH DESCRIPTION
  13. .I Glob
  14. expands the meta-characters *, ? and [...] in
  15. .I pattern
  16. and copies the file name(s) that match the pattern to 
  17. .I buffer ,
  18. whose length is given by
  19. .I size .
  20. .PP
  21. Before expansion is attempted, the pattern is processed as follows:
  22. an initial
  23. .I ~user
  24. is replaced by
  25. .I user's
  26. home directory, an initial ~ is replaced by the contents of $HOME,
  27. and an initial
  28. .I $variable
  29. is replaced by the contents of the environment variable by that name.
  30. The universal quoting character \e can be prefixed to *, ? and [, to
  31. initial ~ or $, and to itself to prevent the special meaning.
  32. .PP
  33. The expansion algorithm used is believed to give exactly the same
  34. results as the expansion of meta-characters by the Bourne shell
  35. .I sh (1),
  36. except for the different quoting mechanism and the expansion of ~ and $.
  37. The files are sorted.
  38. .SH RETURN VALUE
  39. .I Glob
  40. returns the number of files matching the pattern that could be
  41. transferred to the buffer.
  42. If no files match, the return value is 0 but the pattern is copied to
  43. the buffer after expansion of ~, $ and \e-quotes.
  44. .SH SEE ALSO
  45. sh(1)
  46. .SH AUTHOR
  47. Guido van Rossum, CWI, Amsterdam <guido@mcvax.uucp>
  48. .SH DIAGNOSTICS
  49. There are no explicit diagnostics.
  50. If there is not enough memory to hold the internal lists of
  51. partially-matching files, not all matching files may be found.
  52. If the buffer has not enough space to hold all matching files, as many
  53. as will fit are transferred to it.
  54. If
  55. .I $variable
  56. has no value, the empty string is substituted.
  57. If no expansion can be found for ~ or
  58. .I ~user ,
  59. it is left in the pattern unchanged.
  60. If 
  61. .SH BUGS
  62. There should be an interface to the ``raw'' globbing algorithm, which
  63. can return an arbitrary number of files in a ``malloced'' structure and
  64. does not do ~ or $ expansion or \e-quoting.
  65. .PP
  66. The code uses the Berkeley directory-reading package, so in order to
  67. port it to v7 or sys5 you'll need to get hold of a public domain
  68. re-implementation of that package.
  69. .PP
  70. The name is a relict from ancient times.
  71.