diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-03-12 17:15:03 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-03-12 17:15:03 +0100 |
commit | 963cfc9a6f6e721f52aa949e6d1af0c3e8dc2ecc (patch) | |
tree | 749b74875dbc49bcf6ed0776648b8f0ef9417407 /sys/src/cmd/upas/send/bind.c | |
parent | 8177d20fb2709ba9290dfd41308b8e5bee4e00f8 (diff) |
merging erik quanstros nupas
Diffstat (limited to 'sys/src/cmd/upas/send/bind.c')
-rw-r--r-- | sys/src/cmd/upas/send/bind.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/sys/src/cmd/upas/send/bind.c b/sys/src/cmd/upas/send/bind.c index 8a8fc8eac..5e97b872f 100644 --- a/sys/src/cmd/upas/send/bind.c +++ b/sys/src/cmd/upas/send/bind.c @@ -1,20 +1,34 @@ #include "common.h" #include "send.h" -static int forward_loop(char *, char *); +/* Return TRUE if a forwarding loop exists, i.e., the String `system' + * is found more than 4 times in the return address. + */ +static int +forward_loop(char *addr, char *system) +{ + int len, found; + + found = 0; + len = strlen(system); + while(addr = strchr(addr, '!')) + if (!strncmp(++addr, system, len) + && addr[len] == '!' && ++found == 4) + return 1; + return 0; +} + /* bind the destinations to the commands to be executed */ -extern dest * +dest * up_bind(dest *destp, message *mp, int checkforward) { - dest *list[2]; /* lists of unbound destinations */ - int li; /* index into list[2] */ - dest *bound=0; /* bound destinations */ - dest *dp; - int i; + int i, li; + dest *list[2], *bound, *dp; + bound = nil; list[0] = destp; - list[1] = 0; + list[1] = nil; /* * loop once to check for: @@ -24,7 +38,7 @@ up_bind(dest *destp, message *mp, int checkforward) * - characters that need escaping */ for (dp = d_rm(&list[0]); dp != 0; dp = d_rm(&list[0])) { - if (!checkforward) + if(!checkforward) dp->authorized = 1; dp->addr = escapespecial(dp->addr); if (forward_loop(s_to_c(dp->addr), thissys)) { @@ -115,19 +129,3 @@ up_bind(dest *destp, message *mp, int checkforward) return bound; } - -/* Return TRUE if a forwarding loop exists, i.e., the String `system' - * is found more than 4 times in the return address. - */ -static int -forward_loop(char *addr, char *system) -{ - int len = strlen(system), found = 0; - - while (addr = strchr(addr, '!')) - if (!strncmp(++addr, system, len) - && addr[len] == '!' && ++found == 4) - return 1; - return 0; -} - |