1.fp 5 CW
2.de Af
3.ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4.if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5..
6.de aF
7.ie \\$3 .ft \\$1
8.el \{\
9.ds ;G \&
10.nr ;G \\n(.f
11.Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12\\*(;G
13.ft \\n(;G \}
14..
15.de L
16.aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17..
18.de LR
19.aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20..
21.de RL
22.aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23..
24.de EX		\" start example
25.ta 1i 2i 3i 4i 5i 6i
26.PP
27.RS 
28.PD 0
29.ft 5
30.nf
31..
32.de EE		\" end example
33.fi
34.ft
35.PD
36.RE
37.PP
38..
39.TH MODECANON 3
40.SH NAME
41modecanon \- canonical file mode representation
42.SH SYNOPSIS
43#include <modex.h>
44
45int    modei(int \fIexternal\fP);
46int    modex(int \fIinternal\fP);
47.EE
48.SH DESCRIPTION
49POSIX threw out the file type bit macros and replaced them with
50function-like macros that test file type.
51This is bad in many ways, the worst of which is that it provides
52no way for a user program to synthesize file types in the mode bits.
53.IR pax (1),
54.IR tar (1)
55and
56.IR cpio (1)
57are examples of user programs that must convert between the internal mode
58representation and a private external representation.
59These routines provide a canonical external representation
60with macros to access and synthesize the bits in the external
61representation.
62.PP
63.L modei
64takes an external mode representation
65.I external
66and returns the equivalent internal representation.
67.PP
68.L modex
69takes an internal mode representation
70.I internal
71and returns the equivalent external representation.
72.PP
73The traditional bit access macro (\f5S_\fP prefix changes to \f5X_\fP) are:
74.L X_IFMT ,
75.L X_IFSOCK ,
76.L X_IFLNK ,
77.L X_IFCTG ,
78.L X_IFREG ,
79.L X_IFBLK ,
80.L X_IFDIR ,
81.L X_IFCHR ,
82.L X_IFIFO ,
83.L X_IPERM ,
84.L X_ISUID ,
85.L X_ISGID ,
86.L X_ISVTX ,
87.L X_IRUSR ,
88.L X_IWUSR ,
89.L X_IXUSR ,
90.L X_IRGRP ,
91.L X_IWGRP ,
92.L X_IXGRP ,
93.L X_IROTH ,
94.L X_IWOTH ,
95.L X_IXOTH ,
96.L X_IRWXU ,
97.L X_IRWXG
98and
99.L X_IRWXO .
100.LI X_ITYPE( mode )
101returns the type bits for 
102.IR mode .
103.SH "SEE ALSO"
104pax(1), stat(2)
105