aboutsummaryrefslogtreecommitdiff
path: root/audio/nas/files/patch-server_dia_gram.y
blob: 5df2230682402d4a4daf8c17a2c687a1e3722835 (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
--- server/dia/gram.y.orig	2013-04-27 00:41:06 UTC
+++ server/dia/gram.y
@@ -3,6 +3,7 @@
 
 
 %{
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -14,14 +15,14 @@
 #include "misc.h"
 
 static char     *ptr;
-static int parsebool(char *str);
+static intptr_t parsebool(const char *str);
 extern int yylineno;
 
 %}
 
 %union
 {
-    int num;
+    intptr_t num;
     char *ptr;
 };
 
@@ -250,30 +251,21 @@ char *str;
     *o = '\0';
 }
 
-static int
-parsebool(char *str)
+static intptr_t
+parsebool(const char *str)
 {
-    char *s;
-
-    s = str;
-
-    if (s == NULL)
+    if (str == NULL)
         return (-1);
 
-    while (*s) {
-        *s = (char) tolower(*s);
-        s++;
-    }
-
-    if (((char *) strstr("false", str) != NULL) ||
-        ((char *) strstr("no", str) != NULL) ||
-        ((char *) strstr("0", str) != NULL) ||
-        ((char *) strstr("off", str) != NULL)) {
+    if (((char *) strcasestr("false", str) != NULL) ||
+        ((char *) strcasestr("no", str) != NULL) ||
+        ((char *) strcasestr("0", str) != NULL) ||
+        ((char *) strcasestr("off", str) != NULL)) {
         return (FALSE);
-    } else if (((char *) strstr("true", str) != NULL) ||
-               ((char *) strstr("yes", str) != NULL) ||
-               ((char *) strstr("1", str) != NULL) ||
-               ((char *) strstr("on", str) != NULL)) {
+    } else if (((char *) strcasestr("true", str) != NULL) ||
+               ((char *) strcasestr("yes", str) != NULL) ||
+               ((char *) strcasestr("1", str) != NULL) ||
+               ((char *) strcasestr("on", str) != NULL)) {
         return (TRUE);
     } else {
         fprintf(stderr, "parsebool(): error parsing '%s', \n\t%s\n",