dpkg 1.22.7-3-g89f48
|
Data Structures | |
struct | str_crop_info |
Functions | |
bool | str_match_end (const char *str, const char *end) |
Match the end of a string. | |
unsigned int | str_fnv_hash (const char *str) |
Fowler/Noll/Vo – FNV-1a simple string hash. | |
char * | str_concat (char *dst,...) DPKG_ATTR_SENTINEL |
char * | str_fmt (const char *fmt,...) DPKG_ATTR_PRINTF(1) |
Print formatted output to an allocated string. | |
char * | str_escape_fmt (char *dest, const char *src, size_t n) |
Escape format characters from a string. | |
char * | str_quote_meta (const char *src) |
Quote shell metacharacters in a string. | |
char * | str_strip_quotes (char *str) |
Check and strip possible surrounding quotes in string. | |
char * | str_rtrim_spaces (const char *str, char *str_end) |
Trim possible ending spaces in string. | |
int | str_width (const char *str) |
Compute the screen width of a string. | |
void | str_gen_crop (const char *str, int max_width, struct str_crop_info *crop) |
Generate the crop values for a string given a maximum screen width. | |
char * str_concat | ( | char * | dst, |
... | |||
) |
char * str_escape_fmt | ( | char * | dst, |
const char * | src, | ||
size_t | n | ||
) |
Escape format characters from a string.
dst | The destination string. |
src | The source string. |
n | The size of the destination buffer. |
char * str_fmt | ( | const char * | fmt, |
... | |||
) |
Print formatted output to an allocated string.
fmt | The format string. |
... | The format arguments. |
References args, and m_vasprintf().
Referenced by atomic_file_new(), do_auto(), do_build(), do_raw_extract(), do_showinfo(), dpkg_db_get_path(), dpkg_fsys_get_path(), dpkg_options_load(), execbackend(), and path_make_temp_template().
unsigned int str_fnv_hash | ( | const char * | str | ) |
Fowler/Noll/Vo – FNV-1a simple string hash.
For more info,
str | The string to hash. |
References FNV_MIXING_PRIME, and FNV_OFFSET_BASIS.
Referenced by fsys_hash_find_node(), and pkg_hash_find_set().
void str_gen_crop | ( | const char * | str, |
int | max_width, | ||
struct str_crop_info * | crop | ||
) |
Generate the crop values for a string given a maximum screen width.
This function analyzes the string passed and computes the correct point where to crop the string, returning the amount of string and maximum bytes to use for padding for example.
On NLS enabled builds, in addition the string will be cropped on any newline.
str | The string to crop. | |
max_width | The max screen width to use. | |
[out] | crop | The generated crop values for the string. |
References _, str_crop_info::max_bytes, ohshit(), and str_crop_info::str_bytes.
bool str_match_end | ( | const char * | str, |
const char * | end | ||
) |
Match the end of a string.
str | The string. |
end | The end to match in str. |
Referenced by do_split().
char * str_quote_meta | ( | const char * | src | ) |
Quote shell metacharacters in a string.
This function allows passing strings to commands without splitting the arguments, like in system(3)
src | The source string to escape. |
References m_malloc().
char * str_rtrim_spaces | ( | const char * | str, |
char * | str_end | ||
) |
Trim possible ending spaces in string.
str | The string to act on. |
str_end | The end of the string to act on. |
char * str_strip_quotes | ( | char * | str | ) |
Check and strip possible surrounding quotes in string.
str | The string to act on. |
int str_width | ( | const char * | str | ) |
Compute the screen width of a string.
str | The multibyte string. |
References _, m_malloc(), and ohshit().