home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / gnu / djgpp / libsrc / c / gen / pathconf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-16  |  1.3 KB  |  52 lines

  1. /*
  2.   (c) Copyright 1992 Eric Backus
  3.  
  4.   This software may be used freely so long as this copyright notice is
  5.   left intact.  There is no warrantee on this software.
  6. */
  7.  
  8. #include <errno.h>        /* For EINVAL */
  9. #include <unistd.h>        /* For _PC_* */
  10. #include <limits.h>        /* For *_MAX, etc. */
  11.  
  12. /* The _PC_* values for "name" should be defined in <unistd.h> */
  13. /* The corresponding constants should be defined in <limits.h> */
  14. long
  15. pathconf(const char *path, int name)
  16. {
  17.     switch (name)
  18.     {
  19.     case _PC_LINK_MAX:        return LINK_MAX;
  20.     case _PC_MAX_CANON:        return MAX_CANON;
  21.     case _PC_MAX_INPUT:        return MAX_INPUT;
  22.     case _PC_NAME_MAX:        return NAME_MAX;
  23.     case _PC_PATH_MAX:        return PATH_MAX;
  24.     case _PC_PIPE_BUF:        return PIPE_BUF;
  25. #ifdef    _POSIX_CHOWN_RESTRICTED
  26.     case _PC_CHOWN_RESTRICTED:    return _POSIX_CHOWN_RESTRICTED;
  27. #else
  28.     case _PC_CHOWN_RESTRICTED:    return -1;
  29. #endif
  30. #ifdef    _POSIX_NO_TRUNC
  31.     case _PC_NO_TRUNC:        return _POSIX_NO_TRUNC;
  32. #else
  33.     case _PC_NO_TRUNC:        return -1;
  34. #endif
  35. #ifdef    _POSIX_VDISABLE
  36.     case _PC_VDISABLE:        return _POSIX_VDISABLE;
  37. #else
  38.     case _PC_VDISABLE:        return -1;
  39. #endif
  40.  
  41.     default:
  42.     errno = EINVAL;
  43.     return -1;
  44.     }
  45. }
  46.  
  47. long
  48. fpathconf(int fildes, int name)
  49. {
  50.     return pathconf("/", name);
  51. }
  52.