File procps-ng-3.3.9-w-notruncate.diff of Package procps

---
 procps-ng-4.0.6/man/w.1 |    3 +++
 procps-ng-4.0.6/src/w.c |   27 +++++++++++++++++++++++----
 2 files changed, 26 insertions(+), 4 deletions(-)

--- procps-ng-4.0.6/man/w.1
+++ procps-ng-4.0.6/man/w.1	2026-01-30 11:53:44.594410770 +0000
@@ -55,6 +55,9 @@ and a
 \fB\-s\fR, \fB\-\-short\fR
 Use the short format.  Don't print the login time, JCPU or PCPU times.
 .TP
+\fB\-n\fR, \fB\-\-no\-truncat\fR
+Do not truncate the output format. This option might become renamed in future versions.
+.TP
 \fB\-t\fR, \fB\-\-terminal\fR
 Usually
 .B w
--- procps-ng-4.0.6/src/w.c
+++ procps-ng-4.0.6/src/w.c	2026-01-30 11:55:02.308987512 +0000
@@ -225,7 +225,8 @@ static void print_from(
 	    if (r < 0 || host == NULL)
 	        print_host("", 0, fromlen);
 	    else {
-	        print_host(host, strlen(host), fromlen);
+	        print_host(host, strlen(host),
+			   fromlen == 0?strlen(host):fromlen);
 		free(host);
 	    }
 	} else {
@@ -636,7 +637,7 @@ static void get_session_tty(
 static void showinfo(
             const char *session, const char *name,
             utmp_t * u, const int longform, int maxcmd, int from,
-            const int userlen, const int fromlen, const int ip_addresses,
+            int userlen, int fromlen, const int ip_addresses,
             const int pids,
             struct pids_fetch *reap)
 {
@@ -646,6 +647,7 @@ static void showinfo(
     char cmdline[MAX_CMD_WIDTH + 1];
     pid_t best_pid = -1;
     int pids_length = 0;
+    int utlnlen = 8;
 
     strcpy(cmdline, "-");
 
@@ -671,7 +673,18 @@ static void showinfo(
     /* force NUL term for printf */
     uname[UT_NAMESIZE] = '\0';
 
-    printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, tty);
+    if (longform > 1) {
+        userlen = strlen(uname);
+        if (u) {
+            fromlen = strnlen(u->ut_host, UT_HOSTSIZE);
+            utlnlen = strnlen(u->ut_line, UT_LINESIZE);
+        } else {
+            fromlen = 0;
+            utlnlen = strlen (tty+5);
+        }
+        maxcmd = MAX_CMD_WIDTH;
+    }
+    printf("%-*.*s%-*.*s", userlen + 1, userlen, uname, utlnlen + 1, utlnlen, tty+5);
     if (from)
         print_from(session, u, ip_addresses, fromlen);
 
@@ -745,6 +758,7 @@ static void __attribute__ ((__noreturn__
 	fputs(_(" -h, --no-header     do not print header\n"),out);
 	fputs(_(" -u, --no-current    ignore current process username\n"),out);
 	fputs(_(" -s, --short         short format\n"),out);
+	fputs(_(" -n, --no-truncat    non truncated listing (large)\n"),out);
 	fputs(_(" -t, --terminal      show terminals\n"),out);
 	fprintf(out,
 	      _(" -f, --from          toggle remote hostname field (default: %s)\n"),
@@ -1016,6 +1030,7 @@ int main(int argc, char **argv)
 		{"no-header", no_argument, NULL, 'h'},
 		{"no-current", no_argument, NULL, 'u'},
 		{"short", no_argument, NULL, 's'},
+		{"no-truncat", no_argument, NULL, 'n'},
 		{"terminal", no_argument, NULL, 't'},
 		{"from", no_argument, NULL, 'f'},
 		{"old-style", no_argument, NULL, 'o'},
@@ -1039,7 +1054,7 @@ int main(int argc, char **argv)
 #endif
 
 	while ((ch =
-		getopt_long(argc, argv, "chustfoVip", longopts, NULL)) != -1)
+		getopt_long(argc, argv, "chusntfoVip", longopts, NULL)) != -1)
 		switch (ch) {
                 case 'c':
                         container = 1;
@@ -1050,6 +1065,10 @@ int main(int argc, char **argv)
 		case 's':
 			longform = 0;
 			break;
+		case 'n':
+			longform = 2;
+			header = 0;
+			break;
                 case 't':
                         term_mode = true;
                         break;
openSUSE Build Service is sponsored by