1a4e54154Smrg/* 2a4e54154Smrg * fontconfig/test/test-issue180.c 3a4e54154Smrg * 4a4e54154Smrg * Copyright © 2000 Keith Packard 5a4e54154Smrg * 6a4e54154Smrg * Permission to use, copy, modify, distribute, and sell this software and its 7a4e54154Smrg * documentation for any purpose is hereby granted without fee, provided that 8a4e54154Smrg * the above copyright notice appear in all copies and that both that 9a4e54154Smrg * copyright notice and this permission notice appear in supporting 10a4e54154Smrg * documentation, and that the name of the author(s) not be used in 11a4e54154Smrg * advertising or publicity pertaining to distribution of the software without 12a4e54154Smrg * specific, written prior permission. The authors make no 13a4e54154Smrg * representations about the suitability of this software for any purpose. It 14a4e54154Smrg * is provided "as is" without express or implied warranty. 15a4e54154Smrg * 16a4e54154Smrg * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 17a4e54154Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 18a4e54154Smrg * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR 19a4e54154Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 20a4e54154Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 21a4e54154Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 22a4e54154Smrg * PERFORMANCE OF THIS SOFTWARE. 23a4e54154Smrg */ 24a4e54154Smrg#include <stdio.h> 25a4e54154Smrg#include <stdlib.h> 26a4e54154Smrg#include <fontconfig/fontconfig.h> 27a4e54154Smrg 28a4e54154Smrgint 29a4e54154Smrgmain (void) 30a4e54154Smrg{ 31a4e54154Smrg const FcChar8 *doc = (const FcChar8 *) "" 32a4e54154Smrg "<fontconfig>\n" 33a4e54154Smrg " <cachedir></cachedir>\n" 34a4e54154Smrg "</fontconfig>\n" 35a4e54154Smrg ""; 36a4e54154Smrg const FcChar8 *doc2 = (const FcChar8 *) "" 37a4e54154Smrg "<fontconfig>\n" 38a4e54154Smrg " <cachedir prefix=\"xdg\"></cachedir>\n" 39a4e54154Smrg "</fontconfig>\n" 40a4e54154Smrg ""; 41a4e54154Smrg FcConfig *cfg = FcConfigCreate (); 42a4e54154Smrg FcStrList *l; 43a4e54154Smrg FcChar8 *p; 44a4e54154Smrg 45a4e54154Smrg if (!FcConfigParseAndLoadFromMemory (cfg, doc, FcTrue)) 46a4e54154Smrg { 47a4e54154Smrg fprintf (stderr, "Unable to load a config from memory.\n"); 48a4e54154Smrg return 1; 49a4e54154Smrg } 50a4e54154Smrg l = FcConfigGetCacheDirs (cfg); 51a4e54154Smrg if ((p = FcStrListNext (l)) != NULL) 52a4e54154Smrg { 53a4e54154Smrg fprintf (stderr, "There was one or more cachedirs\n"); 54a4e54154Smrg return 1; 55a4e54154Smrg } 56a4e54154Smrg FcStrListDone (l); 57a4e54154Smrg FcConfigDestroy (cfg); 58a4e54154Smrg 59a4e54154Smrg cfg = FcConfigCreate (); 60a4e54154Smrg if (!FcConfigParseAndLoadFromMemory (cfg, doc2, FcTrue)) 61a4e54154Smrg { 62a4e54154Smrg fprintf (stderr, "Unable to load a config from memory (with prefix).\n"); 63a4e54154Smrg return 1; 64a4e54154Smrg } 65a4e54154Smrg l = FcConfigGetCacheDirs (cfg); 66a4e54154Smrg if ((p = FcStrListNext (l)) != NULL) 67a4e54154Smrg { 68a4e54154Smrg fprintf (stderr, "There was one or more cachedirs (with prefix)\n"); 69a4e54154Smrg return 1; 70a4e54154Smrg } 71a4e54154Smrg FcStrListDone (l); 72a4e54154Smrg FcConfigDestroy (cfg); 73a4e54154Smrg 74a4e54154Smrg return 0; 75a4e54154Smrg} 76