diff options
author | portix <portix@gmx.net> | 2012-11-17 02:05:30 +0100 |
---|---|---|
committer | portix <portix@gmx.net> | 2012-11-17 02:05:30 +0100 |
commit | 67bd59356231c5909b5f9f1c6a73db809a1450bf (patch) | |
tree | f54a602a7d41ad6f75ecc7c61f8db7991a4194ba /src/dwb.c | |
parent | f82b24685d481c703429fb88b3ab75ac1772dd9b (diff) | |
download | dwb-67bd59356231c5909b5f9f1c6a73db809a1450bf.zip |
Also allow //!-prefix for javascript userscripts
Diffstat (limited to 'src/dwb.c')
-rw-r--r-- | src/dwb.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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)) { |