2 file_type (struct stat const *st)
4 /* See POSIX 1003.1-2001 for these formats.
6 To keep diagnostics grammatical in English, the returned string
7 must start with a consonant. */
9 if (S_ISREG (st->st_mode))
10 return st->st_size == 0 ? _("regular empty file") : _("regular file");
12 if (S_ISDIR (st->st_mode))
13 return _("directory");
15 if (S_ISBLK (st->st_mode))
16 return _("block special file");
18 if (S_ISCHR (st->st_mode))
19 return _("character special file");
21 if (S_ISFIFO (st->st_mode))
24 if (S_ISLNK (st->st_mode))
25 return _("symbolic link");
27 if (S_ISSOCK (st->st_mode))
31 return _("message queue");
34 return _("semaphore");
37 return _("shared memory object");
40 return _("typed memory object");
42 return _("weird file");