Scroll to navigation

STRLS(3) Library Functions Manual STRLS(3)

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

fmtls formats 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) 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:

Use st->st_atime rather than st->st_mtime for LS_LONG.
Use st->st_mtime rather than st->st_mtime for LS_LONG.
List the number of blocks.
List the file serial number (inode number).
List the file mode, link count, user and group name, size or major/minor device number, and date along with the file name.
The file name is appended with / for directories, @ for symbolic links, and * for executable files.
Omit the group name from LS_LONG.
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), stat(2), strmode(3)