diff --git a/NEWS b/NEWS index ae81cc23..6a401b53 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ procps-3.1.5 --> procps-3.1.6 +watch: new --no-title option handle SPARC Linux badness rare crash fixed compile with gcc 2.91.xx again diff --git a/proc/library.map b/proc/library.map index 50347855..dfca5cec 100644 --- a/proc/library.map +++ b/proc/library.map @@ -1,5 +1,7 @@ _3_1_5 { global: + __cyg_profile_func_enter; __cyg_profile_func_exit; main; + readproc; readproctab; ps_readproc; look_up_our_self; escape_command; escape_str; escape_strlist; openproc; closeproc; diff --git a/proc/version.c b/proc/version.c index c9b9b798..69bae4f5 100644 --- a/proc/version.c +++ b/proc/version.c @@ -2,7 +2,7 @@ * Copyright (c) 1995 Martin Schulze * Ammended by cblake to only export the function symbol. * - * Modified by Albert Cahalan + * Modified by Albert Cahalan, ????-2003 * * Redistributable under the terms of the * GNU Library General Public License; see COPYING @@ -31,14 +31,13 @@ void display_version(void) { #define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z) -int linux_version_code = 0; +int linux_version_code; static void init_Linux_version(void) __attribute__((constructor)); static void init_Linux_version(void) { static struct utsname uts; int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */ - if (linux_version_code) return; if (uname(&uts) == -1) /* failure implies impending death */ exit(1); if (sscanf(uts.release, "%d.%d.%d", &x, &y, &z) < 3) diff --git a/watch.1 b/watch.1 index f6021a6d..41323f45 100644 --- a/watch.1 +++ b/watch.1 @@ -3,7 +3,7 @@ watch \- execute a program periodically, showing output fullscreen .SH SYNOPSIS .B watch -.I [\-dhv] [\-n ] [\-\-differences[=cumulative]] [\-\-help] [\-\-interval=] [\-\-version] +.I [\-dhvt] [\-n ] [\-\-differences[=cumulative]] [\-\-help] [\-\-interval=] [\-\-no\-title] [\-\-version] .SH DESCRIPTION .BR watch runs @@ -23,7 +23,12 @@ or flag will highlight the differences between successive updates. The .I --cumulative option makes highlighting "sticky", presenting a running display of all -positions that have ever changed. +positions that have ever changed. The +.I -t +or +.I --no-title +option turns off the header showing the interval, command, and current +time at the top of the display, as well as the following blank line. .PP .BR watch will run until interrupted. diff --git a/watch.c b/watch.c index 9e20cdfc..91b60ed9 100644 --- a/watch.c +++ b/watch.c @@ -29,12 +29,13 @@ static struct option longopts[] = { {"differences", optional_argument, 0, 'd'}, {"help", no_argument, 0, 'h'}, {"interval", required_argument, 0, 'n'}, + {"no-title", no_argument, 0, 't'}, {"version", no_argument, 0, 'v'}, {0, 0, 0, 0} }; static char usage[] = - "Usage: %s [-dhnv] [--differences[=cumulative]] [--help] [--interval=] [--version] \n"; + "Usage: %s [-dhntv] [--differences[=cumulative]] [--help] [--interval=] [--no-title] [--version] \n"; static char *progname; @@ -42,6 +43,7 @@ static int curses_started = 0; static int height = 24, width = 80; static int screen_size_changed = 0; static int first_screen = 1; +static int show_title = 2; // number of lines used, 2 or 0 #define min(x,y) ((x) > (y) ? (y) : (x)) @@ -101,7 +103,7 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); progname = argv[0]; - while ((optc = getopt_long(argc, argv, "+d::hn:v", longopts, (int *) 0)) + while ((optc = getopt_long(argc, argv, "+d::hn:vt", longopts, (int *) 0)) != EOF) { switch (optc) { case 'd': @@ -112,6 +114,9 @@ main(int argc, char *argv[]) case 'h': option_help = 1; break; + case 't': + show_title = 0; + break; case 'n': { char *str; @@ -201,22 +206,24 @@ main(int argc, char *argv[]) first_screen = 1; } - /* left justify interval and command, right justify time, clipping all - to fit window width */ - asprintf(&header, "Every %ds: %.*s", - interval, min(width - 1, command_length), command); - mvaddstr(0, 0, header); - if (strlen(header) > (size_t) (width - tsl - 1)) - mvaddstr(0, width - tsl - 4, "... "); - mvaddstr(0, width - tsl + 1, ts); - free(header); + if (show_title) { + // left justify interval and command, + // right justify time, clipping all to fit window width + asprintf(&header, "Every %ds: %.*s", + interval, min(width - 1, command_length), command); + mvaddstr(0, 0, header); + if (strlen(header) > (size_t) (width - tsl - 1)) + mvaddstr(0, width - tsl - 4, "... "); + mvaddstr(0, width - tsl + 1, ts); + free(header); + } if (!(p = popen(command, "r"))) { perror("popen"); do_exit(2); } - for (y = 2; y < height; y++) { + for (y = show_title; y < height; y++) { int eolseen = 0, tabpending = 0; for (x = 0; x < width; x++) { int c = ' ';