home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / dos / dir / fnsplit.txh < prev    next >
Encoding:
Text File  |  1995-12-26  |  2.3 KB  |  97 lines

  1. @node fnmerge, file system
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <dir.h>
  6.  
  7. void fnmerge (char *path, const char *drive, const char *dir,
  8.         const char *name, const char *ext);
  9. @end example
  10.  
  11. @subheading Description
  12.  
  13. This function constructs a file @var{path} from its components
  14. @var{drive}, @var{dir}, @var{name}, and @var{ext}.  If any of these is a
  15. @code{NULL} pointer, it won't be used.  Usually, the @var{drive} string
  16. should include the trailing colon @code{`:'}, the @var{dir} string should
  17. include the trailing slash @code{`/'} or backslash @code{`\'}, and the
  18. @var{ext} string should include the leading dot @code{`.'}.  However, if
  19. any of these isn't present, @code{fnmerge} will add them.
  20.  
  21. @xref{fnsplit}.
  22.  
  23. @subheading Return Value
  24.  
  25. None.
  26.  
  27. @subheading Example
  28.  
  29. @example
  30. char buf[MAXPATH];
  31. fnmerge(buf, "d:", "/foo/", "data", ".txt");
  32. @end example
  33.  
  34. @c ----------------------------------------------------------------------
  35. @node fnsplit, file system
  36. @subheading Syntax
  37.  
  38. @example
  39. #include <dir.h>
  40.  
  41. int fnsplit (const char *path, char *drive, char *dir, 
  42.         char *name, char *ext);
  43. @end example
  44.  
  45. @subheading Description
  46.  
  47. This function decomposes a @var{path} into its components.  It is smart
  48. enough to know that @code{.} and @code{..} are directories.
  49. The @var{drive}, @var{dir}, @var{name} and @var{ext} arguments should
  50. all be passed, but some or even all of them might be @code{NULL} pointers.
  51. Those of them which are non-@code{NULL} should point to buffers which have
  52. enough room for the strings they would hold.  The constants @code{MAXDRIVE},
  53. @code{MAXDIR}, @code{MAXFILE} and @code{MAXEXT}, defined on dir.h, define
  54. the maximum length of these buffers.
  55.  
  56. @xref{fnmerge}.
  57.  
  58. @subheading Return Value
  59.  
  60. A flag that indicates which components were found:
  61.  
  62. @table @code
  63.  
  64. @item DRIVE
  65.  
  66. The drive letter was found.
  67.  
  68. @item DIRECTORY
  69.  
  70. A directory or subdirectories was found.
  71.  
  72. @item FILENAME
  73.  
  74. A filename was found.
  75.  
  76. @item EXTENSION
  77.  
  78. An extension was found.
  79.  
  80. @item WILDCARDS
  81.  
  82. The path included @code{*} or @code{?}.
  83.  
  84. @end table
  85.  
  86. @subheading Example
  87.  
  88. @example
  89. char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT];
  90. int which = fnsplit("d:/djgpp/bin/gcc.exe", d, p, f, e);
  91. d = "d:"
  92. p = "/djgpp/bin/"
  93. f = "gcc"
  94. e = ".exe"
  95. @end example
  96.  
  97.