mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Implemented TITLE and EPISODE keywords
This commit is contained in:
19
tools.c
19
tools.c
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user