Fixed off-by-one error in compute_shine_table(). Minor code clean-up
[mesa.git] / src / glut / glx / glut_glxext.c
1
2 /* Copyright (c) Mark J. Kilgard, 1997. */
3
4 /* This program is freely distributable without licensing fees
5 and is provided without guarantee or warrantee expressed or
6 implied. This program is -not- in the public domain. */
7
8 #include <stdlib.h>
9 #include <string.h>
10 #include "glutint.h"
11
12 #if defined(GLX_VERSION_1_1)
13 int
14 __glutIsSupportedByGLX(char *extension)
15 {
16 static const char *extensions = NULL;
17 const char *start;
18 char *where, *terminator;
19 int major, minor;
20
21 glXQueryVersion(__glutDisplay, &major, &minor);
22 /* Be careful not to call glXQueryExtensionsString if it
23 looks like the server doesn't support GLX 1.1.
24 Unfortunately, the original GLX 1.0 didn't have the notion
25 of GLX extensions. */
26 if ((major == 1 && minor >= 1) || (major > 1)) {
27 if (!extensions)
28 extensions = glXQueryExtensionsString(__glutDisplay, __glutScreen);
29 /* It takes a bit of care to be fool-proof about parsing
30 the GLX extensions string. Don't be fooled by
31 sub-strings, etc. */
32 start = extensions;
33 for (;;) {
34 where = strstr(start, extension);
35 if (!where)
36 return 0;
37 terminator = where + strlen(extension);
38 if (where == start || *(where - 1) == ' ') {
39 if (*terminator == ' ' || *terminator == '\0') {
40 return 1;
41 }
42 }
43 start = terminator;
44 }
45 }
46 return 0;
47 }
48 #endif