13 * browser_braindamage_check()
15 * Given the value of the HTTP "User-agent:" directive supplied by
16 * a web browser, determine using a local configuration file whether
17 * the browser is capable of handling WebCit's frames/JavaScript mode.
19 * This function returns one of the following values:
20 * B_YES (Yes, it's ok to use frames and JavaScript)
21 * B_NO (No, fall back to the noframes version)
22 * B_ASK (We don't know; ask the user)
25 int browser_braindamage_check(char *browser)
31 fp = fopen("static/braindamage", "r");
35 while (fgets(buf, 256, fp) != NULL) {
36 buf[strlen(buf)-1] = 0;
38 if (!strncasecmp(buf, "YES", 3)) {
41 } else if (!strncasecmp(buf, "NO", 2)) {
44 } else if (!strncasecmp(buf, "ASK", 3)) {
49 while (isspace(buf[0])) strcpy(buf, &buf[1]);
50 if (wildmat(buf, browser)) {