summaryrefslogtreecommitdiffstats
path: root/contrib/top
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/top')
-rw-r--r--contrib/top/top.X8
-rw-r--r--contrib/top/top.c21
-rw-r--r--contrib/top/top.h5
3 files changed, 28 insertions, 6 deletions
diff --git a/contrib/top/top.X b/contrib/top/top.X
index ff1a1d9..304ee91 100644
--- a/contrib/top/top.X
+++ b/contrib/top/top.X
@@ -10,7 +10,7 @@ top \- display and update information about the top cpu processes
.SH SYNOPSIS
.B top
[
-.B \-bCHIinqStuv
+.B \-abCHIinqStuv
] [
.BI \-d count
] [
@@ -78,6 +78,12 @@ the \*(lqWCPU\*(rq column respectively.
Show system processes in the display. Normally, system processes such as
the pager and the swapper are not shown. This option makes them visible.
.TP
+.B \-a
+Display command names derived from the argv[] vector, rather than real
+executable name. It's useful when you want to watch applications, that
+puts their status information there. If the real name differs from argv[0],
+it will be displayed in parenthesis.
+.TP
.B \-b
Use \*(lqbatch\*(rq mode. In this mode, all input from the terminal is
ignored. Interrupt characters (such as ^C and ^\e) still have an effect.
diff --git a/contrib/top/top.c b/contrib/top/top.c
index 81933e4..970d143 100644
--- a/contrib/top/top.c
+++ b/contrib/top/top.c
@@ -65,6 +65,8 @@ extern char *optarg;
/* imported from screen.c */
extern int overstrike;
+static int fmt_flags = 0;
+
/* signal handling routines */
sigret_t leave();
sigret_t onalrm();
@@ -193,9 +195,9 @@ char *argv[];
fd_set readfds;
#ifdef ORDER
- static char command_chars[] = "\f qh?en#sdkriIutHmSCo";
+ static char command_chars[] = "\f qh?en#sdkriIutHmSCao";
#else
- static char command_chars[] = "\f qh?en#sdkriIutHmSC";
+ static char command_chars[] = "\f qh?en#sdkriIutHmSCa";
#endif
/* these defines enumerate the "strchr"s of the commands in command_chars */
#define CMD_redraw 0
@@ -219,8 +221,9 @@ char *argv[];
#define CMD_viewtog 17
#define CMD_viewsys 18
#define CMD_wcputog 19
+#define CMD_showargs 20
#ifdef ORDER
-#define CMD_order 20
+#define CMD_order 21
#endif
/* set the buffer for stdout */
@@ -277,7 +280,7 @@ char *argv[];
optind = 1;
}
- while ((i = getopt(ac, av, "CSIHbinquvs:d:U:m:o:t")) != EOF)
+ while ((i = getopt(ac, av, "CSIHabinquvs:d:U:m:o:t")) != EOF)
{
switch(i)
{
@@ -316,6 +319,10 @@ char *argv[];
interactive = No;
break;
+ case 'a':
+ fmt_flags ^= FMT_SHOWARGS;
+ break;
+
case 'd': /* number of displays to show */
if ((i = atoiwi(optarg)) == Invalid || i == 0)
{
@@ -651,7 +658,8 @@ restart:
/* now show the top "n" processes. */
for (i = 0; i < active_procs; i++)
{
- (*d_process)(i, format_next_process(processes, get_userid));
+ (*d_process)(i, format_next_process(processes, get_userid,
+ fmt_flags));
}
}
else
@@ -1020,6 +1028,9 @@ restart:
case CMD_viewsys:
ps.system = !ps.system;
break;
+ case CMD_showargs:
+ fmt_flags ^= FMT_SHOWARGS;
+ break;
#ifdef ORDER
case CMD_order:
new_message(MT_standout,
diff --git a/contrib/top/top.h b/contrib/top/top.h
index 59cdeed..2b32d10 100644
--- a/contrib/top/top.h
+++ b/contrib/top/top.h
@@ -39,4 +39,9 @@ char *version_string();
enum displaymodes { DISP_CPU = 0, DISP_IO, DISP_MAX };
+/*
+ * Format modifiers
+ */
+#define FMT_SHOWARGS 0x00000001
+
extern enum displaymodes displaymode;
OpenPOWER on IntegriCloud