This source file includes following definitions.
- file_type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #include <config.h>
22
23 #include "file-type.h"
24
25 #include <gettext.h>
26 #define _(text) gettext (text)
27
28 char const *
29 file_type (struct stat const *st)
30 {
31
32
33
34
35
36
37
38
39 if (S_ISREG (st->st_mode))
40 return st->st_size == 0 ? _("regular empty file") : _("regular file");
41
42 if (S_ISDIR (st->st_mode))
43 return _("directory");
44
45 if (S_ISLNK (st->st_mode))
46 return _("symbolic link");
47
48
49
50
51 if (S_TYPEISMQ (st))
52 return _("message queue");
53
54 if (S_TYPEISSEM (st))
55 return _("semaphore");
56
57 if (S_TYPEISSHM (st))
58 return _("shared memory object");
59
60 if (S_TYPEISTMO (st))
61 return _("typed memory object");
62
63
64
65 if (S_ISBLK (st->st_mode))
66 return _("block special file");
67
68 if (S_ISCHR (st->st_mode))
69 return _("character special file");
70
71 if (S_ISCTG (st->st_mode))
72 return _("contiguous data");
73
74 if (S_ISFIFO (st->st_mode))
75 return _("fifo");
76
77 if (S_ISDOOR (st->st_mode))
78 return _("door");
79
80 if (S_ISMPB (st->st_mode))
81 return _("multiplexed block special file");
82
83 if (S_ISMPC (st->st_mode))
84 return _("multiplexed character special file");
85
86 if (S_ISMPX (st->st_mode))
87 return _("multiplexed file");
88
89 if (S_ISNAM (st->st_mode))
90 return _("named file");
91
92 if (S_ISNWK (st->st_mode))
93 return _("network special file");
94
95 if (S_ISOFD (st->st_mode))
96 return _("migrated file with data");
97
98 if (S_ISOFL (st->st_mode))
99 return _("migrated file without data");
100
101 if (S_ISPORT (st->st_mode))
102 return _("port");
103
104 if (S_ISSOCK (st->st_mode))
105 return _("socket");
106
107 if (S_ISWHT (st->st_mode))
108 return _("whiteout");
109
110 return _("weird file");
111 }