Make UEFI boot-platform build again
[haiku.git] / src / libs / glut / glut_util.c
blob88e531f025296aad16e1df519daa29afefc6bf62
1 /*
2 * Copyright 1994-1997 Mark Kilgard, All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * GPL licensing not permitted.
7 * Authors:
8 * Mark Kilgard
9 */
12 #include <stdlib.h>
13 #include <stdarg.h>
14 #include <string.h>
15 #include <stdio.h>
17 #include "glutint.h"
20 /* strdup is actually not a standard ANSI C or POSIX routine
21 so implement a private one for GLUT. OpenVMS does not have a
22 strdup; Linux's standard libc doesn't declare strdup by default
23 (unless BSD or SVID interfaces are requested). */
24 char *
25 __glutStrdup(const char *string)
27 char *copy;
29 copy = (char*) malloc(strlen(string) + 1);
30 if (copy == NULL)
31 return NULL;
32 strcpy(copy, string);
33 return copy;
36 void
37 __glutWarning(const char *format,...)
39 va_list args;
41 va_start(args, format);
42 fprintf(stderr, "GLUT: Warning in %s: ",
43 __glutProgramName ? __glutProgramName : "(unamed)");
44 vfprintf(stderr, format, args);
45 va_end(args);
46 putc('\n', stderr);
49 /* CENTRY */
50 void APIENTRY
51 glutReportErrors(void)
53 GLenum error;
55 while ((error = glGetError()) != GL_NO_ERROR)
56 __glutWarning("GL error: %s", gluErrorString(error));
58 /* ENDCENTRY */
60 void
61 __glutFatalError(const char *format,...)
63 va_list args;
65 va_start(args, format);
66 fprintf(stderr, "GLUT: Fatal Error in %s: ",
67 __glutProgramName ? __glutProgramName : "(unamed)");
68 vfprintf(stderr, format, args);
69 va_end(args);
70 putc('\n', stderr);
71 exit(1);
74 void
75 __glutFatalUsage(const char *format,...)
77 va_list args;
79 va_start(args, format);
80 fprintf(stderr, "GLUT: Fatal API Usage in %s: ",
81 __glutProgramName ? __glutProgramName : "(unamed)");
82 vfprintf(stderr, format, args);
83 va_end(args);
84 putc('\n', stderr);
85 abort();