summaryrefslogtreecommitdiff
path: root/src/dwb.c
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2012-11-17 02:05:30 +0100
committerportix <portix@gmx.net>2012-11-17 02:05:30 +0100
commit67bd59356231c5909b5f9f1c6a73db809a1450bf (patch)
treef54a602a7d41ad6f75ecc7c61f8db7991a4194ba /src/dwb.c
parentf82b24685d481c703429fb88b3ab75ac1772dd9b (diff)
downloaddwb-67bd59356231c5909b5f9f1c6a73db809a1450bf.zip
Also allow //!-prefix for javascript userscripts
Diffstat (limited to 'src/dwb.c')
-rw-r--r--src/dwb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dwb.c b/src/dwb.c
index 39c00d29..01d36354 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -2868,6 +2868,7 @@ dwb_get_scripts() {
Navigation *n;
GError *error = NULL;
FILE *f;
+ int l1, l2;
if ( (dir = g_dir_open(dwb.files[FILES_USERSCRIPTS], 0, NULL)) ) {
while ( (filename = (char*)g_dir_read_name(dir)) ) {
@@ -2889,8 +2890,8 @@ dwb_get_scripts() {
path = realpath;
}
}
- if ( (f = fopen(path, "r")) != NULL) {
- if (fgetc(f) == '#' && fgetc(f) == '!') {
+ if ( (f = fopen(path, "r")) != NULL && (l1 = fgetc(f)) && (l2 = fgetc(f)) ) {
+ if ( (l1 == '#' && l2 == '!') || (l1 == '/' && l2 == '/' && fgetc(f) == '!') ) {
if (fgets(buf, sizeof(buf), f) != NULL && !g_strcmp0(buf, "javascript")) {
int next = fgetc(f);
if (g_ascii_isspace(next)) {