FMT(3)

πŸ“¦ version 93vu, in opensuse-leap 16.0

πŸŽ€ 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 base base representation for number. If prefix != 0 then the base prefix is included in the formatted string. If number == 0 or base == 0 then the output is signed base 10. πŸ’…
  • fmtdev β€” returns the device handle name specified by the stat structure st. This is the device information displayed by ls -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 β€” seconds
    • m β€” minutes
    • h β€” hours
    • days β€” days
    • weeks β€” weeks
    • M β€” months
    • Y β€” years
    • S β€” scores
  • fmterror β€” returns the system error message text for the error number errno. 😭
  • fmtesc β€” formats non-ASCII characters in string into C-style \ sequences. These sequences are understood by chresc and chrtoi. 🧚
  • fmtfs β€” returns the file system type name corresponding to the stat structure st. 🌸
  • fmtgid β€” returns the group name for gid. 🫢
  • fmtmatch β€” returns the strmatch equivalent pattern for the regular expression pattern re. 0 is returned for invalid re. ⭐
  • fmtmode β€” returns the ls -l mode string for the file mode bits in mode. If external != 0 then mode is modecanon(3) canonical. πŸ”₯
  • fmtperm β€” returns the chmod permission string for the permission bits in perm. πŸŽ€
  • fmtre β€” returns the regular expression equivalent pattern for the strmatch pattern pattern. 0 is returned for invalid pattern. πŸ¦‹
  • fmtsignal β€” returns the signal name, sans SIG, for the signal number sig. If sig < 0 then the description text for -sig is returned. πŸ’€
  • fmttime β€” returns the results of tmfmt(buf,sizeof(buf),format,tm) in the private buffer buf. 🌈
  • fmtuid β€” returns the user name for uid. πŸ’œ

🌟 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