blob: dd6549c8f8b9fd660e1fe93d401bd44b4d90a220 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <string.h>
#include <glib.h>
// FIXME: kill this ugliness when we have a proper CSS parser
gchar *extract_uri(gchar const *s)
{
gchar const *sb = s;
g_assert( strncmp(sb, "url", 3) == 0 );
sb += 3;
while ( ( *sb == ' ' ) ||
( *sb == '(' ) )
{
sb++;
}
gchar const *se = sb + strlen(sb);
while ( ( se[-1] == ' ' ) ||
( se[-1] == ')' ) )
{
se--;
}
if ( sb < se ) {
return g_strndup(sb, se - sb);
} else {
return NULL;
}
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
|