Skip to content

Instantly share code, notes, and snippets.

@jonm
Last active November 8, 2015 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonm/78ecb2e0e40af162c409 to your computer and use it in GitHub Desktop.
Save jonm/78ecb2e0e40af162c409 to your computer and use it in GitHub Desktop.
void dsearch(char *string, char *tmp)
{
char *src, *dst;
src = string;
dst = tmp;
while(*src != '\0') {
if (*src == '~') {
if (*(src + 1) == 'N') {
*dst++ = '$';
*dst++ = 'n';
} else if (*(src + 1) == 'H') {
*dst++ = '$';
*dst++ = 's';
} else if (*(src + 1) == '\0') {
break;
}
src += 2;
} else {
*dst++ = *src++;
}
}
*dst = '\0';
strcpy(string, tmp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment