GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
* Sign Up! *

Support
Customer Portal
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
FMT(3ast) FMT(3ast)

fmt - string formatting routines

#include <ast.h>
#include <ls.h>
char*      fmtint(intmax_t number, int unsign);
char*      fmtdev(struct stat* st);
char*      fmtelapsed(unsigned long count, unsigned long persec)
char*      fmtesc(const char* string);
char*      fmtfs(struct stat* st);
char*      fmtgid(int gid);
char*      fmtmatch(const char* re);
char*      fmtmode(mode_t mode, int external);
char*      fmtperm(mode_t perm);
char*      fmtre(const char* pattern);
char*      fmtsignal(int sig);
char*      fmttime(const char* format, time_t tm);
char*      fmtuid(int uid);

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. There is nothing spectacular about this collection other than that it provides a single place where the exact format is spelled out.

fmtint is a performance-optimized function for formatting a base-10 integer number. If unsign != 0 then the number is treated as unsigned.

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:

seconds
minutes
hours
months
years
scores

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.

modecanon(3), str(3)


Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.