psmisc/psmisc-22.21-pstree.patch
Dr. Werner Fink fe076b1282 Accepting request 859586 from home:polslinux:branches:Base:System
- Update to 23.3:
  * killall: check also truncated 16 char comm names Debian
  * fuser: Return early if have nulls
  * peekfd: Add support for ARM64
  * pstree: Add color by age
  * fuser: Use larger inode sizes
- Rebase 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
- Rebase 0002-Use-new-statx-2-system-call-to-avoid-hangs-on-NFS.patch
- Rebase psmisc-22.21-pstree.patch

OBS-URL: https://build.opensuse.org/request/show/859586
OBS-URL: https://build.opensuse.org/package/show/Base:System/psmisc?expand=0&rev=125
2021-01-11 08:22:06 +00:00

75 lines
2.3 KiB
Diff

--- src/pstree.c.orig 2019-11-12 11:23:38.000000000 +0100
+++ src/pstree.c 2020-12-31 10:43:59.650348130 +0100
@@ -71,6 +71,7 @@
#define UTF_HD "\342\224\254" /* U+252C, Horizontal and down */
#define VT_BEG "\033(0\017" /* use graphic chars */
+#define VT_LEN 4
#define VT_END "\033(B" /* back to normal char set */
#define VT_V "x" /* see UTF definitions above */
#define VT_VR "t"
@@ -470,6 +471,27 @@
out_string("'");
}
+/*
+ * Only affects vt100 line drawing mode: Do not count the strlen of
+ * VT_BEG to prevent doing end-of-line way too early:
+ */
+static void
+out_sym (const char *str)
+{
+ int seq = 0;
+ if (sym == &sym_vt100 && *str == '\033') {
+ seq = 1;
+ if (cur_x <= output_width || !trunc)
+ cur_x -= VT_LEN;
+ }
+ out_string(str);
+ if (seq) {
+ str = VT_END;
+ while (*str)
+ putchar (*str++);
+ }
+}
+
static void out_newline(void)
{
if (last_char && cur_x == output_width)
@@ -705,11 +727,12 @@
for (lvl = 0; lvl < level; lvl++) {
for (i = width[lvl] + 1; i; i--)
out_char(' ');
- out_string(lvl ==
- level -
- 1 ? last ? sym->last_2 : sym->branch_2 : more[lvl +
- 1] ?
- sym->vert_2 : sym->empty_2);
+ /*
+ * Replace all three symbol-drawing calls with calls to out_sym()
+ * to handle VT100 line drawing sequences if VT100 mode is active:
+ */
+ out_sym(lvl == level - 1 ? last ? sym->last_2 : sym->branch_2 :
+ more[lvl + 1] ? sym->vert_2 : sym->empty_2);
}
if (rep < 2)
@@ -819,7 +842,7 @@
}
width[level] = comm_len + cur_x - offset + add;
if (cur_x >= output_width && trunc) {
- out_string(sym->first_3);
+ out_sym(sym->first_3);
out_string("+");
out_newline();
return;
@@ -843,7 +866,7 @@
}
}
if (first) {
- out_string(next ? sym->first_3 : sym->single_3);
+ out_sym(next ? sym->first_3 : sym->single_3);
first = 0;
}
dump_tree(walk->child, level + 1, count + 1,