diff options
Diffstat (limited to 'patches/procps-3.2.8/20_w-bassman.dpatch')
-rw-r--r-- | patches/procps-3.2.8/20_w-bassman.dpatch | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/patches/procps-3.2.8/20_w-bassman.dpatch b/patches/procps-3.2.8/20_w-bassman.dpatch new file mode 100644 index 000000000..cc68ab72a --- /dev/null +++ b/patches/procps-3.2.8/20_w-bassman.dpatch @@ -0,0 +1,91 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 20_w-bassman.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: w-bassman emulation with -o flag +## DP: Was from #45947, corrected for #414906 + +@DPATCH@ +diff -urNad procps-3.2.7~/w.1 procps-3.2.7/w.1 +--- procps-3.2.7~/w.1 2009-01-09 16:24:17.000000000 +1100 ++++ procps-3.2.7/w.1 2009-01-09 16:24:55.000000000 +1100 +@@ -5,7 +5,7 @@ + w \- Show who is logged on and what they are doing. + .SH SYNOPSIS + .B w \- +-.RB [ husfV ] ++.RB [ husfVo ] + .RI [ user ] + .SH DESCRIPTION + .B "w " +@@ -55,6 +55,9 @@ + .B "\-V " + Display version information. + .TP 0.5i ++.B "\-o " ++Old style output. Prints blank space for idle times less than one minute. ++.TP 0.5i + .B "user " + Show information about the specified user only. + +diff -urNad procps-3.2.7~/w.c procps-3.2.7/w.c +--- procps-3.2.7~/w.c 2009-01-09 16:24:54.000000000 +1100 ++++ procps-3.2.7/w.c 2009-01-09 16:25:39.000000000 +1100 +@@ -30,6 +30,7 @@ + #include <termios.h> + + static int ignoreuser = 0; /* for '-u' */ ++static int oldstyle = 0; /* for '-o' */ + static proc_t **procs; /* our snapshot of the process table */ + + typedef struct utmp utmp_t; +@@ -76,6 +77,16 @@ + printf(" ? "); + return; + } ++ if (oldstyle) { ++ if (t >= 48*60*60) /* > 2 days */ ++ fprintf(fout, " %2ludays", t/(24*60*60)); ++ else if (t >= 60*60) /* > 1 hour */ ++ fprintf(fout, " %2lu:%02u ", t/(60*60), (unsigned) ((t/60)%60)); ++ else if (t > 60) /* > 1 minute */ ++ fprintf(fout, " %2lu:%02um", t/60, (unsigned) t%60); ++ else ++ fprintf(fout, " "); ++ } else { + if (t >= 48*60*60) /* > 2 days */ + fprintf(fout, " %2ludays", t/(24*60*60)); + else if (t >= 60*60) /* > 1 hour */ +@@ -84,6 +95,7 @@ + fprintf(fout, " %2lu:%02u ", t/60, (unsigned) t%60); + else + fprintf(fout, " %2lu.%02us", t, centi_sec); ++ } + } + + /**** stat the device file to get an idle time */ +@@ -239,7 +251,7 @@ + #endif + + setlocale(LC_ALL, ""); +- for (args=0; (ch = getopt(argc, argv, "hlusfV")) != EOF; args++) ++ for (args=0; (ch = getopt(argc, argv, "hlusfVo")) != EOF; args++) + switch (ch) { + case 'h': header = 0; break; + case 'l': longform = 1; break; +@@ -247,6 +259,7 @@ + case 'f': from = !from; break; + case 'V': display_version(); exit(0); + case 'u': ignoreuser = 1; break; ++ case 'o': oldstyle = 1; break; + default: + printf("usage: w -hlsufV [user]\n" + " -h skip header\n" +@@ -254,6 +267,7 @@ + " -s short listing\n" + " -u ignore uid of processes\n" + " -f toggle FROM field (default %s)\n" ++ " -o old-style output\n" + " -V display version\n", FROM_STRING); + exit(1); + } |