ctopts.c revision 0bbfda8a
10bbfda8aSnia/* 20bbfda8aSnia * Compile-time options 30bbfda8aSnia */ 40bbfda8aSnia 50bbfda8aSnia#include "ctwm.h" 60bbfda8aSnia 70bbfda8aSnia#include <stdio.h> 80bbfda8aSnia#include <stdlib.h> 90bbfda8aSnia#include <string.h> 100bbfda8aSnia 110bbfda8aSnia#include "ctopts.h" 120bbfda8aSnia 130bbfda8aSnia 140bbfda8aSnia/* 150bbfda8aSnia * What options we're build with 160bbfda8aSnia */ 170bbfda8aSniastatic char *ctopts[] = { 180bbfda8aSnia "I18N", // Used to be optional, now standard. Remove? 190bbfda8aSnia#ifdef XPM 200bbfda8aSnia "XPM", 210bbfda8aSnia#endif 220bbfda8aSnia#ifdef JPEG 230bbfda8aSnia "JPEG", 240bbfda8aSnia#endif 250bbfda8aSnia#ifdef USEM4 260bbfda8aSnia "USEM4", 270bbfda8aSnia#endif 280bbfda8aSnia#ifdef SOUNDS 290bbfda8aSnia "SOUNDS", 300bbfda8aSnia#endif 310bbfda8aSnia#ifdef EWMH 320bbfda8aSnia "EWMH", 330bbfda8aSnia#endif 340bbfda8aSnia#ifdef DEBUG 350bbfda8aSnia "DEBUG", 360bbfda8aSnia#endif 370bbfda8aSnia NULL 380bbfda8aSnia}; 390bbfda8aSnia 400bbfda8aSnia 410bbfda8aSnia/* 420bbfda8aSnia * Build a string of our compile-time opts 430bbfda8aSnia */ 440bbfda8aSniachar * 450bbfda8aSniactopts_string(char *sep) 460bbfda8aSnia{ 470bbfda8aSnia char *cto; 480bbfda8aSnia size_t slen, tlen; 490bbfda8aSnia int i; 500bbfda8aSnia 510bbfda8aSnia /* Figure out how long our string would be */ 520bbfda8aSnia slen = strlen(sep); 530bbfda8aSnia tlen = 0; 540bbfda8aSnia i = -1; 550bbfda8aSnia while(ctopts[++i]) { 560bbfda8aSnia tlen += strlen(ctopts[i]); 570bbfda8aSnia if(i > 0) { 580bbfda8aSnia tlen += slen; 590bbfda8aSnia } 600bbfda8aSnia } 610bbfda8aSnia 620bbfda8aSnia /* Now make it */ 630bbfda8aSnia cto = malloc(tlen + 1); 640bbfda8aSnia *cto = '\0'; 650bbfda8aSnia i = -1; 660bbfda8aSnia while(ctopts[++i]) { 670bbfda8aSnia if(i > 0) { 680bbfda8aSnia strcat(cto, sep); 690bbfda8aSnia } 700bbfda8aSnia strcat(cto, ctopts[i]); 710bbfda8aSnia } 720bbfda8aSnia 730bbfda8aSnia return cto; 740bbfda8aSnia} 75