+#define ROOT
+#include "build.h"
+
#include "external/cbs/cbs.c"
int main(void) {
build("external/");
build("src/");
+ cflags = (char *[]){CFCBS, NULL};
+ compile("clean", CBS, NULL);
+
+ load('x', "clean", "clean", NULL);
+
return 0;
}
+/* Switch the following #define to change whether or not raylib is built as a
+ * static or dynamic library; be sure to `./clean' before you `./build' again.
+ */
// #define RLDYNAMIC
#ifdef RLDYNAMIC
#define RLEXT ".a"
#endif
-#define SRC ROOT "src/"
-
+#define CBSPATH ROOT "external/cbs/"
+#define CBS CBSPATH "cbs.c"
#define RLROOT ROOT "external/raylib/"
+#define RLLIB RLROOT "raylib" RLEXT
#define RLSRC RLROOT "src/"
#define RLHDR RLSRC "raylib"
-#define RLLIB RLROOT "raylib" RLEXT
+#define SIMPLEXPM ROOT "bin/simplexpm"
+#define SRC ROOT "src/"
+#define UTILS SRC "utilities"
+#define CFCBS "-I" CBSPATH
#define CFRAYLIB "-I" RLSRC
#define CFSRC "-I" SRC
#ifdef __APPLE__
-#define LFRAYLIB \
+#define RLLFLAGS \
"-framework", "Cocoa", \
"-framework", "CoreVideo", \
"-framework", "GLUT", \
"-framework", "IOKit", \
"-framework", "OpenGL"
#else
-#define LFRAYLIB "-lm"
+#define RLLFLAGS "-lm"
+#endif
+#ifdef RLDYNAMIC
+#define LFEXTERNAL RLLFLAGS
+#define LFRAYLIB NULL
+#else
+#define LFEXTERNAL NULL
+#define LFRAYLIB RLLFLAGS
#endif
--- /dev/null
+#define ROOT
+#include "build.h"
+
+#define COLORS SRC "colors.c"
+#define FIND "/usr/bin/find"
+#define FONT SRC "font.c"
+#define GENCOLORS SRC "colors/gencolors"
+#define GENFONT SRC "font/genfont"
+#define RM "/bin/rm"
+
+#include "external/cbs/cbs.c"
+
+int main(void) {
+ char *what, **whos, **regexes, ***rms;
+ size_t i;
+ pid_t cpid;
+
+ what = "removal";
+
+ // Remove build executables and object files
+ whos = (char *[2]){"{*/*build,*/*/*build}", "{*/*.o,*/*/*.o,*/*/*/*.o}"};
+ regexes = (char *[2]){".*[^\\.]/build$", ".*\\.o$"};
+ for (i = 0; i < 2; ++i) {
+ if ((cpid = fork()) == 0)
+ run(FIND, (char *[]){"find", ".", "-regex", regexes[i],
+ "-exec", "rm", "{}", "+", NULL}, what, whos[i]);
+ await(cpid, what, whos[i]);
+ }
+
+ /* Remove raylib library, application executables,
+ * automatically generated source files, and ourself
+ */
+ whos = (char *[4]){extend(RLLIB, RLEXT),
+ "{" GENCOLORS "," GENFONT "," SIMPLEXPM "}",
+ "{" COLORS "," FONT "}", "clean"};
+ rms = (char **[4]){(char *[3]){whos[0]},
+ (char *[3]){GENCOLORS, GENFONT, SIMPLEXPM},
+ (char *[3]){COLORS, FONT}, (char *[3]){whos[3]}};
+ for (i = 0; i < 4; ++i) {
+ if ((cpid = fork()) == 0)
+ run(RM, (char *[]){"rm", rms[i][0], rms[i][1], rms[i][2], NULL},
+ what, whos[i]);
+ await(cpid, what, whos[i]);
+ }
+ free(whos[0]);
+
+ return EXIT_SUCCESS;
+}
RLSRC "rtextures", RLSRC "utils", \
RLSRC "rcore", RLSRC "rglfw"
-#ifdef RLDYNAMIC
-#define CFRLGLOBAL "-DPLATFORM_DESKTOP", "-fPIC"
+#ifdef __APPLE__
+#define CFGRAPHICS "-x", "objective-c"
#else
-#define CFRLGLOBAL "-DPLATFORM_DESKTOP"
+#define CFGRAPHICS "-D_GLFW_X11"
#endif
-#define CFRLGLFW "-I" RLSRC "external/glfw/include"
-#ifdef __APPLE__
-#define CFRLX "-x", "objective-c"
+#define CFGLFW "-I" RLSRC "external/glfw/include"
+#ifdef RLDYNAMIC
+#define CFGLOBALS "-DPLATFORM_DESKTOP", "-fPIC"
#else
-#define CFRLX "-D_GLFW_X11"
+#define CFGLOBALS "-DPLATFORM_DESKTOP"
#endif
#ifdef RLDYNAMIC
-#define RLTYPE 'd'
+#define LIBTYPE 'd'
#else
-#define RLTYPE 's'
+#define LIBTYPE 's'
#endif
#include "cbs/cbs.c"
build(NULL);
src = (char *[]){RLSRCS, NULL};
- cflags = (char *[]){CFRLGLOBAL, NULL};
+ cflags = (char *[]){CFGLOBALS, NULL};
for (i = 0; i < 6; ++i) compile(src[i], NULL);
- cflags = (char *[]){CFRLGLOBAL, CFRLGLFW, NULL};
+ cflags = (char *[]){CFGLFW, CFGLOBALS, NULL};
compile(src[6], NULL);
- cflags = (char *[]){CFRLGLOBAL, CFRLGLFW, CFRLX, NULL};
+ cflags = (char *[]){CFGRAPHICS, CFGLFW, CFGLOBALS, NULL};
compile(src[7], NULL);
-#ifdef RLDYNAMIC
- lflags = (char *[]){LFRAYLIB, NULL};
-#endif
- load(RLTYPE, RLLIB, RLSRCS, NULL);
+ lflags = (char *[]){LFEXTERNAL, NULL};
+ load(LIBTYPE, RLLIB, RLSRCS, NULL);
- return 0;
+ return EXIT_SUCCESS;
}
-Subproject commit 3f59e2fa436ef5d7e527fd39e52a050536669db7
+Subproject commit a7ad152e9248d770b63684c5e019348457100a1e
#define ROOT "../"
#include "../build.h"
-#define BIN ROOT "bin/"
-#define CBS ROOT "external/cbs/"
-
-#define CFCBS "-I" CBS
-
#include "../external/cbs/cbs.c"
int main(void) {
build(NULL);
- compile("error", NULL);
+ compile("utilities", NULL);
build("colors/");
build("font/");
cflags = (char *[]){CFRAYLIB, NULL};
- compile("main", "error", RLHDR, "xpm", "font.c", NULL);
+ compile("main", "utilities", "options", RLHDR, "xpm", "font.c", NULL);
cflags = NULL;
- compile("options", "error", NULL);
+ compile("options", "utilities", NULL);
cflags = (char *[]){CFRAYLIB, CFCBS, NULL};
- compile("xpm", "error", RLHDR, "xpm", CBS "cbs.c", "colors.c", NULL);
+ compile("xpm", "utilities", RLHDR, "xpm", CBS, "colors.c", NULL);
-#ifndef RLDYNAMIC
lflags = (char *[]){LFRAYLIB, NULL};
-#endif
- load('x', BIN "simplexpm", "error", "main", "options", "xpm", RLLIB, NULL);
+ load('x', SIMPLEXPM, "utilities", "main", "options", "xpm", RLLIB, NULL);
- return 0;
+ return EXIT_SUCCESS;
}
#define ROOT "../../"
#include "../../build.h"
+#define COLORS SRC "colors.c"
+
#include "../../external/cbs/cbs.c"
int main(void) {
build(NULL);
cflags = (char *[]){CFSRC, NULL};
- compile("gencolors", SRC "error", NULL);
- load('x', "gencolors", SRC "error", "gencolors", NULL);
+ compile("gencolors", UTILS, NULL);
+ load('x', "gencolors", "gencolors", UTILS, NULL);
- if (modified(SRC "colors.c", "gencolors.c")
- || modified(SRC "colors.c", "rgb.txt"))
- run("gencolors", (char *[]){"./gencolors", NULL}, "execution", "gencolors");
+ if (modified(COLORS, "gencolors.c") || modified(COLORS, "rgb.txt"))
+ run("gencolors", (char *[]){"./gencolors", "rgb.txt", COLORS, NULL},
+ "execution", "gencolors");
- return 0;
+ return EXIT_SUCCESS;
}
#include <sys/stat.h>
#include <unistd.h>
-#include "error.h"
+#include "utilities.h"
-int main(void) {
- int result, infd, outfd, i;
+int main(int argc, char **argv) {
+ int result, infd, outfd;
struct stat instat;
- size_t len;
+ size_t l, i;
void *map;
char *p;
- long r, g, b;
+ unsigned char r, g, b;
- result = 1;
- if ((infd = open("rgb.txt", O_RDONLY)) == -1) {
- xpmerror("Unable to open `rgb.txt' for reading");
+ result = EXIT_FAILURE;
+ if (argc != 3) {
+ xpmerror("Incorrect number of arguments: %s <input.txt> <output.c>", argv[0]);
+ return result;
+ }
+ if ((infd = open(argv[1], O_RDONLY)) == -1) {
+ xpmerror("Unable to open `%s' for reading", argv[1]);
return result;
}
if (fstat(infd, &instat) == -1) {
- xpmerror("Unable to stat `rgb.txt'");
+ xpmerror("Unable to stat `%s'", argv[1]);
goto closein;
}
- len = instat.st_size;
- if ((p = map = mmap(NULL, len, PROT_READ | PROT_WRITE,
+ l = instat.st_size;
+ if ((p = map = mmap(NULL, l, PROT_READ | PROT_WRITE,
MAP_PRIVATE, infd, 0)) == MAP_FAILED) {
- xpmerror("Unable to map `rgb.txt' to memory");
+ xpmerror("Unable to map `%s' to memory", argv[1]);
goto closein;
}
- if ((outfd = open("../colors.c", O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) {
- xpmerror("Unable to open `../colors.c' for writing");
+ if ((outfd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) {
+ xpmerror("Unable to open `%s' for writing", argv[2]);
goto munmap;
}
- result = 0;
+ result = EXIT_SUCCESS;
if (dprintf(outfd, "struct color {\n"
"\tchar *name;\n"
"\tunsigned int value;\n"
"};\n\n"
"static struct color colors[] = {\n"
"\t{\"None\", 0x00ffffff},\n") == -1) {
- xpmerror("Unable to write to `../colors.c'");
+ xpmerror("Unable to write to `%s'", argv[2]);
goto closeout;
}
- for (i = 1; p < (char *)map + len; ++i) {
+ for (i = 1; p < (char *)map + l; ++i) {
r = strtol(p, &p, 10);
g = strtol(p, &p, 10);
b = strtol(p, &p, 10);
- if (dprintf(outfd, "\t{\"%s\", 0x%02lx%02lx%02lx},\n",
+ if (dprintf(outfd, "\t{\"%s\", 0x%02x%02x%02x},\n",
strsep(&p, "\n") + 2, r, g, b) == -1) {
- xpmerror("Unable to write to `../colors.c'");
+ xpmerror("Unable to write to `%s'", argv[2]);
goto closeout;
}
}
- if (dprintf(outfd, "};\n\nstatic size_t numcolors = %d;\n", i) == -1)
- xpmerror("Unable to write to `../colors.c'");
+ if (dprintf(outfd, "};\n\nstatic size_t numcolors = %zu;\n", i) == -1)
+ xpmerror("Unable to write to `%s'", argv[2]);
closeout:
if (close(outfd) == -1)
- xpmerror("Unable to close `../colors.c'");
+ xpmerror("Unable to close `%s'", argv[2]);
munmap:
- if (munmap(map, len) == -1)
- xpmerror("Unable to unmap memory associated with `rgb.txt'");
+ if (munmap(map, l) == -1)
+ xpmerror("Unable to unmap memory associated with `%s'", argv[1]);
closein:
if (close(infd) == -1)
- xpmerror("Unable to close `rgb.txt'");
+ xpmerror("Unable to close `%s'", argv[1]);
return result;
}
#define ROOT "../../"
#include "../../build.h"
+#define FONT SRC "font.c"
+
#include "../../external/cbs/cbs.c"
int main(void) {
build(NULL);
cflags = (char *[]){CFRAYLIB, CFSRC, NULL};
- compile("genfont", SRC "error", RLHDR, NULL);
+ compile("genfont", UTILS, RLHDR, NULL);
-#ifndef RLDYNAMIC
lflags = (char *[]){LFRAYLIB, NULL};
-#endif
- load('x', "genfont", SRC "error", "genfont", RLLIB, NULL);
+ load('x', "genfont", "genfont", UTILS, RLLIB, NULL);
- if (modified(SRC "font.c", "genfont.c") || modified(SRC "font.c", "font.ttf"))
- run("genfont", (char *[]){"./genfont", NULL}, "execution", "genfont");
+ if (modified(FONT, "genfont.c") || modified(FONT, "font.ttf"))
+ run("genfont", (char *[]){"./genfont", "font.ttf", FONT, NULL},
+ "execution", "genfont");
- return 0;
+ return EXIT_SUCCESS;
}
-#include <stdio.h>
#include <stdlib.h>
-#include "error.h"
#include "raylib.h"
+#include "utilities.h"
-int main(void) {
+int main(int argc, char **argv) {
Font font;
+ if (argc != 3) {
+ xpmerror("Incorrect number of arguments: %s <input.ttf> <output.c>", argv[0]);
+ return EXIT_FAILURE;
+ }
+
SetTraceLogLevel(LOG_WARNING);
InitWindow(0, 0, "");
- font = LoadFontEx("font.ttf", 48, NULL, 95);
- if (!ExportFontAsCode(font, "../font.c")) {
- xpmerror("Unable to generate `font.c' from `font.ttf'");
- exit(EXIT_FAILURE);
+ font = LoadFontEx(argv[1], 48, NULL, 95);
+ if (!ExportFontAsCode(font, argv[2])) {
+ xpmerror("Unable to generate `%s' from `%s'", argv[2], argv[1]);
+ return EXIT_FAILURE;
}
UnloadFont(font);
* the transient application we open to load the font
*/
- return 0;
+ return EXIT_SUCCESS;
}
#include <setjmp.h>
-#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
-#include "error.h"
#include "options.h"
#define SUPPORT_IMAGE_EXPORT
#include "raylib.h"
+#include "utilities.h"
#include "xpm.h"
extern bool isGpuReady;
#include "font.c"
+static void getinput(char **xp, Texture2D *tp, Image *ip) {
+ FilePathList files;
+ static int mode = DEFAULT;
+ KeyboardKey key;
+ size_t len;
+
+ if (IsFileDropped()) {
+ files = LoadDroppedFiles();
+ if (*xp) RL_FREE(*xp);
+ *xp = xpmalloc(FILENAME_MAX);
+ strcpy(*xp, files.paths[0]);
+ UnloadDroppedFiles(files);
+ *tp = gettexture(*xp, ip, mode);
+ } else switch ((key = GetKeyPressed())) {
+ case KEY_R:
+ if (*xp) *tp = gettexture(*xp, ip, mode);
+ case KEY_NULL:
+ break;
+ case KEY_S:
+ if (tp->id == 0) break;
+ len = strlen(*xp);
+ strncpy(*xp + len - 4, ".png", 4);
+ ExportImage(*ip, *xp);
+ strncpy(*xp + len - 4, ".xpm", 4);
+ break;
+ default:
+ switch (key) {
+ case KEY_M:
+ mode = MODEM;
+ break;
+ case KEY_FOUR:
+ mode = MODEG4;
+ break;
+ case KEY_G:
+ mode = MODEG;
+ break;
+ case KEY_C:
+ mode = MODEC;
+ break;
+ default:
+ return;
+ }
+ if (*xp) *tp = gettexture(NULL, ip, mode);
+ }
+}
+
int main(int argc, char **argv) {
- int debug, mode;
+ int debug;
char *xpm, *welcome, *error;
Image image;
Texture2D texture;
Font font;
- FilePathList files;
- KeyboardKey key;
- size_t len, width, height;
+ size_t width, height;
float scale;
Vector2 pos, dim;
- if (!options(argc, argv, &debug, &xpm)) return 1;
+ if (!options(argc, argv, &debug, &xpm)) return EXIT_FAILURE;
if (!debug) SetTraceLogLevel(LOG_ERROR);
InitWindow(800, 600, "simplexpm");
SetExitKey(KEY_Q);
image = (Image){0};
- mode = DEFAULT;
- texture = gettexture(xpm, &image, mode);
- if (xpm && texture.id == 0) return 1;
+ texture = gettexture(xpm, &image, DEFAULT);
+ if (xpm && texture.id == 0) return EXIT_FAILURE;
font = LoadFont_Font();
welcome = "Drag and drop an XPM file here";
error = "Unable to parse XPM file:\n see console for details";
while (!WindowShouldClose()) {
- if (IsFileDropped()) {
- files = LoadDroppedFiles();
- if (xpm) RL_FREE(xpm);
- xpm = RL_CALLOC(FILENAME_MAX, 1);
- TextCopy(xpm, files.paths[0]);
- UnloadDroppedFiles(files);
- texture = gettexture(xpm, &image, mode);
- } else switch ((key = GetKeyPressed())) {
- case KEY_R:
- if (xpm) texture = gettexture(xpm, &image, mode);
- break;
- case KEY_S:
- if (texture.id == 0) break;
- len = strlen(xpm);
- strncpy(xpm + len - 4, ".png", 4);
- ExportImage(image, xpm);
- strncpy(xpm + len - 4, ".xpm", 4);
- break;
- default:
- switch (key) {
- case KEY_M:
- mode = MODEM;
- break;
- case KEY_FOUR:
- mode = MODEG4;
- break;
- case KEY_G:
- mode = MODEG;
- break;
- case KEY_C:
- mode = MODEC;
- break;
- default:
- continue;
- }
- if (xpm) texture = gettexture(NULL, &image, mode);
- case KEY_NULL:;
- }
+ getinput(&xpm, &texture, &image);
BeginDrawing();
EndDrawing();
}
- if (xpm) RL_FREE(xpm);
+ if (xpm) free(xpm);
UnloadTexture(texture);
CloseWindow();
- return 0;
+ return EXIT_SUCCESS;
}
#include <string.h>
#include <unistd.h>
-#include "error.h"
+#include "utilities.h"
static void usage(char *prog, int fd) {
dprintf(fd, "Usage: %s [-dh] [-f file]\n"
"\t c Color visual mode\n", prog);
}
-int options(int argc, char **argv, int *debug, char **xpmp) {
+int options(int argc, char **argv, int *debug, char **xp) {
int opt, result, dnfd;
*debug = 0;
- *xpmp = NULL;
+ *xp = NULL;
while ((opt = getopt(argc, argv, "df:h")) != -1) switch (opt) {
case 'd':
*debug = 1;
break;
case 'f':
- *xpmp = strdup(optarg);
+ *xp = xpmalloc(FILENAME_MAX);
+ strcpy(*xp, optarg);
break;
case 'h':
usage(argv[0], STDOUT_FILENO);
- exit(0);
+ exit(EXIT_SUCCESS);
case '?':
default:
usage(argv[0], STDERR_FILENO);
- exit(1);
+ exit(EXIT_FAILURE);
}
result = 1;
result = 0;
} else if (dup2(dnfd, STDOUT_FILENO) == -1) {
xpmerror("Unable to redirect stdout to `/dev/null'");
- exit(1);
+ exit(EXIT_FAILURE);
}
if (close(dnfd) == -1) {
xpmerror("Unable to close `/dev/null'");
#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/errno.h>
#include <unistd.h>
}
dprintf(STDERR_FILENO, "\n");
}
+
+void *xpmalloc(size_t s) {
+ void *r;
+
+ if ((r = malloc(s))) return memset(r, 0, s);
+
+ xpmerror("Memory allocation");
+ exit(EXIT_FAILURE);
+}
void xpmerror(char *fmt, ...);
+void *xpmalloc(size_t s);
#include <fcntl.h>
#include <sys/mman.h>
-#include "error.h"
#include "raylib.h"
+#include "utilities.h"
#include "xpm.h"
+#define TMP "/tmp/xpm"
+#define TMPSRC TMP ".c"
+#define TMPLIB "/tmp/libxpm" DYEXT
+
#include "cbs.c"
#include "colors.c"
return c == ' ' || c == '\t';
}
-static void *zalloc(size_t s) {
- void *r;
-
- if ((r = calloc(1, s))) return r;
-
- xpmerror("Memory allocation");
- exit(EXIT_FAILURE);
-}
-
static char *arrname(char *p, size_t l) {
size_t step;
char *start, *r;
start = p;
for (; !space(*p) && *p != '['; ++p, --l) if (l == 0) return NULL;
l = p - start;
- r = zalloc(l + 1);
+ r = xpmalloc(l + 1);
strncpy(r, start, l);
return r;
case 'm':
r = MODEM;
break;
- case 's':
- r = SYMBOLIC;
- break;
case 'g':
if (**strp == '4') {
++*strp;
default:
xpmerror("Unknown key `%c'", *(*strp - 1));
r = NUMMODES;
+ break;
+ case 's':
+ r = SYMBOLIC;
}
while (space(**strp)) ++*strp;
}
// Colors
- chars = zalloc(ncolors * cpp * sizeof*chars);
- colors = zalloc(NUMMODES * ncolors * sizeof*colors);
+ chars = xpmalloc(ncolors * cpp * sizeof*chars);
+ colors = xpmalloc(NUMMODES * ncolors * sizeof*colors);
for (i = 0; i < ncolors; ++i) {
p = data[1 + i];
strncpy(chars + i * cpp, p, cpp);
}
// Pixels
- pixels = zalloc(NUMMODES * height * width * sizeof*pixels);
+ pixels = xpmalloc(NUMMODES * height * width * sizeof*pixels);
j = width;
l = 0;
for (i = 0, pp = &data[1 + ncolors];
int xpmfd, srcfd, e, cpid, status;
struct stat xstat;
size_t l, offset;
- char *map, *p, *a, **data;
+ char *map, *p, *a, *tmp, **data;
void *d;
long *sizep;
goto munmap;
}
- if ((srcfd = open("/tmp/xpm.c", O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) {
- xpmerror("Unable to open `/tmp/xpm.c'");
+ if ((srcfd = open(TMPSRC, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) {
+ xpmerror("Unable to open `" TMPSRC "'");
goto munmap;
}
e = !writeall(srcfd, p, l - offset)
|| dprintf(srcfd, "\n\nlong size = sizeof %s / sizeof*%s;\n", a, a) < 0;
if (close(srcfd) == -1) {
- xpmerror("Unable to close `/tmp/xpm.c'");
+ xpmerror("Unable to close `" TMPSRC "'");
goto munmap;
}
if (e) {
- xpmerror("Unable to write to `/tmp/xpm.c'");
+ xpmerror("Unable to write to `" TMPSRC "'");
goto munmap;
}
if ((cpid = fork()) == 0) {
- compile("/tmp/xpm", NULL);
- load('d', "/tmp/xpm", "/tmp/xpm", NULL);
+ compile(TMP, NULL);
+ load('d', TMP, TMP, NULL);
exit(EXIT_SUCCESS);
}
if (cpid == -1 || waitpid(cpid, &status, 0) == -1
|| !WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS) {
- xpmerror("Unable to create `/tmp/libxpm" DYEXT "'");
+ xpmerror("Unable to create `" TMPLIB "'");
goto munmap;
}
- if ((d = dlopen("/tmp/libxpm" DYEXT, RTLD_LAZY)) == NULL) {
- xpmerror("Unable to load `/tmp/libxpm" DYEXT "': %s", dlerror());
+ if ((d = dlopen(TMPLIB, RTLD_LAZY)) == NULL) {
+ xpmerror("Unable to load `" TMPLIB "': %s", dlerror());
goto munmap;
}
if ((data = (char **)dlsym(d, a)) == NULL) {
- xpmerror("Unable to load image data from `/tmp/libxpm" DYEXT "': `%s'",
- dlerror());
+ xpmerror("Unable to load image data from `" TMPLIB "': `%s'", dlerror());
goto dlclose;
}
if ((sizep = (long *)dlsym(d, "size")) == NULL) {
- xpmerror("Unable to load image length from `/tmp/libxpm" DYEXT "': `%s'",
- dlerror());
+ xpmerror("Unable to load image length from `" TMPLIB "': `%s'", dlerror());
goto dlclose;
}
result = parse(data, sizep);
dlclose:
- if (dlclose(d))
- xpmerror("Unable to unload `/tmp/libxpm" DYEXT "': %s", dlerror());
+ if (dlclose(d)) xpmerror("Unable to unload `" TMPLIB "': %s", dlerror());
munmap:
if (munmap(map, l) == -1) xpmerror("Unable to unmap `%s' from memory", xpm);