---
name: "fmtls"
section: "3"
platform: "macos"
package: "ksh"
version: "42"
release: "macOS 26.5"
platforms: ["macos"]
url: "https://new.carta.tech/fmtls"
---

# fmtls(3)

format file information in buffer

## NAME

fmtls - format file information in buffer

## SYNOPSIS

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

## DESCRIPTION

$1$2fmtlsfmtlsfmtlsfmtlsfmtlsfmtlsfmtlsfmtls formats [*ls*(1)](/ls/1.md) 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)](/stat/2.md) 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**

  Use *st-\>st\_atime* rather than *st-\>st\_mtime* for **LS\_LONG**.

- **LS\_CTIME**

  Use *st-\>st\_mtime* rather than *st-\>st\_mtime* for **LS\_LONG**.

- **LS\_BLOCKS**

  List the number of blocks.

- **LS\_INUMBER**

  List the file serial number (inode number).

- **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**

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

- **LS\_NOGROUP**

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

- **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

[ls(1)](/ls/1.md), [stat(2)](/stat/2.md), [strmode(3)](/strmode/3.md)
