home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / bsd / sys / pathname.h < prev    next >
C/C++ Source or Header  |  1993-10-19  |  2KB  |  45 lines

  1. /*    @(#)pathname.h    2.2 88/05/25 NFSSRC4.0 from 2.6 86/07/16 SMI    */
  2.  
  3. /*
  4.  * HISTORY
  5.  * 27-Sep-89  Morris Meyer (mmeyer) at NeXT
  6.  *    NFS 4.0 Changes: Addtional path manipulation routines.
  7.  */
  8.  
  9. /*
  10.  * Pathname structure.
  11.  * System calls which operate on path names gather the
  12.  * pathname from system call into this structure and reduce
  13.  * it by peeling off translated components.  If a symbolic
  14.  * link is encountered the new pathname to be translated
  15.  * is also assembled in this structure.
  16.  */
  17. struct pathname {
  18.     char    *pn_buf;        /* underlying storage */
  19.     char    *pn_path;        /* remaining pathname */
  20.     u_int    pn_pathlen;        /* remaining length */
  21. };
  22.  
  23. #define PN_STRIP 0x00        /* Strip next component off pn */
  24. #define PN_PEEK    0x01          /* Only peek at next pn component */
  25. #define pn_peekcomponent(PNP, COMP) pn_getcomponent(PNP, COMP, PN_PEEK)
  26. #define pn_stripcomponent(PNP, COMP) pn_getcomponent(PNP, COMP, PN_STRIP)
  27.  
  28. #define    pn_peekchar(PNP)    ((PNP)->pn_pathlen>0?*((PNP)->pn_path):0)
  29. #define pn_pathleft(PNP)    ((PNP)->pn_pathlen)
  30. #define pn_getpath(PNP)        ((PNP)->pn_path)
  31. #define pn_copy(PNP1, PNP2)    (pn_set(PNP2, pn_getpath(PNP1)))
  32.  
  33. extern int    pn_alloc();        /* allocat buffer for pathname */
  34. extern int    pn_get();        /* allocate buf and copy path into it */
  35. #ifdef notneeded
  36. extern int    pn_getchar();        /* get next pathname char */
  37. #endif
  38. extern int    pn_set();        /* set pathname to string */
  39. extern int    pn_combine();        /* combine to pathnames (for symlink) */
  40. extern int    pn_getcomponent();    /* get next component of pathname */
  41. extern void    pn_skipslash();        /* skip over slashes */
  42. extern void    pn_free();        /* free pathname buffer */
  43. extern int    pn_append();        /* Append string to pathname */
  44. extern int    pn_getlast();        /* Get last component of pathname */ 
  45.