xbps-bin: reset some static vars for correct indentation in output.
This commit is contained in:
parent
35aa4b9951
commit
ada7820312
@ -61,6 +61,6 @@ int show_pkg_namedesc(prop_object_t, void *, bool *);
|
|||||||
int list_strings_in_array(prop_object_t, void *, bool *);
|
int list_strings_in_array(prop_object_t, void *, bool *);
|
||||||
int list_strings_sep_in_array(prop_object_t, void *, bool *);
|
int list_strings_sep_in_array(prop_object_t, void *, bool *);
|
||||||
size_t find_longest_pkgver(prop_dictionary_t);
|
size_t find_longest_pkgver(prop_dictionary_t);
|
||||||
void print_package_line(const char *);
|
void print_package_line(const char *, bool);
|
||||||
|
|
||||||
#endif /* !_XBPS_BIN_DEFS_H_ */
|
#endif /* !_XBPS_BIN_DEFS_H_ */
|
||||||
|
@ -183,9 +183,10 @@ show_package_list(prop_object_iterator_t iter, const char *match)
|
|||||||
prop_dictionary_get_cstring_nocopy(obj, "trans-action", &tract);
|
prop_dictionary_get_cstring_nocopy(obj, "trans-action", &tract);
|
||||||
if (strcmp(match, tract))
|
if (strcmp(match, tract))
|
||||||
continue;
|
continue;
|
||||||
print_package_line(pkgver);
|
print_package_line(pkgver, false);
|
||||||
}
|
}
|
||||||
prop_object_iterator_reset(iter);
|
prop_object_iterator_reset(iter);
|
||||||
|
print_package_line(NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -93,7 +93,7 @@ xbps_autoremove_pkgs(bool yes, bool purge)
|
|||||||
"(as dependencies) and aren't needed anymore:\n\n");
|
"(as dependencies) and aren't needed anymore:\n\n");
|
||||||
while ((obj = prop_object_iterator_next(iter)) != NULL) {
|
while ((obj = prop_object_iterator_next(iter)) != NULL) {
|
||||||
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||||
print_package_line(pkgver);
|
print_package_line(pkgver, false);
|
||||||
}
|
}
|
||||||
prop_object_iterator_reset(iter);
|
prop_object_iterator_reset(iter);
|
||||||
printf("\n\n");
|
printf("\n\n");
|
||||||
@ -168,7 +168,7 @@ xbps_remove_installed_pkgs(int argc, char **argv, bool yes, bool purge,
|
|||||||
for (x = 0; x < prop_array_count(sorted_pkgs); x++) {
|
for (x = 0; x < prop_array_count(sorted_pkgs); x++) {
|
||||||
dict = prop_array_get(sorted_pkgs, x);
|
dict = prop_array_get(sorted_pkgs, x);
|
||||||
prop_dictionary_get_cstring_nocopy(dict, "pkgver", &pkgver);
|
prop_dictionary_get_cstring_nocopy(dict, "pkgver", &pkgver);
|
||||||
print_package_line(pkgver);
|
print_package_line(pkgver, false);
|
||||||
}
|
}
|
||||||
printf("\n\n");
|
printf("\n\n");
|
||||||
if (!yes && !xbps_noyes("Do you want to continue?")) {
|
if (!yes && !xbps_noyes("Do you want to continue?")) {
|
||||||
|
@ -247,7 +247,7 @@ list_strings_in_array(prop_object_t obj, void *arg, bool *loop_done)
|
|||||||
(void)loop_done;
|
(void)loop_done;
|
||||||
|
|
||||||
assert(prop_object_type(obj) == PROP_TYPE_STRING);
|
assert(prop_object_type(obj) == PROP_TYPE_STRING);
|
||||||
print_package_line(prop_string_cstring_nocopy(obj));
|
print_package_line(prop_string_cstring_nocopy(obj), false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -266,11 +266,16 @@ list_strings_sep_in_array(prop_object_t obj, void *arg, bool *loop_done)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
print_package_line(const char *str)
|
print_package_line(const char *str, bool reset)
|
||||||
{
|
{
|
||||||
static size_t cols;
|
static size_t cols;
|
||||||
static bool first;
|
static bool first;
|
||||||
|
|
||||||
|
if (reset) {
|
||||||
|
cols = 0;
|
||||||
|
first = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
cols += strlen(str) + 4;
|
cols += strlen(str) + 4;
|
||||||
if (cols <= 80) {
|
if (cols <= 80) {
|
||||||
if (first == false) {
|
if (first == false) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user