FMT(3)
π NAME π
hii bestie π okay so this is FMT(3) from the Library Functions Manual β the string formatting routines page. Lowkey iconic little collection, fr fr.
fmtβ string formatting routines β¨
β¨ SYNOPSIS β¨
#include <ast.h>
#include <ls.h>
char* fmtbase(long number, int base, int prefix);
char* fmtdev(struct stat* st);
char* fmtelapsed(unsigned long count, int persec)
char* fmterror(int errno);
char* fmtesc(const char* string);
char* fmtfs(struct stat* st);
char* fmtgid(int gid);
char* fmtmatch(const char* re);
char* fmtmode(int mode, int external);
char* fmtperm(int perm);
char* fmtre(const char* pattern);
char* fmtsignal(int sig);
char* fmttime(const char* format, time_t tm);
char* fmtuid(int uid);
π DESCRIPTION π
Okay so these routines return a pointer to a formatted string for various numeric and string entities. Some routines may cache information to speed up the next call. Most of the routines return a pointer to a private buffer, the contents of which are overwritten on the next call to that routine. Most fmt routines have a corresponding str routine that converts in the other direction. Ngl there is nothing spectacular about this collection other than that it provides a single place where the exact format is spelled out β and honestly bestie, that's the vibe.
fmtbaseβ formats a basebaserepresentation fornumber. Ifprefix != 0then the base prefix is included in the formatted string. Ifnumber == 0orbase == 0then the output is signed base 10. πfmtdevβ returns the device handle name specified by the stat structurest. This is the device information displayed byls -l. πfmtelapsedβ formats the elapsed time for(count/persec)seconds. The two largest time units are used, limiting the return value length to at most 6 characters. The units are:sβ secondsmβ minuteshβ hoursdaysβ daysweeksβ weeksMβ monthsYβ yearsSβ scores
fmterrorβ returns the system error message text for the error numbererrno. πfmtescβ formats non-ASCII characters instringinto C-style\sequences. These sequences are understood bychrescandchrtoi. π§fmtfsβ returns the file system type name corresponding to the stat structurest. πΈfmtgidβ returns the group name forgid. π«Άfmtmatchβ returns thestrmatchequivalent pattern for the regular expression patternre.0is returned for invalidre. βfmtmodeβ returns thels -lmode string for the file mode bits inmode. Ifexternal != 0thenmodeismodecanon(3)canonical. π₯fmtpermβ returns thechmodpermission string for the permission bits inperm. πfmtreβ returns the regular expression equivalent pattern for thestrmatchpatternpattern.0is returned for invalidpattern. π¦fmtsignalβ returns the signal name, sans SIG, for the signal numbersig. Ifsig < 0then the description text for-sigis returned. πfmttimeβ returns the results oftmfmt(buf,sizeof(buf),format,tm)in the private bufferbuf. πfmtuidβ returns the user name foruid. π
π SEE ALSO π
go peek at modecanon(3) and str(3) π
okay bye bestie π«Ά β this was FMT(3) from the Library Functions Manual; no separate source/version/date line to copy, just the page tag π
π¦ where this page comes from
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms