libalpm
Arch Linux Package Manager Library
|
Go to the source code of this file.
Data Structures | |
struct | _pm_target_t |
Defines | |
#define | _(str) str |
#define | _n(str1, str2, ct) (ct == 1 ? str1 : str2) |
Typedefs | |
typedef struct _pm_target_t | pm_target_t |
Functions | |
void | trans_init_error (void) |
int | trans_init (alpm_transflag_t flags, int check_valid) |
int | trans_release (void) |
int | needs_root (void) |
int | check_syncdbs (size_t need_repos, int check_valid) |
unsigned short | getcols (void) |
int | rmrf (const char *path) |
const char * | mbasename (const char *path) |
Parse the basename of a program from a path. | |
char * | mdirname (const char *path) |
Parse the dirname of a program from a path. | |
void | indentprint (const char *str, size_t indent) |
char * | strtoupper (char *str) |
size_t | strtrim (char *str) |
char * | strreplace (const char *str, const char *needle, const char *replace) |
alpm_list_t * | strsplit (const char *str, const char splitchar) |
Splits a string into a list of strings using the chosen character as a delimiter. | |
void | string_display (const char *title, const char *string) |
double | humanize_size (off_t bytes, const char target_unit, const char **label) |
Converts sizes in bytes into human readable units. | |
int | table_display (const char *title, const alpm_list_t *header, const alpm_list_t *rows) |
Displays the list in table format. | |
void | list_display (const char *title, const alpm_list_t *list) |
void | list_display_linebreak (const char *title, const alpm_list_t *list) |
void | signature_display (const char *title, alpm_siglist_t *siglist) |
void | display_targets (void) |
int | str_cmp (const void *s1, const void *s2) |
void | display_new_optdepends (alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg) |
void | display_optdepends (alpm_pkg_t *pkg) |
void | print_packages (const alpm_list_t *packages) |
void | select_display (const alpm_list_t *pkglist) |
int | select_question (int count) |
int | multiselect_question (char *array, int count) |
int | yesno (char *fmt,...) |
int | noyes (char *fmt,...) |
int | pm_printf (alpm_loglevel_t level, const char *format,...) __attribute__((format(printf |
int int | pm_asprintf (char **string, const char *format,...) |
int | pm_vfprintf (FILE *stream, alpm_loglevel_t level, const char *format, va_list args) __attribute__((format(printf |
int int | pm_vasprintf (char **string, alpm_loglevel_t level, const char *format, va_list args) __attribute__((format(printf |
int int char * | strndup (const char *s, size_t n) |
Copies a string. |
#define _ | ( | str | ) | str |
Definition at line 35 of file src/pacman/util.h.
#define _n | ( | str1, | |
str2, | |||
ct | |||
) | (ct == 1 ? str1 : str2) |
Definition at line 36 of file src/pacman/util.h.
Referenced by cb_question().
typedef struct _pm_target_t pm_target_t |
int check_syncdbs | ( | size_t | need_repos, |
int | check_valid | ||
) |
Definition at line 103 of file src/pacman/util.c.
References _, alpm_db_get_name(), alpm_db_get_valid(), alpm_errno(), alpm_list_next(), ALPM_LOG_ERROR, alpm_option_get_syncdbs(), alpm_strerror(), config, __alpm_list_t::data, __config_t::handle, and pm_printf().
Referenced by main(), pacman_query(), pacman_sync(), and trans_init().
void display_new_optdepends | ( | alpm_pkg_t * | oldpkg, |
alpm_pkg_t * | newpkg | ||
) |
Definition at line 1147 of file src/pacman/util.c.
References _, alpm_list_diff(), alpm_list_free(), alpm_pkg_get_name(), alpm_pkg_get_optdepends(), list_display_linebreak(), and str_cmp().
Referenced by cb_event().
void display_optdepends | ( | alpm_pkg_t * | pkg | ) |
Definition at line 1159 of file src/pacman/util.c.
References _, alpm_pkg_get_name(), alpm_pkg_get_optdepends(), and list_display_linebreak().
Referenced by cb_event().
void display_targets | ( | void | ) |
Definition at line 986 of file src/pacman/util.c.
References alpm_db_get_pkg(), alpm_list_add(), alpm_list_count(), alpm_list_find(), alpm_list_msort(), alpm_list_next(), alpm_option_get_localdb(), alpm_pkg_get_name(), alpm_trans_get_add(), alpm_trans_get_remove(), config, __alpm_list_t::data, __config_t::explicit_adds, __config_t::explicit_removes, FREELIST, __config_t::handle, _pm_target_t::install, _pm_target_t::is_explicit, _pm_target_t::remove, and __config_t::verbosepkglists.
Referenced by pacman_remove(), and sync_prepare_execute().
unsigned short getcols | ( | void | ) |
Definition at line 141 of file src/pacman/util.c.
Referenced by cb_dl_progress(), cb_progress(), indentprint(), list_display(), and table_display().
double humanize_size | ( | off_t | bytes, |
const char | target_unit, | ||
const char ** | label | ||
) |
Converts sizes in bytes into human readable units.
bytes | the size in bytes |
target_unit | '\0' or a short label. If equal to one of the short unit labels ('B', 'K', ...) bytes is converted to target_unit; if '\0', the first unit which will bring the value to below a threshold of 2048 will be chosen. |
long_labels | whether to use short ("K") or long ("KiB") unit labels |
label | will be set to the appropriate unit label |
Definition at line 1061 of file src/pacman/util.c.
Referenced by cb_dl_progress(), and dump_pkg_full().
void indentprint | ( | const char * | str, |
size_t | indent | ||
) |
Definition at line 253 of file src/pacman/util.c.
References getcols().
Referenced by list_display_linebreak(), signature_display(), and string_display().
void list_display | ( | const char * | title, |
const alpm_list_t * | list | ||
) |
Definition at line 656 of file src/pacman/util.c.
References _, alpm_list_next(), __alpm_list_t::data, and getcols().
Referenced by cb_question(), dump_pkg_full(), main(), and pacman_sync().
void list_display_linebreak | ( | const char * | title, |
const alpm_list_t * | list | ||
) |
Definition at line 697 of file src/pacman/util.c.
References _, alpm_list_next(), __alpm_list_t::data, and indentprint().
Referenced by display_new_optdepends(), display_optdepends(), and dump_pkg_full().
const char* mbasename | ( | const char * | path | ) |
Parse the basename of a program from a path.
path | path to parse basename from |
Definition at line 214 of file src/pacman/util.c.
char* mdirname | ( | const char * | path | ) |
Parse the dirname of a program from a path.
The path returned should be freed.
path | path to parse dirname from |
Definition at line 229 of file src/pacman/util.c.
int multiselect_question | ( | char * | array, |
int | count | ||
) |
Definition at line 1279 of file src/pacman/util.c.
References _, config, __config_t::noconfirm, and strtrim().
int needs_root | ( | void | ) |
Definition at line 86 of file src/pacman/util.c.
References config, __config_t::group, __config_t::op, __config_t::op_q_list, __config_t::op_s_clean, __config_t::op_s_info, __config_t::op_s_search, __config_t::op_s_sync, PM_OP_DATABASE, PM_OP_REMOVE, PM_OP_SYNC, PM_OP_UPGRADE, and __config_t::print.
Referenced by main().
int noyes | ( | char * | fmt, |
... | |||
) |
Definition at line 1454 of file src/pacman/util.c.
Referenced by cb_question(), and pacman_remove().
int int pm_asprintf | ( | char ** | string, |
const char * | format, | ||
... | |||
) |
Definition at line 1479 of file src/pacman/util.c.
References _, ALPM_LOG_ERROR, and pm_printf().
Referenced by pm_vasprintf(), print_packages(), select_display(), and signature_display().
int pm_printf | ( | alpm_loglevel_t | level, |
const char * | format, | ||
... | |||
) |
int int pm_vasprintf | ( | char ** | string, |
alpm_loglevel_t | level, | ||
const char * | format, | ||
va_list | args | ||
) |
int pm_vfprintf | ( | FILE * | stream, |
alpm_loglevel_t | level, | ||
const char * | format, | ||
va_list | args | ||
) |
void print_packages | ( | const alpm_list_t * | packages | ) |
Definition at line 1086 of file src/pacman/util.c.
References alpm_db_get_name(), alpm_list_next(), alpm_pkg_get_db(), alpm_pkg_get_name(), alpm_pkg_get_version(), config, __alpm_list_t::data, pm_asprintf(), __config_t::print_format, and strreplace().
Referenced by pacman_remove(), and sync_prepare_execute().
int rmrf | ( | const char * | path | ) |
Definition at line 166 of file src/pacman/util.c.
References rmrf().
Referenced by rmrf().
void select_display | ( | const alpm_list_t * | pkglist | ) |
Definition at line 1177 of file src/pacman/util.c.
References alpm_db_get_name(), alpm_list_add(), alpm_pkg_get_db(), alpm_pkg_get_name(), __alpm_list_t::data, FREELIST, __alpm_list_t::next, and pm_asprintf().
Referenced by cb_question().
int select_question | ( | int | count | ) |
Definition at line 1353 of file src/pacman/util.c.
References _, config, __config_t::noconfirm, and strtrim().
Referenced by cb_question().
void signature_display | ( | const char * | title, |
alpm_siglist_t * | siglist | ||
) |
Definition at line 725 of file src/pacman/util.c.
References _, ALPM_LOG_ERROR, ALPM_SIGSTATUS_INVALID, ALPM_SIGSTATUS_KEY_DISABLED, ALPM_SIGSTATUS_KEY_EXPIRED, ALPM_SIGSTATUS_KEY_UNKNOWN, ALPM_SIGSTATUS_SIG_EXPIRED, ALPM_SIGSTATUS_VALID, ALPM_SIGVALIDITY_FULL, ALPM_SIGVALIDITY_MARGINAL, ALPM_SIGVALIDITY_NEVER, ALPM_SIGVALIDITY_UNKNOWN, _alpm_siglist_t::count, _alpm_pgpkey_t::fingerprint, indentprint(), _alpm_sigresult_t::key, pm_asprintf(), pm_printf(), _alpm_siglist_t::results, _alpm_sigresult_t::status, _alpm_pgpkey_t::uid, and _alpm_sigresult_t::validity.
Referenced by dump_pkg_full().
int str_cmp | ( | const void * | s1, |
const void * | s2 | ||
) |
Definition at line 1142 of file src/pacman/util.c.
Referenced by display_new_optdepends().
void string_display | ( | const char * | title, |
const char * | string | ||
) |
Definition at line 473 of file src/pacman/util.c.
References _, and indentprint().
Referenced by dump_pkg_full().
int int char* strndup | ( | const char * | s, |
size_t | n | ||
) |
Copies a string.
Returned string needs to be freed
s | string to be copied |
n | maximum number of characters to copy |
Definition at line 1307 of file lib/libalpm/util.c.
Referenced by strsplit().
char* strreplace | ( | const char * | str, |
const char * | needle, | ||
const char * | replace | ||
) |
Definition at line 365 of file src/pacman/util.c.
References alpm_list_add(), alpm_list_count(), alpm_list_free(), alpm_list_next(), and __alpm_list_t::data.
Referenced by print_packages().
alpm_list_t* strsplit | ( | const char * | str, |
const char | splitchar | ||
) |
Splits a string into a list of strings using the chosen character as a delimiter.
str | the string to split |
splitchar | the character to split at |
Definition at line 429 of file src/pacman/util.c.
References alpm_list_add(), and strndup().
char* strtoupper | ( | char * | str | ) |
Definition at line 315 of file src/pacman/util.c.
size_t strtrim | ( | char * | str | ) |
Definition at line 328 of file src/pacman/util.c.
Referenced by multiselect_question(), and select_question().
int table_display | ( | const char * | title, |
const alpm_list_t * | header, | ||
const alpm_list_t * | rows | ||
) |
Displays the list in table format.
title | the tables title |
header | the column headers. column count is determined by the nr of headers |
rows | the rows to display as a list of lists of strings. the outer list represents the rows, the inner list the cells (= columns) |
Definition at line 615 of file src/pacman/util.c.
References _, alpm_list_count(), alpm_list_next(), ALPM_LOG_WARNING, __alpm_list_t::data, getcols(), and pm_printf().
int trans_init | ( | alpm_transflag_t | flags, |
int | check_valid | ||
) |
Definition at line 50 of file src/pacman/util.c.
References alpm_trans_init(), check_syncdbs(), config, __config_t::handle, and trans_init_error().
Referenced by pacman_database(), pacman_remove(), pacman_sync(), and pacman_upgrade().
void trans_init_error | ( | void | ) |
Definition at line 64 of file src/pacman/util.c.
References _, ALPM_ERR_HANDLE_LOCK, alpm_errno(), ALPM_LOG_ERROR, alpm_option_get_lockfile(), alpm_strerror(), config, __config_t::handle, and pm_printf().
Referenced by trans_init().
int trans_release | ( | void | ) |
Definition at line 76 of file src/pacman/util.c.
References _, alpm_errno(), ALPM_LOG_ERROR, alpm_strerror(), alpm_trans_release(), config, __config_t::handle, and pm_printf().
Referenced by pacman_database(), pacman_remove(), pacman_sync(), pacman_upgrade(), and sync_prepare_execute().
int yesno | ( | char * | fmt, |
... | |||
) |
Definition at line 1442 of file src/pacman/util.c.
Referenced by cb_question(), pacman_remove(), pacman_sync(), and sync_prepare_execute().