From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3/2) with ESMTP id CAA23310 for ; Wed, 12 Jun 1996 02:08:25 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id LAA15931; Tue, 11 Jun 1996 11:57:10 -0400 (EDT) Resent-Date: Tue, 11 Jun 1996 11:57:10 -0400 (EDT) Sender: hniksic@public.srce.hr To: zsh-workers@math.gatech.edu (ZSH Workers Mailing List) Subject: A simpler watch log From: Hrvoje Niksic Date: 11 Jun 1996 17:55:32 +0200 Message-ID: X-Mailer: Gnus v5.2.14/XEmacs 19.13 Resent-Message-ID: <"NQ9EB1.0.ru3.HTPln"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1333 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu A friend of mine (joe@fly.cc.fer.hr) has suggested that the log command should accept a parameter to tell it to print the log in a simple format, like the 'users' command. I have implemented a '-u' option to the log builtin which makes it print only the username on each line. It adds an argument to the dowatch(), which, if set, means "simple" watch, which in turns sets the fmt to "%n". This is not completely compatible with 'users' output, since each username is on a separate line. A little more tweaking by someone who knows more about watch.c could result in dowatch() not calling watchlog() at all, if simple is set. Here is the patch: *** watch.c.orig Tue Jun 11 17:46:28 1996 --- watch.c Tue Jun 11 17:18:37 1996 *************** *** 374,380 **** /**/ void ! dowatch(void) { FILE *in; STRUCT_UTMP *utab, *uptr, *wptr; --- 374,380 ---- /**/ void ! dowatch(int simple_format) { FILE *in; STRUCT_UTMP *utab, *uptr, *wptr; *************** *** 385,391 **** int uct, wct; s = watch; ! if (!(fmt = getsparam("WATCHFMT"))) fmt = DEFAULT_WATCHFMT; holdintr(); --- 385,393 ---- int uct, wct; s = watch; ! if (simple_format) ! fmt = SIMPLE_WATCHFMT; ! else if (!(fmt = getsparam("WATCHFMT"))) fmt = DEFAULT_WATCHFMT; holdintr(); *************** *** 460,466 **** wtab = (STRUCT_UTMP *)zalloc(1); wtabsz = 0; lastutmpcheck = 0; ! dowatch(); return 0; } --- 462,471 ---- wtab = (STRUCT_UTMP *)zalloc(1); wtabsz = 0; lastutmpcheck = 0; ! if (ops['u']) ! dowatch(1); ! else ! dowatch(0); return 0; } *** hashtable.h.orig Tue Jun 11 17:46:49 1996 --- hashtable.h Tue Jun 11 17:35:32 1996 *************** *** 282,288 **** {NULL, "let", 0, bin_let, 1, -1, 0, NULL, NULL}, {NULL, "limit", 0, bin_limit, 0, -1, 0, "sh", NULL}, {NULL, "local", BINF_TYPEOPTS | BINF_MAGICEQUALS, bin_typeset, 0, -1, 0, "LRUZilrtu", NULL}, ! {NULL, "log", 0, bin_log, 0, 0, 0, NULL, NULL}, {NULL, "logout", 0, bin_break, 0, 1, BIN_LOGOUT, NULL, NULL}, #if defined(ZSH_MEM) & defined(ZSH_MEM_DEBUG) --- 282,288 ---- {NULL, "let", 0, bin_let, 1, -1, 0, NULL, NULL}, {NULL, "limit", 0, bin_limit, 0, -1, 0, "sh", NULL}, {NULL, "local", BINF_TYPEOPTS | BINF_MAGICEQUALS, bin_typeset, 0, -1, 0, "LRUZilrtu", NULL}, ! {NULL, "log", 0, bin_log, 0, 0, 0, "u", NULL}, {NULL, "logout", 0, bin_break, 0, 1, BIN_LOGOUT, NULL, NULL}, #if defined(ZSH_MEM) & defined(ZSH_MEM_DEBUG) *** system.h.orig Tue Jun 11 17:47:02 1996 --- system.h Tue Jun 11 17:14:13 1996 *************** *** 305,310 **** --- 305,312 ---- # define DEFAULT_WATCHFMT "%n has %a %l." #endif + #define SIMPLE_WATCHFMT "%n" + #define DEFAULT_WORDCHARS "*?_-.[]~=/&;!#$%^(){}<>" #define DEFAULT_TIMEFMT "%J %U user %S system %P cpu %*E total" -- hniksic@srce.hr | Student of electrical engineering hniksic@fly.cc.fer.hr | University of Zagreb, Croatia ------------------------------------------------------------------ I'm a Lisp variable -- bind me!