I have a simple program which prints whether a pathname argument is either a directory, regular file with execute privileges, a regular file, a symbolic link, or other.I have the following if statement to determine this (mode_t mode originates from struct stat):if (mode & S_IFDIR){    mode_s[n] = 'd';} else if (is_user_exec(mode, ouid, ogid) && (mode & S_IFREG)){    mode_s[n] = 'e';}else if (mode & S_IFREG){    mode_s[n] = 'f';} else if (mode & S_IFLNK){    mode_s[n] = 'l';} else {    mode_s[n] = 'o';}All works well for the first three, but when I pass what should be classified as o, it lists it as l.Can anyone figure out why my code is causing this?FYI, I'm compiling and running the program on MINIX 3.2.1 and the troublesome pathname in question is /dev/ptyp8
File Stat Program
files;minix;file types
Whilst I don't have a MINIX system available, I am sure the problem is that the mode doesn't have distinct bits for the various filetypes. You should be using the macros like S_ISDIR rather than comparing to S_IFDIR (S rather than F). Here is the GNU C library.Here are the old versions from a linux machine. The leading 0 means these values are in octal.  #define S_ISDIR(m)    (((m) & S_IFMT) == S_IFDIR)  #define S_IFMT  00170000  #define S_IFSOCK 0140000  #define S_IFLNK  0120000  #define S_IFREG  0100000  #define S_IFBLK  0060000  #define S_IFDIR  0040000  #define S_IFCHR  0020000etc. So your code is testing to see if (mode & 0120000) is non-zero, and it will be if either the 0100000 or the 020000 bit is set, which it will be for S_IFSOCK, S_IFLNK, S_IFREG, S_IFBLK, and S_IFCHR. Your pts will be of type S_IFCHR.