aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/upas/send/gateway.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-10-29 16:26:44 +0000
committerrsc <devnull@localhost>2005-10-29 16:26:44 +0000
commit5cdb17983ae6e6367ad7a940cb219eab247a9304 (patch)
tree8ca1ef49af2a96e7daebe624d91fdf679814a057 /src/cmd/upas/send/gateway.c
parentcd3745196389579fb78b9b01ef1daefb5a57aa71 (diff)
downloadplan9port-5cdb17983ae6e6367ad7a940cb219eab247a9304.tar.gz
plan9port-5cdb17983ae6e6367ad7a940cb219eab247a9304.tar.bz2
plan9port-5cdb17983ae6e6367ad7a940cb219eab247a9304.zip
Thanks to John Cummings.
Diffstat (limited to 'src/cmd/upas/send/gateway.c')
-rw-r--r--src/cmd/upas/send/gateway.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cmd/upas/send/gateway.c b/src/cmd/upas/send/gateway.c
new file mode 100644
index 00000000..f3b2b36d
--- /dev/null
+++ b/src/cmd/upas/send/gateway.c
@@ -0,0 +1,24 @@
+#include "common.h"
+#include "send.h"
+
+#undef isspace
+#define isspace(c) ((c)==' ' || (c)=='\t' || (c)=='\n')
+
+/*
+ * Translate the last component of the sender address. If the translation
+ * yields the same address, replace the sender with its last component.
+ */
+extern void
+gateway(message *mp)
+{
+ char *base;
+ String *s;
+
+ /* first remove all systems equivalent to us */
+ base = skipequiv(s_to_c(mp->sender));
+ if(base != s_to_c(mp->sender)){
+ s = mp->sender;
+ mp->sender = s_copy(base);
+ s_free(s);
+ }
+}