STRLS(3ast) STRLS(3ast)

# [NAME](#NAME)

fmtls - format file information in buffer

# [SYNOPSIS](#SYNOPSIS)

```
#include <ls.h>
char*         fmtls(char* buf, char* name, struct stat* st, char* info, char* link, int flags);
```

# [DESCRIPTION](#DESCRIPTION)

fmtls formats [*ls*(1)](/man/os/ksh/ls.1) style file information into the buffer *buf*. A pointer to the trailing 0 in *buf* is returned. *name* is the file name. *st* is a pointer to the **struct stat** status information for *name* obtained from one of the [*stat*(2)](/man/os/ksh/stat.2) routines. *info* is an additional string that will appear before *name* in *buf* and *link* is the name of the related hard or soft link file. Both *info* and *link* may be 0. *flags* controls the format style and may be a combination of the following:

[**LS\_ATIME**](#LS_ATIME)

Use *st-&gt;st\_atime* rather than *st-&gt;st\_mtime* for **LS\_LONG**.

[**LS\_CTIME**](#LS_CTIME)

Use *st-&gt;st\_mtime* rather than *st-&gt;st\_mtime* for **LS\_LONG**.

[**LS\_BLOCKS**](#LS_BLOCKS)

List the number of blocks.

[**LS\_INUMBER**](#LS_INUMBER)

List the file serial number (inode number).

[**LS\_LONG**](#LS_LONG)

List the file mode, link count, user and group name, size or major/minor device number, and date along with the file name.

[**LS\_MARK**](#LS_MARK)

The file name is appended with / for directories, @ for symbolic links, and * for executable files.

[**LS\_NOGROUP**](#LS_NOGROUP)

Omit the group name from **LS\_LONG**.

[**LS\_NOUSER**](#LS_NOUSER)

Omit the user name from **LS\_LONG**.

The user and group fields are each **LS\_W\_NAME** characters wide, the **LS\_INUMBER** field is **LS\_W\_INUMBER** characters wide, and the **LS\_BLOCKS** field is **LS\_W\_BLOCKS** characters wide.

# [SEE ALSO](#SEE_ALSO)

[ls(1)](/man/os/ksh/ls.1), [stat(2)](/man/os/ksh/stat.2), [strmode(3)](/man/os/ksh/strmode.3)

---

Document: fmtls(3ast) from ksh 1.0.10-r36 (Chainguard OS)
Source: https://github.com/ksh93/ksh
