MentOS
0.8.0
The Mentoring Operating System
|
Print formatting routines. More...
Macros | |
#define | CVTBUFSIZE 500 |
Size of the buffer used to call cvt functions. | |
#define | FLAGS_ZEROPAD (1U << 0U) |
Fill zeros before the number. | |
#define | FLAGS_LEFT (1U << 1U) |
Left align the value. | |
#define | FLAGS_PLUS (1U << 2U) |
Print the plus sign. | |
#define | FLAGS_SPACE (1U << 3U) |
If positive add a space instead of the plus sign. | |
#define | FLAGS_HASH (1U << 4U) |
Preceed with 0x or 0X, x or X respectively. | |
#define | FLAGS_UPPERCASE (1U << 5U) |
Print uppercase. | |
#define | FLAGS_SIGN (1U << 6U) |
Print the sign. | |
Functions | |
static int | skip_atoi (const char **s) |
Returns the index of the first non-integer character. More... | |
static char * | number (char *str, long num, int base, int size, int32_t precision, unsigned flags) |
Places the number inside the string. More... | |
static char * | eaddr (char *str, unsigned char *addr, int size, int precision, unsigned flags) |
Prints a MAC address. More... | |
static char * | iaddr (char *str, unsigned char *addr, int size, int precision, unsigned flags) |
Prints an internet address. More... | |
static void | cfltcvt (double value, char *buffer, char fmt, int precision) |
Prints a floating point value. More... | |
static void | forcdecpt (char *buffer) |
Should we force the decimal point. More... | |
static void | cropzeros (char *buffer) |
Crop zero unless '#' given. More... | |
static char * | flt (char *str, double num, int size, int precision, char fmt, unsigned flags) |
Transforms a floating point value to string. More... | |
int | vsprintf (char *str, const char *fmt, va_list args) |
Write formatted data from variable argument list to string. More... | |
int | printf (const char *format,...) |
Write formatted output to stdout. More... | |
int | sprintf (char *str, const char *fmt,...) |
Write formatted output to str . More... | |
Variables | |
static char * | _digits = "0123456789abcdefghijklmnopqrstuvwxyz" |
The list of digits. | |
static char * | _upper_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
The list of uppercase digits. | |
Print formatting routines.
|
static |
Prints a floating point value.
value | the value to print. |
buffer | the buffer where the value is stored. |
fmt | the format. |
precision | the precision. |
|
static |
Crop zero unless '#' given.
buffer | the buffer to work on. |
|
static |
Prints a MAC address.
str | the string where we store the address. |
addr | the address we need to store. |
size | the size available in str. |
precision | the precision to use. |
flags | support flags. |
|
static |
Transforms a floating point value to string.
str | the string where the floating point value should be stored. |
num | the number to store. |
size | the size available for storing the floating point value. |
precision | the precision. |
fmt | the format. |
flags | the support flags. |
|
static |
Should we force the decimal point.
buffer | the buffer where we force the decimal point. |
|
static |
Prints an internet address.
str | the string where we store the address. |
addr | the address we need to store. |
size | the size available in str. |
precision | the precision to use. |
flags | support flags. |
|
static |
Places the number inside the string.
str | the string where the number will end up in. |
num | the number. |
base | the base used to transform the number. |
size | the size available for storing the number. |
precision | the precision. |
flags | support flags. |
int printf | ( | const char * | fmt, |
... | |||
) |
Write formatted output to stdout.
fmt | The format string. |
... | The list of arguments. |
|
inlinestatic |
Returns the index of the first non-integer character.
s | the string. |
int sprintf | ( | char * | str, |
const char * | fmt, | ||
... | |||
) |
Write formatted output to str
.
str | The buffer where the formatted string will be placed. |
fmt | Format string, following the same specifications as printf. |
... | The list of arguments. |
int vsprintf | ( | char * | str, |
const char * | fmt, | ||
va_list | args | ||
) |
Write formatted data from variable argument list to string.
str | Pointer to a buffer where the resulting C-string is stored. |
fmt | Format string, following the same specifications as printf. |
args | A variable arguments list. |