[7927] in Athena Bugs

home help back first fref pref prev next nref lref last post

SIPB patches for xzwrite

daemon@ATHENA.MIT.EDU (Barr3y Jaspan)
Wed Aug 14 22:02:32 1991

Date: Wed, 14 Aug 91 22:02:39 -0400
From: "Barr3y Jaspan" <bjaspan@MIT.EDU>
To: bugs@ATHENA.MIT.EDU, testers@ATHENA.MIT.EDU
Cc: jtkohl@ATHENA.MIT.EDU


The follows patches (by jtkohl) add 'unsubscriptions' to xzwrite (and
its man page :-).  They are the only reason that SIPB still has its
own copy of xzwrite.

I assume it is too late to get these into the release, but am sending
them to testers just in case.  The changes are minor and
self-contained.  As soon as these get into the Athena release version,
SIPB will be able to reclaim the badly-needed space currently taken by
xzwrite.

diff -c -r /afs/athena/astaff/project/zephyr/src/clients/xzwrite/destlist.c xzwrite/destlist.c
*** /afs/athena/astaff/project/zephyr/src/clients/xzwrite/destlist.c	Fri Nov 16 11:15:15 1990
--- xzwrite/destlist.c	Wed Mar  6 09:20:18 1991
***************
*** 218,229 ****
  	  return strcmp(s1, s2);
  }
  
  char **sort_destinations()
  {
!      char	**d;
  
       d = (char **) DynGet(dests, 0);
!      qsort(d, DynSize(dests), sizeof(char *), sort_dest_func);
       return d;
  }
  
--- 218,282 ----
  	  return strcmp(s1, s2);
  }
  
+ static int
+ binary_find_dest(key)
+ char *key;
+ {
+     register int low = 0, high = DynSize(dests), mid;
+     register int val;
+     register char **d;
+ 
+     d = (char **) DynGet(dests, 0);
+ 
+     /* do binary search */
+     while (low <= high) {
+ 	mid = (low + high) / 2;
+ 	val = sort_dest_func(&key, &d[mid]);
+ 	if (val < 0) {
+ 	    high = mid - 1;
+ 	} else if (val > 0) {
+ 	    low = mid + 1;
+ 	} else {
+ 	    return (mid);
+ 	}
+     }
+ 
+     return -1;
+ }
+ 
  char **sort_destinations()
  {
!      register char **d;
!      register int idx, idx2;
!      int dsiz = DynSize(dests);
  
       d = (char **) DynGet(dests, 0);
!      qsort(d, dsiz, sizeof(char *), sort_dest_func);
!      
!      for (idx = 0; idx < DynSize(dests);) {
! 	if (d[idx][0] == '!') {
! 	    /* unsubscription */
! 	    char *next = d[idx];
! 	    next++;
! 	    while ((idx2 = binary_find_dest(next)) >= 0) {
! 		/* found one to nuke */
! 		DynDelete(dests, idx2);
! 		if (idx2 <= idx) {
! 		    /* indexes shifted, so restart this pass. */
! 		    idx--;
! 		    if (idx <= 0)
! 			idx = 0;
! 		    continue;
! 		}
! 	    }
! 	    /* ok, no more to nuke from this one, so delete it and
! 	       move on. */
! 	    DynDelete(dests, idx);
! 	    continue;
! 	}
! 	/* nope, continue on to next unsub */
! 	idx++;
!      }
       return d;
  }
  
diff -c -r /afs/athena/astaff/project/zephyr/src/clients/xzwrite/xzwrite.1 xzwrite/xzwrite.1
*** /afs/athena/astaff/project/zephyr/src/clients/xzwrite/xzwrite.1	Fri Nov 16 11:15:47 1990
--- xzwrite/xzwrite.1	Wed Mar  6 09:36:39 1991
***************
*** 24,29 ****
--- 24,30 ----
  <class, instance, recipient> triples that a user can send messages to.
  When a user selects a destination, all subsequent messages will be
  sent to that triple, until a new destination is selected.  
+ .PP
  .I Xzwrite
  can get its list of destinations from the files .xzwrite.dest,
  .anyone, or .zephyr.vars in the
***************
*** 35,42 ****
  with two commas is taken to be <class,instance,recipient>.  The lines
  must appear
  .B WITHOUT WHITESPACE 
! between the fields and with a linefeed between each line.  Blank lines
! and lines beginning with an octothorpe (#) are ignored.
  .PP
  
  Clicking the left button in the 
--- 36,49 ----
  with two commas is taken to be <class,instance,recipient>.  The lines
  must appear
  .B WITHOUT WHITESPACE 
! between the fields and with a linefeed between each line.  Lines
! beginning with "!" are interpreted as "un-subscriptions"; after all
! files have been scanned, all lines matching those starting with "!"  are
! removed from the list of destinations.  This can be handy if you
! subscribe to messages which you don't send to with
! .I xzwrite
! (e.g. syslog output from a machine you manage).  Blank lines and lines
! beginning with a hash mark (#) are ignored.
  .PP
  
  Clicking the left button in the 
***************
*** 377,384 ****
--- 384,393 ----
  .TP
  ~/.xzwrite.dest
  The user's xzwrite destinations list.
+ .TP
  ~/.anyone
  The user's .anyone file.
+ .TP
  ~/.zephyr.subs
  The user's zephyr subscription file.
  .SH SEE ALSO

home help back first fref pref prev next nref lref last post