Category : C Source Code
Archive   : ECSTR.ZIP
Filename : STRTRANS.C

 
Output of file : STRTRANS.C contained in archive : ECSTR.ZIP
/* 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 NullS 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.

The VaxAsm version only works from strlen(src) < 2^16.
*/

#include "strings.h"
#include "_str2map.h"

#if VaxAsm

void strtrans(dst, src, from, to)
_char_ *dst, *src, *from, *to;
{
_str2map(0, from, to);
asm("movtuc $65535,*8(ap),$0,__map_vec,$65535,*4(ap)");
/* That stops when the "escape" is found, and we want to move it */
asm("movb $0,(r5)");
}

#else ~VaxAsm

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

#endif VaxAsm



  3 Responses to “Category : C Source Code
Archive   : ECSTR.ZIP
Filename : STRTRANS.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/