summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wong <markwkm@gmail.com>2007-11-24 16:45:46 -0800
committerMark Wong <markwkm@gmail.com>2007-11-24 16:45:46 -0800
commitf82695a2d648a0e3eff28b327b5c93526f0ebcfc (patch)
tree095cf534880dfc4f0bcae1c8ceeb5a9edfe858ae
parent7a6a5f6f18950b53a2471bc7d527ee065e6fd50d (diff)
parent1a526cdaddcf71fa65a1b7d22efb9f00301847a9 (diff)
Merged documentation changes from Gab.v3.6.1-beta2
-rw-r--r--ptop.c37
-rw-r--r--ptop.h4
2 files changed, 10 insertions, 31 deletions
diff --git a/ptop.c b/ptop.c
index 511de62..b994b98 100644
--- a/ptop.c
+++ b/ptop.c
@@ -252,7 +252,7 @@ main(int argc, char *argv[])
#ifdef BSD_SIGNALS
int old_sigmask; /* only used for BSD-style signals */
#endif /* BSD_SIGNALS */
- int topn = Default_TOPN;
+ int topn = 0;
int delay = Default_DELAY;
int displays = 0; /* indicates unspecified */
time_t curr_time;
@@ -269,9 +269,6 @@ main(int argc, char *argv[])
char interactive = Maybe;
char show_tags = No;
-#if Default_TOPN == Infinity
- char topn_specified = No;
-#endif
char ch;
char *iptr;
char no_command = 1;
@@ -544,9 +541,6 @@ Usage: %s [-ISTWbcinqu] [-d x] [-s x] [-o field] [-U username]\n\
}
else
{
-#if Default_TOPN == Infinity
- topn_specified = Yes;
-#endif
topn = i;
}
}
@@ -654,6 +648,15 @@ Usage: %s [-ISTWbcinqu] [-d x] [-s x] [-o field] [-U username]\n\
exit(0);
}
+ /*
+ * Set topn based on the current screensize when starting up if it was
+ * not specified on the command line.
+ */
+ if (topn == 0) {
+ get_screensize();
+ topn = display_resize();
+ }
+
/* print warning if user requested more processes than we can display */
if (topn > max_topn)
{
@@ -662,26 +665,6 @@ Usage: %s [-ISTWbcinqu] [-d x] [-s x] [-o field] [-U username]\n\
max_topn);
}
- /* adjust for topn == Infinity */
- if (topn == Infinity)
- {
- /*
- * For smart terminals, infinity really means everything that can be
- * displayed, or Largest. On dumb terminals, infinity means every
- * process in the system! We only really want to do that if it was
- * explicitly specified. This is always the case when "Default_TOPN !=
- * Infinity". But if topn wasn't explicitly specified and we are on a
- * dumb terminal and the default is Infinity, then (and only then) we
- * use "Nominal_TOPN" instead.
- */
-#if Default_TOPN == Infinity
- topn = smart_terminal ? Largest :
- (topn_specified ? Largest : Nominal_TOPN);
-#else
- topn = Largest;
-#endif
- }
-
/* set header display accordingly */
display_header(topn > 0);
diff --git a/ptop.h b/ptop.h
index 940d9f7..1c7cb2a 100644
--- a/ptop.h
+++ b/ptop.h
@@ -57,10 +57,6 @@ struct ext_decl
#define Nominal_TOPN 40
#endif
-#ifndef Default_TOPN
-#define Default_TOPN 15
-#endif
-
#ifndef Default_DELAY
#define Default_DELAY 5
#endif