/*
 *	(c) Copyright 1990, Kim Fabricius Storm.  All rights reserved.
 *
 *	Reply address rewriting.
 */

#include "config.h"


int
reroute(route, address)
char *route, *address;
{
    char *name, *atpos;
    register char *sp;
    register c;

    if ((atpos = strchr(address, '@'))) {
	name = atpos;

	while (--name >= address)
	    if (isspace(*name) || *name == '<') {
		name++;
		break;
	    }
	if (name < address) name++;

	for (sp = atpos; (c = *sp); sp++)
	    if (isspace(c) || c == '>') break;

	*sp = NUL;
	strcpy(route, name);
	*sp = c;
    } else
	strcpy(route, address);
    return 1;
}

