aboutsummaryrefslogtreecommitdiff
path: root/winsup/utils
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2011-05-29 15:20:10 +0000
committerChristopher Faylor <me@cgf.cx>2011-05-29 15:20:10 +0000
commita4fddeb9f6e0915eb8c69968862a5b37a43d48f9 (patch)
tree0b88b593aec47412dbe3930d35411d9497d050bf /winsup/utils
parent6cd2e18523b86befc0ac656b1308a1b3494e985f (diff)
downloadnewlib-a4fddeb9f6e0915eb8c69968862a5b37a43d48f9.zip
newlib-a4fddeb9f6e0915eb8c69968862a5b37a43d48f9.tar.gz
newlib-a4fddeb9f6e0915eb8c69968862a5b37a43d48f9.tar.bz2
* ps.cc (ttynam): Accommodate new console numbering.
(main): Ditto.
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/ChangeLog5
-rw-r--r--winsup/utils/ps.cc19
2 files changed, 16 insertions, 8 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index 797a1ef..dad1353 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-29 Christopher Faylor <me.cygwin2011@cgf.cx>
+
+ * ps.cc (ttynam): Accommodate new console numbering.
+ (main): Ditto.
+
2011-05-03 Corinna Vinschen <corinna@vinschen.de>
* locale.cc (print_locale_with_codeset): Align printing of locale names
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc
index 30152eb..fe8138d 100644
--- a/winsup/utils/ps.cc
+++ b/winsup/utils/ps.cc
@@ -198,12 +198,15 @@ to_time_t (FILETIME *ptr)
static const char *
ttynam (int ntty)
{
- static char buf[5];
+ static char buf[9];
+ char buf0[9];
if (ntty < 0)
- return " ?";
- if (ntty == TTY_CONSOLE)
- return " con";
- sprintf (buf, "%4d", ntty);
+ strcpy (buf0, "?");
+ else if (ntty & 0xffff0000)
+ sprintf (buf0, "cons%d", ntty & 0xff);
+ else
+ sprintf (buf0, "tty%d", ntty);
+ sprintf (buf, " %-7s", buf0);
return buf;
}
@@ -261,11 +264,11 @@ main (int argc, char *argv[])
int aflag, lflag, fflag, sflag, uid, proc_id;
bool found_proc_id = true;
cygwin_getinfo_types query = CW_GETPINFO;
- const char *dtitle = " PID TTY STIME COMMAND\n";
+ const char *dtitle = " PID TTY STIME COMMAND\n";
const char *dfmt = "%7d%4s%10s %s\n";
- const char *ftitle = " UID PID PPID TTY STIME COMMAND\n";
+ const char *ftitle = " UID PID PPID TTY STIME COMMAND\n";
const char *ffmt = "%8.8s%8d%8d%4s%10s %s\n";
- const char *ltitle = " PID PPID PGID WINPID TTY UID STIME COMMAND\n";
+ const char *ltitle = " PID PPID PGID WINPID TTY UID STIME COMMAND\n";
const char *lfmt = "%c %7d %7d %7d %10u %4s %4u %8s %s\n";
char ch;
PUNICODE_STRING uni = NULL;