struct dvb_host *parse(char *urlpart, char *defport)
{
- struct dvb_host *dvbhost;
+ static struct dvb_host *dvbhost = NULL;
char *pos;
- if (!(dvbhost = malloc(sizeof(struct dvb_host)))) {
- perror("malloc");
- exit(EXIT_FAILURE);
+ if (!dvbhost) {
+ if (!(dvbhost = malloc(sizeof(struct dvb_host)))) {
+ perror("malloc");
+ exit(EXIT_FAILURE);
+ }
}
bzero(dvbhost, sizeof(struct dvb_host));
return 0;
}
+int is_url(char *string)
+{
+ char *pos;
+
+ if (!(strlen(string)))
+ return 0;
+
+ pos = string;
+
+ while(*pos != ':' && *pos != 0)
+ pos++;
+
+ if (!strncmp("://", pos, 3))
+ return 1;
+
+ return 0;
+}