home *** CD-ROM | disk | FTP | other *** search
- /*
- * strcrepl.c
- * contains: strcreplace()
- *
- */
-
- #include <stdio.h>
- #include "gfuncts.h"
-
- /*
- * char *
- * strcreplace(destination,source,pos,count,n)
- *
- * ARGUMENT
- * (char *) destination - destination string
- * (char *) source - source string
- * (int) pos - position to start replacement
- * (int) count - Number of replacements
- * (int) n - max length of destination
- *
- * DESCRIPTION
- * Starting at pos characters are copied from source to destination
- * until count characters have been copied or the terminating null is
- * detected in the source string or the max length of the destination
- * has been reached.
- *
- * RETURNS
- * Pointer to the destination string or NULL if any of the pointer
- * arguments are NULL. Returns NULL if n <=0 or count <=0.
- *
- * AUTHOR
- * "" 15-APR-1987 14:15:56.43
- * Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- */
- char* GF_CONV strcreplace(destination,source,pos,count,n)
- char *destination,*source;
- int pos,count,n;
- {
- char *orgdest;
-
- if(!destination||!source||n<=0||count<=0)
- return((char *)0);
- for(orgdest=destination,destination+=pos,n-=pos;*source&&count&&n;
- --count,++source,++destination,--n)
- *destination=*source;
- return(orgdest);
- }
-