plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

gateway.c (514B)


      1 #include "common.h"
      2 #include "send.h"
      3 
      4 #undef isspace
      5 #define isspace(c) ((c)==' ' || (c)=='\t' || (c)=='\n')
      6 
      7 /*
      8  *  Translate the last component of the sender address.  If the translation
      9  *  yields the same address, replace the sender with its last component.
     10  */
     11 extern void
     12 gateway(message *mp)
     13 {
     14 	char *base;
     15 	String *s;
     16 
     17 	/* first remove all systems equivalent to us */
     18 	base = skipequiv(s_to_c(mp->sender));
     19 	if(base != s_to_c(mp->sender)){
     20 		s = mp->sender;
     21 		mp->sender = s_copy(base);
     22 		s_free(s);
     23 	}
     24 }