
/*  File   : strtrans.c
    Author : Richard A. O'Keefe.
    Updated: 2 June 1984
    Defines: strtrans()

    strtrans(dst, src, from, to)
    copies characters from src[] to dst[], stopping when dst gets a  NUL
    character,  translating  characters  in  from[] to the corresponding
    characters in to[]. Courtesy of _str2map, if from or to is NULL  its
    previous  value  will be used, and if both are NULL the table won't
    be rebuilt.  Note that copying stops when a NUL is put  into  dst[],
    which  can  normally  happen  only  when a NUL has been fetched from
    src[], but if you have built your own translation table  it  may  be
    earlier  (if  some  character  is mapped to NUL) or later (if NUL is
    mapped to something else).  No value is returned.

*/

#include "stdio.h"
#include "_str2map.h"


char *strtrans(dst, src, from, to)
register char *dst, *src;
char *from, *to;
{
    _str2map(0, from, to);
    while (*dst++ = _map_vec[*src++])
       ;
    return --dst;
}

