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 STRLS 3
40.SH NAME
41fmtls \- format file information in buffer
42.SH SYNOPSIS
43.EX
44#include <ls.h>
45
46char*         fmtls(char* \fIbuf\fP, char* \fIname\fP, struct stat* \fIst\fP, char* \fIinfo\fP, char* \fIlink\fP, int \fIflags\fP);
47.EE
48.SH DESCRIPTION
49.L fmtls
50formats
51.IR ls (1)
52style file information into the buffer
53.IR buf .
54A pointer to the trailing 0 in 
55.I buf
56is returned.
57.I name
58is the file name.
59.I st
60is a pointer to the
61.B "struct stat
62status information for
63.I name
64obtained from one of the
65.IR stat (2)
66routines.
67.I info
68is an additional string that will appear before
69.I name
70in
71.I buf
72and
73.I link
74is the name of the related hard or soft link file.
75Both
76.I info
77and
78.I link
79may be 0.
80.I flags
81controls the format style and may be a combination of the following:
82.PP
83.TP
84.B LS_ATIME
85Use
86.I st->st_atime
87rather than
88.I st->st_mtime
89for
90.BR LS_LONG .
91.TP
92.B LS_CTIME
93Use
94.I st->st_mtime
95rather than
96.I st->st_mtime
97for
98.BR LS_LONG .
99.TP
100.B LS_BLOCKS
101List the number of blocks.
102.TP
103.B LS_INUMBER
104List the file serial number (inode number).
105.TP
106.B LS_LONG
107List the file mode, link count, user and group name,
108size or major/minor device number, and date along with the
109file name.
110.TP
111.B LS_MARK
112The file name is appended with
113.L /
114for directories,
115.L @
116for symbolic links,
117and
118.L *
119for executable files.
120.TP
121.B LS_NOGROUP
122Omit the group name from
123.BR LS_LONG .
124.TP
125.B LS_NOUSER
126Omit the user name from
127.BR LS_LONG .
128.PP
129The user and group fields are each
130.B LS_W_NAME
131characters wide,
132the
133.B LS_INUMBER 
134field is
135.B LS_W_INUMBER
136characters wide,
137and the
138.B LS_BLOCKS
139field is
140.B LS_W_BLOCKS
141characters wide.
142.SH "SEE ALSO"
143ls(1), stat(2), strmode(3)
144