diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2002-02-03 15:55:04 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2002-02-03 15:55:04 +0100 |
commit | deb9f887106521797cacd77f1ae48de1d7b3277e (patch) | |
tree | ca79d7e3988bed90e1f18bcc9b39cecee67a91c7 /tools.c | |
parent | 0b7e9057daceab33b13238f4dea90976b5d2074d (diff) | |
download | vdr-deb9f887106521797cacd77f1ae48de1d7b3277e.tar.gz vdr-deb9f887106521797cacd77f1ae48de1d7b3277e.tar.bz2 |
Implemented TITLE and EPISODE keywords
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.54 2002/02/02 13:03:40 kls Exp $ + * $Id: tools.c 1.55 2002/02/03 13:35:38 kls Exp $ */ #include "tools.h" @@ -100,6 +100,23 @@ char *strreplace(char *s, char c1, char c2) return s; } +char *strreplace(char *s, const char *s1, const char *s2) +{ + char *p = strstr(s, s1); + if (p) { + int of = p - s; + int l = strlen(s); + int l1 = strlen(s1); + int l2 = strlen(s2); + if (l2 > l1) + s = (char *)realloc(s, strlen(s) + l2 - l1 + 1); + if (l2 != l1) + memmove(s + of + l2, s + of + l1, l - of - l1 + 1); + strncpy(s + of, s2, l2); + } + return s; +} + char *skipspace(const char *s) { while (*s && isspace(*s)) |