+ /*
+ ** Check for any hostname lookups.
+ */
+
+ for (rvp = npvp; *rvp != NULL; rvp++)
+ {
+ char **hbrvp;
+ char **xpvp;
+ int trsize;
+ int i;
+ char buf[MAXATOM + 1];
+ char *pvpb1[MAXATOM + 1];
+ static char pvpbuf[PSBUFSIZE];
+
+ if (**rvp != HOSTBEGIN)
+ continue;
+
+ /*
+ ** Got a hostname lookup.
+ **
+ ** This could be optimized fairly easily.
+ */
+
+ hbrvp = rvp;
+
+ /* extract the match part */
+ while (*++rvp != NULL && **rvp != HOSTEND)
+ continue;
+ if (*rvp != NULL)
+ *rvp++ = NULL;
+
+ /* save the remainder of the input string */
+ trsize = (int) (avp - rvp + 1) * sizeof *rvp;
+ bcopy((char *) rvp, (char *) pvpb1, trsize);
+
+ /* look it up */
+ cataddr(++hbrvp, buf, sizeof buf);
+ maphostname(buf, sizeof buf);
+
+ /* scan the new host name */
+ xpvp = prescan(buf, '\0', pvpbuf);
+ if (xpvp == NULL)
+ {
+ syserr("rewrite: cannot prescan canonical hostname: %s", buf);
+ return (NULL);
+ }
+
+ /* append it to the token list */
+ rvp = --hbrvp;
+ while ((*rvp++ = *xpvp++) != NULL)
+ if (rvp >= &npvp[MAXATOM])
+ goto toolong;
+
+ /* restore the old trailing information */
+ for (xpvp = pvpb1, rvp--; (*rvp++ = *xpvp++) != NULL; )
+ if (rvp >= &npvp[MAXATOM])
+ goto toolong;
+ }
+
+ /*
+ ** Check for subroutine calls.
+ */
+
+