|
#define | ulongcat(s, slen, number, width, fillchar) |
| unsigned long to decimal string
|
|
#define | longcat(s, slen, number, width, fillchar) |
| signed long to decimal string
|
|
#define | ulonghexcat(s, slen, number, width, fillchar, upper) |
| unsigned long to hexadecimal string
|
|
|
static int | is_safe_in_shell (unsigned char c) |
|
long | strtolx (char *, char **) |
|
static unsigned char | hx (int a) |
| Convert a decimal number to hexadecimal (lowercase) (0 <= a <= 15).
|
|
static unsigned char | Hx (int a) |
| Convert a decimal number to hexadecimal (uppercase) (0 <= a <= 15).
|
|
static int | unhx (unsigned char a) |
| Convert an hexadecimal char ([0-9][a-z][A-Z]) to its decimal value (0 <= result <= 15).
|
|
struct string * | add_long_to_string (struct string *string, long long number) |
|
struct string * | add_knum_to_string (struct string *string, long long number) |
|
struct string * | add_xnum_to_string (struct string *string, long long number) |
|
struct string * | add_duration_to_string (struct string *string, long seconds) |
|
struct string * | add_timeval_to_string (struct string *string, timeval_T *timeval) |
|
int | elinks_ulongcat (char *s, unsigned int *slen, unsigned long long number, unsigned int width, unsigned char fillchar, unsigned int base, unsigned int upper) |
| This function takes string s and stores the number (of a result width width) in string format there, starting at position [*slen].
|
|
int | elinks_longcat (char *s, unsigned int *slen, long long number, unsigned int width, unsigned char fillchar, unsigned int base, unsigned int upper) |
| Similar to elinks_ulongcat() but for long number.
|
|
int | month2num (const char *month) |
| Return 0 if starting with jan, 11 for dec, -1 for failure.
|
|
static char * | trim_chars (char *s, unsigned char c, int *len) |
| Trim starting and ending chars equal to c in string s.
|
|
int | c_tolower (int c) |
|
int | c_toupper (int c) |
|
int | c_islower (int c) |
|
int | c_isupper (int c) |
|
static void | convert_to_lowercase (char *string, int length) |
| Convert uppercase letters in string with the given length to lowercase.
|
|
static void | convert_to_lowercase_locale_indep (char *string, int length) |
|
void | clr_spaces (char *str) |
| This function drops control chars, nbsp char and limit the number of consecutive space chars to one.
|
|
void | sanitize_title (char *title) |
| Replace invalid chars in title with ' ' and trim all starting/ending spaces.
|
|
int | sanitize_url (char *url) |
| Returns 0 if url contains invalid chars, 1 if ok.
|
|
int elinks_ulongcat |
( |
char * | s, |
|
|
unsigned int * | slen, |
|
|
unsigned long long | number, |
|
|
unsigned int | width, |
|
|
unsigned char | fillchar, |
|
|
unsigned int | base, |
|
|
unsigned int | upper ) |
This function takes string s and stores the number (of a result width width) in string format there, starting at position [*slen].
If the number would take more space than width, it is truncated and only the last digits of it are inserted to the string. If the number takes less space than width, it is padded by fillchar from left. base defined which base should be used (10, 16, 8, 2, ...) upper selects either hexa uppercased chars or lowercased chars.
A NUL char is always added at the end of the string. s must point to a sufficiently large memory space, at least *slen + width + 1.
Examples:
NONSTATIC_INLINE int elinks_ulongcat(char *s, unsigned int *slen, unsigned long long number, unsigned int width, unsigned char fillchar, unsigned int base, unsigned int upper)
This function takes string s and stores the number (of a result width width) in string format there,...
Definition conv.c:52
#define NULL
Definition explodename.c:35
Note that this function exists to provide a fast and efficient, however still quite powerful alternative to sprintf(). It is optimized for speed and is MUCH faster than sprintf(). If you can use it, use it ;-). But do not get too enthusiastic, do not use it in cases where it would break i18n.
- Returns
- 0 if OK or width needed for the whole number to fit there, if it had to be truncated. A negative value signs an error.