]> Trent Huber's Code - xpmview.git/commitdiff
Upgrade build system
authorTrent Huber <trentmhuber@gmail.com>
Wed, 23 Jul 2025 04:14:45 +0000 (00:14 -0400)
committerTrent Huber <trentmhuber@gmail.com>
Wed, 23 Jul 2025 04:14:45 +0000 (00:14 -0400)
24 files changed:
.gitignore
README.md
assets/application.png [moved from images/application.png with 100% similarity]
assets/font.ttf [moved from src/font/font.ttf with 100% similarity]
assets/rgb.txt [moved from src/colors/rgb.txt with 100% similarity]
assets/test.png [moved from images/test.png with 100% similarity]
assets/test.xpm [moved from images/test.xpm with 100% similarity]
build.c
build.h
clean.c [deleted file]
external/build.c
external/cbs
external/cbsfile.c [new file with mode: 0644]
src/.gitignore
src/build.c
src/buildfont.c [new file with mode: 0644]
src/cbs.h
src/colors/.gitignore [deleted file]
src/colors/build.c [deleted file]
src/colors/gencolors.c [deleted file]
src/font/.gitignore [deleted file]
src/font/build.c [deleted file]
src/font/genfont.c [deleted file]
src/xpm.c

index 64e0fef32d6a3ca336c9f7021c48c23667d2ccd8..3b4a3a8bc93038bc4e7e11acbab7b27c6f8153ea 100644 (file)
@@ -1,3 +1,2 @@
-*build
 *.o
-clean
+*build
index 7dc53854317e4a0f85109f9873632edff54f10af..2a7f7c01714d3b1154980eefecdfe19b38410b07 100644 (file)
--- a/README.md
+++ b/README.md
@@ -51,9 +51,9 @@ If modifications are made to the XPM file while loaded, hitting `r` reloads the
 Finally, with an XPM file loaded, color modes can be changed by pressing corresponding keys (see a complete list of key bindings by using the `-h` flag).
 
 ```console
-$ ./bin/simplexpm -f images/test.xpm
+$ ./bin/simplexpm -f assets/test.xpm
 ```
-![Here's an image of the above command running on my machine.](images/application.png "Running the above command")
+![Here's an image of the above command running on my machine.](assets/application.png "Running the above command")
 
 ## Theory of Operation
 
similarity index 100%
rename from src/font/font.ttf
rename to assets/font.ttf
similarity index 100%
rename from src/colors/rgb.txt
rename to assets/rgb.txt
similarity index 100%
rename from images/test.png
rename to assets/test.png
similarity index 100%
rename from images/test.xpm
rename to assets/test.xpm
diff --git a/build.c b/build.c
index 4b502fb54205d75b8704eba172d514cab30fe21a..5f954bc7a5140ea516e16ea2cd8ba4ac8e6f617c 100644 (file)
--- a/build.c
+++ b/build.c
@@ -1,17 +1,10 @@
-#define ROOT
-#include "build.h"
-
 #include "external/cbs/cbs.c"
 
 int main(void) {
-   build(NULL);
+   build("./");
 
    build("external/");
    build("src/");
 
-   compile("clean", NULL);
-
-   load('x', "clean", "clean", NULL);
-
    return 0;
 }
diff --git a/build.h b/build.h
index c18406462a17f57ca3d26598f6ec830b290629f4..e87a95d9f92cc9d7b9e1a600691d5a6f202cb760 100644 (file)
--- a/build.h
+++ b/build.h
@@ -1,25 +1,6 @@
-/* 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.
- */
+// Rebuild with the following #define to use Raylib as a dynamic library
 // #define DYNAMICLIBS
 
-#ifdef DYNAMICLIBS
-#define LIBEXT DYEXT
-#else
-#define LIBEXT ".a"
-#endif
-
-#define CBSROOT ROOT "external/cbs/"
-#define CBSLIB CBSROOT "cbs" LIBEXT
-#define RLROOT ROOT "external/raylib/"
-#define RLLIB RLROOT "raylib" LIBEXT
-#define RLSRC RLROOT "src/"
-#define RLHDR RLSRC "raylib"
-#define SIMPLEXPM ROOT "bin/simplexpm"
-#define SRC ROOT "src/"
-
-#define CFRAYLIB "-I" RLSRC
-
 #ifdef __APPLE__
 #define LFRAYLIB \
    "-framework", "Cocoa", \
diff --git a/clean.c b/clean.c
deleted file mode 100644 (file)
index 8035079..0000000
--- a/clean.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#define ROOT
-#include "build.h"
-
-#include "external/cbs/cbs.c"
-
-#define FIND "/usr/bin/find"
-#define RM "/bin/rm"
-#define GENCOLORS SRC "colors/gencolors"
-#define GENFONT SRC "font/genfont"
-#define COLORS SRC "colors.c"
-#define FONT SRC "font.c"
-
-int main(void) {
-   char *what, **whos, **regexes, ***rms;
-   size_t i;
-   pid_t cpid;
-
-   what = "remove";
-
-   // 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 cbs and raylib libraries, application executables,
-    * automatically generated source files, and ourself
-    */
-   whos = (char *[5]){extend(CBSLIB, LIBEXT), extend(RLLIB, LIBEXT),
-                      "{" GENCOLORS "," GENFONT "," SIMPLEXPM "}",
-                      "{" COLORS "," FONT "}", "clean"};
-   rms = (char **[5]){(char *[3]){whos[0]}, (char *[3]){whos[1]},
-                      (char *[3]){GENCOLORS, GENFONT, SIMPLEXPM},
-                      (char *[3]){COLORS, FONT}, (char *[3]){whos[4]}};
-   for (i = 0; i < 5; ++i) {
-       if ((cpid = fork()) == 0)
-           run(RM, (char *[]){"rm", "-f", rms[i][0], rms[i][1], rms[i][2], NULL},
-               what, whos[i]);
-       await(cpid, what, whos[i]);
-   }
-   free(whos[0]);
-
-   return EXIT_SUCCESS;
-}
index b187b361aabd7d4e1d83debed00b7858d5771212..1c211723e05d047b3f9db14a7c8a7ad468936ce6 100644 (file)
@@ -1,67 +1,70 @@
-#define ROOT "../"
 #include "../build.h"
-
 #include "cbs/cbs.c"
+#include "cbsfile.c"
 
-#define CBSSRC CBSROOT "cbs"
-#define RLSRCS \
-   RLSRC "raudio", RLSRC "rmodels", \
-   RLSRC "rshapes", RLSRC "rtext", \
-   RLSRC "rtextures", RLSRC "utils", \
-   RLSRC "rcore", RLSRC "rglfw"
-
+#define CFGLFW "-I" RLSRC "external/glfw/include"
 #ifdef __APPLE__
 #define CFGRAPHICS "-x", "objective-c"
 #else
 #define CFGRAPHICS "-D_GLFW_X11"
 #endif
-#define CFGLFW "-I" RLSRC "external/glfw/include"
-#ifdef DYNAMICLIBS
-#define CFPIC "-fPIC"
-#else
-#define CFPIC NULL
-#endif
-#define CFGLOBALS "-DPLATFORM_DESKTOP", CFPIC
-
-#ifndef DYNAMICLIBS
-#undef LFRAYLIB
-#define LFRAYLIB NULL
-#endif
-
 #ifdef DYNAMICLIBS
+#define CLPIC LIST("-fPIC")
+#define CFGENERAL "-DPLATFORM_DESKTOP", "-fPIC"
 #define LIBTYPE 'd'
+#define LLRAYLIB LIST(LFRAYLIB)
 #else
+#define CLPIC NONE
+#define CFGENERAL "-DPLATFORM_DESKTOP"
 #define LIBTYPE 's'
+#define LLRAYLIB NONE
 #endif
 
-void cbs(void) {
-   cflags = (char *[]){CFPIC, NULL};
-   compile(CBSSRC, NULL);
+#define RLLIB "raylib/raylib"
+#define RLSRC "raylib/src/"
+
+void buildcbs(void) {
+   char **c, **l;
+
+   c = cflags;
+   l = lflags;
 
-   load(LIBTYPE, CBSLIB, CBSSRC, NULL);
+   cflags = CLPIC;
+   compile("cbs/cbs");
+
+   lflags = NONE;
+   load(LIBTYPE, "cbs/cbs", LIST("cbs/cbs"));
+
+   cflags = c;
+   lflags = l;
 }
 
-void raylib(void) {
-   char **src;
-   size_t i;
+void buildraylib(void) {
+   struct cbsfile *files;
+
+   files = (struct cbsfile []){
+       {RLLIB, LLRAYLIB, LIBTYPE},
+
+       {RLSRC "raudio", LIST(CFGENERAL)},
+       {RLSRC "rcore", LIST(CFGLFW, CFGENERAL)},
+       {RLSRC "rglfw", LIST(CFGLFW, CFGRAPHICS, CFGENERAL)},
+       {RLSRC "rmodels", LIST(CFGENERAL)},
+       {RLSRC "rshapes", LIST(CFGENERAL)},
+       {RLSRC "rtext", LIST(CFGENERAL)},
+       {RLSRC "rtextures", LIST(CFGENERAL)},
+       {RLSRC "utils", LIST(CFGENERAL)},
 
-   src = (char *[]){RLSRCS, NULL};
-   cflags = (char *[]){CFGLOBALS, NULL};
-   for (i = 0; i < 6; ++i) compile(src[i], NULL);
-   cflags = (char *[]){CFGLFW, CFGLOBALS, NULL};
-   compile(src[6], NULL);
-   cflags = (char *[]){CFGRAPHICS, CFGLFW, CFGLOBALS, NULL};
-   compile(src[7], NULL);
+       {NULL}
+   };
 
-   lflags = (char *[]){LFRAYLIB, NULL};
-   load(LIBTYPE, RLLIB, RLSRCS, NULL);
+   buildfiles(files);
 }
 
 int main(void) {
-   build(NULL);
+   build("./");
 
-   cbs();
-   raylib();
+   buildcbs();
+   buildraylib();
 
    return EXIT_SUCCESS;
 }
index a2cb47c262bee92a2f7cab689e42ae8452c9e952..280a887eb0b54773a149cbc15b0f911c981edb97 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a2cb47c262bee92a2f7cab689e42ae8452c9e952
+Subproject commit 280a887eb0b54773a149cbc15b0f911c981edb97
diff --git a/external/cbsfile.c b/external/cbsfile.c
new file mode 100644 (file)
index 0000000..e4657e8
--- /dev/null
@@ -0,0 +1,30 @@
+struct cbsfile {
+   char *name, **flags, type;
+};
+
+void buildfiles(struct cbsfile *files) {
+   char **c, **l, **names;
+   struct cbsfile *target;
+   size_t i;
+
+   c = cflags;
+   l = lflags;
+
+   target = files++;
+
+   for (i = 0; files[i].name; ++i) if (files[i].flags) {
+       cflags = files[i].flags;
+       compile(files[i].name);
+   }
+
+   names = allocate((i + 1) * sizeof *names);
+   for (i = 0; files[i].name; ++i) names[i] = files[i].name;
+
+   lflags = target->flags;
+   load(target->type, target->name, names);
+
+   free(names);
+
+   cflags = c;
+   lflags = l;
+}
index 96ac906d3eaf56ff638479ff19dfd48e464cf5e6..d605eed07d81455c6a9be17e5a0dd0d1dbab540e 100644 (file)
@@ -1,2 +1,3 @@
 colors.c
 font.c
+buildfont
index 17341735f278026221d55929a2bcb5bb32d8f116..3ac92bcebc4b06b0a8738c9c61e8d1f5b73cee0b 100644 (file)
-#define ROOT "../"
-#include "../build.h"
+#include <sys/mman.h>
 
+#include "../build.h"
 #include "../external/cbs/cbs.c"
+#include "../external/cbsfile.c"
 
-#define CFDYEXT "-DDYEXT=\"" DYEXT "\""
-
+#define CLRAYLIB LIST("-I../external/raylib/src/")
 #ifdef DYNAMICLIBS
-#undef LFRAYLIB
-#define LFRAYLIB NULL
+#define LIBEXT DYEXT
+#define LLRAYLIB NONE
+#else
+#define LIBEXT ".a"
+#define LLRAYLIB LIST(LFRAYLIB)
 #endif
 
+#define RLLIB "../external/raylib/raylib" LIBEXT
+#define CBSLIB "../external/cbs/cbs" LIBEXT
+
+static void buildcolors(void) {
+   int quit, txtfd, codefd;
+   char *txt, *code, *p;
+   struct stat txtstat;
+   size_t l, i;
+   void *map;
+   unsigned char r, g, b;
+
+   quit = 1;
+   txt = "../assets/rgb.txt";
+   code = "colors.c";
+   if ((txtfd = open(txt, O_RDONLY)) == -1)
+       err(EXIT_FAILURE, "Unable to open `%s' for reading", txt);
+   if (fstat(txtfd, &txtstat) == -1) {
+       warn("Unable to stat `%s'", txt);
+       goto closetxt;
+   }
+   l = txtstat.st_size;
+   if ((p = map = mmap(NULL, l, PROT_READ | PROT_WRITE,
+                       MAP_PRIVATE, txtfd, 0)) == MAP_FAILED) {
+       warn("Unable to map `%s' to memory", txt);
+       goto closetxt;
+   }
+   if ((codefd = open(code, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) {
+       warn("Unable to open `%s' for writing", code);
+       goto munmap;
+   }
+
+   if (dprintf(codefd, "#include <stddef.h>\n\n"
+               "#include \"colors.h\"\n\n"
+               "struct color colors[] = {\n"
+               "\t{\"None\", 0x00ffffff},\n") == -1) {
+       warn("Unable to write to `%s'", code);
+       goto closecode;
+   }
+   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(codefd, "\t{\"%s\", 0x%02x%02x%02x},\n",
+                   strsep(&p, "\n") + 2, r, g, b) == -1) {
+           warn("Unable to write to `%s'", code);
+           goto closecode;
+       }
+   }
+   if (dprintf(codefd, "};\n\nsize_t numcolors = %zu;\n", i) == -1)
+       warn("Unable to write to `%s'", code);
+
+   quit = 0;
+
+closecode:
+   if (close(codefd) == -1) {
+       warn("Unable to close `%s'", code);
+       quit = 1;
+   }
+
+munmap:
+   if (munmap(map, l) == -1) {
+       warn("Unable to unmap memory associated with `%s'", txt);
+       quit = 1;
+   }
+
+closetxt:
+   if (close(txtfd) == -1) {
+       warn("Unable to close `%s'", txt);
+       quit = 1;
+   }
+
+   if (quit) exit(EXIT_FAILURE);
+}
+
+static void buildfont(void) {
+   char **c, **l;
+   pid_t cpid;
+
+   c = cflags;
+   l = lflags;
+
+   cflags = CLRAYLIB;
+   compile("buildfont");
+
+   lflags = LLRAYLIB;
+   load('x', "buildfont", LIST("buildfont", RLLIB));
+
+   if ((cpid = fork()) == 0)
+       run("buildfont", LIST("buildfont"), "run", "buildfont");
+   await(cpid, "run", "buildfont");
+
+   cflags = c;
+   lflags = l;
+}
+
 int main(void) {
-   build(NULL);
+   struct cbsfile *files;
+
+   build("./");
+
+   buildcolors();
+   buildfont();
+
+   files = (struct cbsfile []){
+       {"../bin/simplexpm", LLRAYLIB, 'x'},
+
+       {"colors", NONE},
+       {"main", CLRAYLIB},
+       {"options", NONE},
+       {"xpm", CLRAYLIB},
 
-   build("colors/");
-   build("font/");
+       {CBSLIB},
+       {RLLIB},
 
-   compile("colors", "colors", NULL);
-   cflags = (char *[]){CFRAYLIB, NULL};
-   compile("main", "cbs", "options", RLHDR, "xpm", "font.c", NULL);
-   cflags = NULL;
-   compile("options", "cbs", NULL);
-   cflags = (char *[]){CFDYEXT, CFRAYLIB, NULL};
-   compile("xpm", "cbs", "colors", RLHDR, "xpm", "colors.c", NULL);
+       {NULL}
+   };
 
-   lflags = (char *[]){LFRAYLIB, NULL};
-   load('x', SIMPLEXPM, "colors", "main", "options", "xpm", CBSLIB, RLLIB, NULL);
+   buildfiles(files);
 
    return EXIT_SUCCESS;
 }
diff --git a/src/buildfont.c b/src/buildfont.c
new file mode 100644 (file)
index 0000000..a123e51
--- /dev/null
@@ -0,0 +1,22 @@
+#include <err.h>
+#include <stdlib.h>
+
+#include "raylib.h"
+
+int main(void) {
+   char *ttf, *code;
+   Font font;
+
+   ttf = "../assets/font.ttf";
+   code = "font.c";
+
+   SetTraceLogLevel(LOG_WARNING);
+   InitWindow(0, 0, "");
+
+   if (!ExportFontAsCode(font = LoadFontEx(ttf, 48, NULL, 95), code))
+       errx(EXIT_FAILURE, "Unable to generate `%s' from `%s'", code, ttf);
+
+   UnloadFont(font);
+
+   return EXIT_SUCCESS;
+}
index c81e516a739f76afe3b9d62bc2b377138f44e99e..70e4f85177b16f00a7725df26cb57de23a539ed0 100644 (file)
--- a/src/cbs.h
+++ b/src/cbs.h
@@ -1,3 +1,11 @@
+#ifdef __APPLE__
+#define DYEXT ".dylib"
+#else
+#define DYEXT ".so"
+#endif
+
+#define LIST(...) (char *[]){__VA_ARGS__, NULL}
+
 void *allocate(size_t s);
-void compile(char *src, ...);
-void load(char type, char *target, char *obj, ...);
+void compile(char *src);
+void load(char type, char *target, char **objs);
diff --git a/src/colors/.gitignore b/src/colors/.gitignore
deleted file mode 100644 (file)
index 4188a8d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-gencolors
diff --git a/src/colors/build.c b/src/colors/build.c
deleted file mode 100644 (file)
index 0a2406f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#define ROOT "../../"
-#include "../../build.h"
-
-#include "../../external/cbs/cbs.c"
-
-#define COLORS SRC "colors.c"
-
-int main(void) {
-   build(NULL);
-
-   compile("gencolors", NULL);
-
-   load('x', "gencolors", "gencolors", NULL);
-
-   if (modified(COLORS, "gencolors.c") || modified(COLORS, "rgb.txt"))
-       run("gencolors", (char *[]){"./gencolors", "rgb.txt", COLORS, NULL},
-           "run", "gencolors");
-
-   return EXIT_SUCCESS;
-}
diff --git a/src/colors/gencolors.c b/src/colors/gencolors.c
deleted file mode 100644 (file)
index e5c4856..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#include <err.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-int main(int argc, char **argv) {
-   int result, infd, outfd;
-   struct stat instat;
-   size_t l, i;
-   void *map;
-   char *p;
-   unsigned char r, g, b;
-
-   result = EXIT_FAILURE;
-   if (argc != 3)
-       errx(EXIT_FAILURE, "Incorrect number of arguments: %s <input.txt> <output.c>",
-            argv[0]);
-   if ((infd = open(argv[1], O_RDONLY)) == -1)
-       err(EXIT_FAILURE, "Unable to open `%s' for reading", argv[1]);
-   if (fstat(infd, &instat) == -1) {
-       warn("Unable to stat `%s'", argv[1]);
-       goto closein;
-   }
-   l = instat.st_size;
-   if ((p = map = mmap(NULL, l, PROT_READ | PROT_WRITE,
-                       MAP_PRIVATE, infd, 0)) == MAP_FAILED) {
-       warn("Unable to map `%s' to memory", argv[1]);
-       goto closein;
-   }
-   if ((outfd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) {
-       warn("Unable to open `%s' for writing", argv[2]);
-       goto munmap;
-   }
-
-   if (dprintf(outfd, "#include <stddef.h>\n\n"
-               "#include \"colors.h\"\n\n"
-               "struct color colors[] = {\n"
-               "\t{\"None\", 0x00ffffff},\n") == -1) {
-       warn("Unable to write to `%s'", argv[2]);
-       goto closeout;
-   }
-   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%02x%02x%02x},\n",
-                   strsep(&p, "\n") + 2, r, g, b) == -1) {
-           warn("Unable to write to `%s'", argv[2]);
-           goto closeout;
-       }
-   }
-   if (dprintf(outfd, "};\n\nsize_t numcolors = %zu;\n", i) == -1)
-       warn("Unable to write to `%s'", argv[2]);
-
-   result = EXIT_SUCCESS;
-
-closeout:
-   if (close(outfd) == -1) {
-       warn("Unable to close `%s'", argv[2]);
-       result = EXIT_FAILURE;
-   }
-
-munmap:
-   if (munmap(map, l) == -1) {
-       warn("Unable to unmap memory associated with `%s'", argv[1]);
-       result = EXIT_FAILURE;
-   }
-
-closein:
-   if (close(infd) == -1) {
-       warn("Unable to close `%s'", argv[1]);
-       result = EXIT_FAILURE;
-   }
-
-   return result;
-}
diff --git a/src/font/.gitignore b/src/font/.gitignore
deleted file mode 100644 (file)
index 0e97b24..0000000
+++ /dev/null
@@ -1 +0,0 @@
-genfont
diff --git a/src/font/build.c b/src/font/build.c
deleted file mode 100644 (file)
index b596a60..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#define ROOT "../../"
-#include "../../build.h"
-
-#include "../../external/cbs/cbs.c"
-
-#define FONT SRC "font.c"
-
-#ifdef DYNAMICLIBS
-#undef LFRAYLIB
-#define LFRAYLIB NULL
-#endif
-
-int main(void) {
-   build(NULL);
-
-   cflags = (char *[]){CFRAYLIB, NULL};
-   compile("genfont", RLHDR, NULL);
-
-   lflags = (char *[]){LFRAYLIB, NULL};
-   load('x', "genfont", "genfont", RLLIB, NULL);
-
-   if (modified(FONT, "genfont.c") || modified(FONT, "font.ttf"))
-       run("genfont", (char *[]){"./genfont", "font.ttf", FONT, NULL},
-           "run", "genfont");
-
-   return EXIT_SUCCESS;
-}
diff --git a/src/font/genfont.c b/src/font/genfont.c
deleted file mode 100644 (file)
index 958e271..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <err.h>
-#include <stdlib.h>
-
-#include "raylib.h"
-
-int main(int argc, char **argv) {
-   Font font;
-
-   if (argc != 3)
-       errx(EXIT_FAILURE, "Incorrect number of arguments: %s <input.ttf> <output.c>",
-            argv[0]);
-
-   SetTraceLogLevel(LOG_WARNING);
-   InitWindow(0, 0, "");
-
-   font = LoadFontEx(argv[1], 48, NULL, 95);
-   if (!ExportFontAsCode(font, argv[2]))
-       errx(EXIT_FAILURE, "Unable to generate `%s' from `%s'", argv[2], argv[1]);
-
-   UnloadFont(font);
-
-   /* Don't call CloseWindow() so focus doesn't shift to
-    * the transient application we open to load the font
-    */
-
-   return EXIT_SUCCESS;
-}
index 70761b576208bfc4ab879f0b9fb661f9c2240e42..5821c3b5b824bc882f2e8e649d64477288c69255 100644 (file)
--- a/src/xpm.c
+++ b/src/xpm.c
@@ -262,8 +262,8 @@ static Image process(char *xpm) {
    }
 
    if ((cpid = fork()) == 0) {
-       compile(TMP, NULL);
-       load('d', TMP, TMP, NULL);
+       compile(TMP);
+       load('d', TMP, LIST(TMP));
        exit(EXIT_SUCCESS);
    }
    if (cpid == -1 || waitpid(cpid, &status, 0) == -1) {