struct StringsBase *StringsBase=0L; #define RUN #ifdef RUN char *StrnCat(dest,source,l) register char *dest; register char *source; register unsigned long l; { register char *p=dest; if(l) { do ; while(*dest++); dest--; /* go EOS */ do { *dest++=*source++; if(!*source) l=1; } while(--l); *dest=0; } return p; }; /*$VER: StrnCat Arp04 0.2 */ #endif int main() { /* MAIN */ long el=0; char s[256], *p; StringsBase=(struct StringsBase *)OpenLibrary("Strings.library",0); puts("testing strncat"); strcpy(s,""); strncat(s,"W",9); strncat(s,"Q",0); strncat(s,"e$ ",1); strncat(s,"nxyz",1); strncat(s,"n dies ein richtiger ",23); strncat(s,"Satz wird, ",28); strncat(s,"",0); strncat(s,"",0); strncat(s,"",3); strncat(s,"dann ist strncat$%&*",16); strncat(s,"",3); strncat(s," ",3); p=(char *)strncat(s,"korrect!$%766786",8); printf("<%s> len = %ld\n",s,StrLen(s)); printf("<%s> len = %ld\n",p,StrLen(p)); puts("testing StrnCat libraryfunktion:"); strcpy(s,""); StrnCat(s,"W",9); StrnCat(s,"Q",0); StrnCat(s,"e$ ",1); StrnCat(s,"nxyz",1); StrnCat(s,"n dies ein richtiger ",23); StrnCat(s,"Satz wird, ",28); StrnCat(s,"",0); StrnCat(s,"",0); StrnCat(s,"",3); StrnCat(s,"dann ist StrnCat$%&*",16); StrnCat(s,"",3); StrnCat(s," ",3); p=(char *)StrnCat(s,"korrect!$%766786",8); printf("<%s> len = %ld\n",s,StrLen(s)); printf("<%s> len = %ld\n",p,StrLen(p)); if(StringsBase) CloseLibrary(StringsBase); return el; } /* END */ /* _StrnCat: move.l a0,d1 tst.l d0 ; set EOS beq StrnCat3 StrnCat5: tst.b (a0)+ bne StrnCat5 subq.l #1,a0 StrnCat7: move.b (a1)+,(a0)+ tst.b (a1) bne StrnCat8 moveq.l #1,d0 StrnCat8: subq.l #1,d0 bne StrnCat7 clr.b (a0) StrnCat3: move.l d1,d0 rts DICE Error bei strncat(s,"",3); : testing strncat len = 64 len = 64 ------------------------------------------------------------------ testing strncat len = 60 len = 60 testing StrnCat libraryfunktion: len = 60 len = 60 */