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

 
Output of file : STRNTRAN.C contained in archive : ECSTR.ZIP
/* File : strntrans.c
Author : Richard A. O'Keefe.
Updated: 2 June 1984
Defines: strntrans()

strntrans(dst, src, len, from, to)
Moves characters from src to dst, translating characters in from[]
to the corresponding characters in to[], until either len characters
have been moved or a NUL has been moved. If fewer than len characters
are moved, the remainder of dst will be filled with NULs, much like
strncpy and family. No value is returned.

Apology: in the previous distribution of this package, strntrans was
defined the way memtrans is now defined. This is more consistent with
the general naming conventions.
*/

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

#if VaxAsm

void strntrans(dst, src, len, from, to)
_char_ *dst, *src, *from, *to;
int len;
{
_str2map(0, from, to);
asm("movtuc 20(ap),*8(ap),$0,__map_vec,20(ap),*4(ap)");
/* now pad the destination out with NUL characters */
asm("movc5 $0,*8(ap),$0,r4,(r5)");
}

#else ~VaxAsm

void strntrans(dst, src, len, from, to)
register _char_ *dst, *src;
register int len;
_char_ *from, *to;
{
_str2map(0, from, to);
while (--len >= 0 && (*dst++ = _map_vec[*src++])) ;
while (--len >= 0) *dst++ = NUL;
}

#endif VaxAsm



  3 Responses to “Category : C Source Code
Archive   : ECSTR.ZIP
Filename : STRNTRAN.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/