]>
git.zerfleddert.de Git - record-dvb/blob - common.c
97ec8073e93d681e7101abf6669f9dbb5af0a331
8 struct dvb_host
*parse(char *urlpart
, char *defport
)
10 struct dvb_host
*dvbhost
;
13 if (!(dvbhost
= malloc(sizeof(struct dvb_host
)))) {
18 bzero(dvbhost
, sizeof(struct dvb_host
));
20 if (!(dvbhost
->hostname
= strdup(urlpart
))) {
25 /* Unneded, but better readablity: */
26 dvbhost
->location
= NULL
;
29 pos
= dvbhost
->hostname
;
31 while(*pos
!= '\0' && *pos
!= ':' && *pos
!= '/')
35 dvbhost
->location
= pos
+ 1;
38 dvbhost
->port
= pos
+ 1;
45 while(*pos
!= '\0' && *pos
!= '/')
49 dvbhost
->location
= pos
+ 1;
55 dvbhost
->port
= strdup(defport
);
57 if (!dvbhost
->location
)
58 if(!(dvbhost
->location
= strdup(""))) {