[477] in BarnOwl Developers

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

zwrite.c patch for barnowl

daemon@ATHENA.MIT.EDU (arolfe@MIT.EDU)
Thu Oct 29 18:06:36 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
Date: 13 Feb 2007 01:48:51 -0000
From: arolfe@MIT.EDU
To: dirty-owl-hackers@mit.edu
Reply-To: arolfe@MIT.EDU

This calls the zsigprog with arguments that are the class, instance, and
recipient.  This allows destination-dependant zsigs.  

Alex

Index: zwrite.c
===================================================================
--- zwrite.c	(revision 605)
+++ zwrite.c	(working copy)
@@ -148,11 +148,21 @@
       z->zsig=owl_strdup(zsigowlvar);
     } else if (zsigproc && *zsigproc) {
       FILE *file;
+      int linelen, i,j;
       char buff[LINE], *openline;
       
+      linelen = strlen(zsigproc) + strlen(z->class) + strlen(z->inst) + 40;
+      j=owl_list_get_size(&(z->recips));
+      for (i=0; i<j; i++) {
+	linelen += 1 + strlen((char *)owl_list_get_element(&(z->recips),i));
+      }
       /* simple hack for now to nuke stderr */
-      openline=owl_malloc(strlen(zsigproc)+40);
-      strcpy(openline, zsigproc);
+      openline=owl_malloc(linelen);
+      sprintf(openline,"%s %s %s",zsigproc, z->class,z->inst);
+      for (i=0; i<j; i++) {
+	strcat(openline," ");
+	strcat(openline,(char *) owl_list_get_element(&(z->recips),i));
+      }
 #if !(OWL_STDERR_REDIR)
       strcat(openline, " 2> /dev/null");
 #endif

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