home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / utils / source / bsdpsx / mknod.c < prev    next >
C/C++ Source or Header  |  1995-05-18  |  389b  |  21 lines

  1. /*
  2.  * MKNOD: DF_MSS
  3.  */
  4.  
  5. #include <sys/types.h>
  6. #include <sys/stat.h>
  7. #include <unistd.h>
  8.  
  9. int mknod (const char *path, mode_t mode, int dev)
  10. {
  11.     int ret;
  12.  
  13.     if ((mode & S_IFMT) == S_IFDIR)
  14.         ret = mkdir(path, (mode & S_IFMT));
  15.     else if ((mode & S_IFMT) == S_IFIFO)
  16.         ret = mkfifo(path, (mode & S_IFMT));
  17.     else
  18.         ret = -1;
  19.     return ret;
  20. }
  21.