listing.c revision f46a6179
1f46a6179Smrg/* $Xorg: listing.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */ 2f46a6179Smrg/************************************************************ 3f46a6179Smrg Copyright 1996 by Silicon Graphics Computer Systems, Inc. 4f46a6179Smrg 5f46a6179Smrg Permission to use, copy, modify, and distribute this 6f46a6179Smrg software and its documentation for any purpose and without 7f46a6179Smrg fee is hereby granted, provided that the above copyright 8f46a6179Smrg notice appear in all copies and that both that copyright 9f46a6179Smrg notice and this permission notice appear in supporting 10f46a6179Smrg documentation, and that the name of Silicon Graphics not be 11f46a6179Smrg used in advertising or publicity pertaining to distribution 12f46a6179Smrg of the software without specific prior written permission. 13f46a6179Smrg Silicon Graphics makes no representation about the suitability 14f46a6179Smrg of this software for any purpose. It is provided "as is" 15f46a6179Smrg without any express or implied warranty. 16f46a6179Smrg 17f46a6179Smrg SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 18f46a6179Smrg SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 19f46a6179Smrg AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON 20f46a6179Smrg GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 21f46a6179Smrg DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 22f46a6179Smrg DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 23f46a6179Smrg OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH 24f46a6179Smrg THE USE OR PERFORMANCE OF THIS SOFTWARE. 25f46a6179Smrg 26f46a6179Smrg ********************************************************/ 27f46a6179Smrg/*********************************************************** 28f46a6179Smrg 29f46a6179SmrgCopyright 1988, 1998 The Open Group 30f46a6179Smrg 31f46a6179SmrgPermission to use, copy, modify, distribute, and sell this software and its 32f46a6179Smrgdocumentation for any purpose is hereby granted without fee, provided that 33f46a6179Smrgthe above copyright notice appear in all copies and that both that 34f46a6179Smrgcopyright notice and this permission notice appear in supporting 35f46a6179Smrgdocumentation. 36f46a6179Smrg 37f46a6179SmrgThe above copyright notice and this permission notice shall be included in 38f46a6179Smrgall copies or substantial portions of the Software. 39f46a6179Smrg 40f46a6179SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 41f46a6179SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 42f46a6179SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 43f46a6179SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 44f46a6179SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 45f46a6179SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 46f46a6179Smrg 47f46a6179SmrgExcept as contained in this notice, the name of The Open Group shall not be 48f46a6179Smrgused in advertising or otherwise to promote the sale, use or other dealings 49f46a6179Smrgin this Software without prior written authorization from The Open Group. 50f46a6179Smrg 51f46a6179Smrg 52f46a6179SmrgCopyright 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 53f46a6179Smrg 54f46a6179Smrg All Rights Reserved 55f46a6179Smrg 56f46a6179SmrgPermission to use, copy, modify, and distribute this software and its 57f46a6179Smrgdocumentation for any purpose and without fee is hereby granted, 58f46a6179Smrgprovided that the above copyright notice appear in all copies and that 59f46a6179Smrgboth that copyright notice and this permission notice appear in 60f46a6179Smrgsupporting documentation, and that the name of Digital not be 61f46a6179Smrgused in advertising or publicity pertaining to distribution of the 62f46a6179Smrgsoftware without specific, written prior permission. 63f46a6179Smrg 64f46a6179SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 65f46a6179SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 66f46a6179SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 67f46a6179SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 68f46a6179SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 69f46a6179SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 70f46a6179SmrgSOFTWARE. 71f46a6179Smrg 72f46a6179Smrg******************************************************************/ 73f46a6179Smrg/* $XFree86: xc/programs/xkbcomp/listing.c,v 3.9 2001/12/14 20:01:57 dawes Exp $ */ 74f46a6179Smrg 75f46a6179Smrg 76f46a6179Smrg#include <stdio.h> 77f46a6179Smrg#include <ctype.h> 78f46a6179Smrg#include <sys/types.h> 79f46a6179Smrg#include <sys/stat.h> 80f46a6179Smrg#include <X11/keysym.h> 81f46a6179Smrg 82f46a6179Smrg#if defined(sgi) 83f46a6179Smrg#include <malloc.h> 84f46a6179Smrg#endif 85f46a6179Smrg 86f46a6179Smrg#define DEBUG_VAR_NOT_LOCAL 87f46a6179Smrg#define DEBUG_VAR listingDebug 88f46a6179Smrg#include "xkbcomp.h" 89f46a6179Smrg#include <stdlib.h> 90f46a6179Smrg#ifndef X_NOT_POSIX 91f46a6179Smrg#ifdef _POSIX_SOURCE 92f46a6179Smrg#include <limits.h> 93f46a6179Smrg#else 94f46a6179Smrg#define _POSIX_SOURCE 95f46a6179Smrg#include <limits.h> 96f46a6179Smrg#undef _POSIX_SOURCE 97f46a6179Smrg#endif 98f46a6179Smrg#endif 99f46a6179Smrg#ifndef PATH_MAX 100f46a6179Smrg#ifdef WIN32 101f46a6179Smrg#define PATH_MAX 512 102f46a6179Smrg#else 103f46a6179Smrg#include <sys/param.h> 104f46a6179Smrg#endif 105f46a6179Smrg#ifndef PATH_MAX 106f46a6179Smrg#ifdef MAXPATHLEN 107f46a6179Smrg#define PATH_MAX MAXPATHLEN 108f46a6179Smrg#else 109f46a6179Smrg#define PATH_MAX 1024 110f46a6179Smrg#endif 111f46a6179Smrg#endif 112f46a6179Smrg#endif 113f46a6179Smrg 114f46a6179Smrg#ifdef WIN32 115f46a6179Smrg#include <windows.h> 116f46a6179Smrg#define FileName(file) file.cFileName 117f46a6179Smrg#undef TEXT 118f46a6179Smrg#undef ALTERNATE 119f46a6179Smrg#else 120f46a6179Smrg#define FileName(file) file->d_name 121f46a6179Smrg#ifndef X_NOT_POSIX 122f46a6179Smrg#include <dirent.h> 123f46a6179Smrg#else 124f46a6179Smrg#ifdef SYSV 125f46a6179Smrg#include <dirent.h> 126f46a6179Smrg#else 127f46a6179Smrg#ifdef USG 128f46a6179Smrg#include <dirent.h> 129f46a6179Smrg#else 130f46a6179Smrg#include <sys/dir.h> 131f46a6179Smrg#ifndef dirent 132f46a6179Smrg#define dirent direct 133f46a6179Smrg#endif 134f46a6179Smrg#endif 135f46a6179Smrg#endif 136f46a6179Smrg#endif 137f46a6179Smrg#endif 138f46a6179Smrg 139f46a6179Smrg#include "xkbpath.h" 140f46a6179Smrg#include "parseutils.h" 141f46a6179Smrg#include "misc.h" 142f46a6179Smrg#include "tokens.h" 143f46a6179Smrg#include <X11/extensions/XKBgeom.h> 144f46a6179Smrg 145f46a6179Smrg#define lowbit(x) ((x) & (-(x))) 146f46a6179Smrg 147f46a6179Smrgstatic int szListing= 0; 148f46a6179Smrgstatic int nListed= 0; 149f46a6179Smrgstatic int nFilesListed= 0; 150f46a6179Smrg 151f46a6179Smrgtypedef struct _Listing { 152f46a6179Smrg char * file; 153f46a6179Smrg char * map; 154f46a6179Smrg} Listing; 155f46a6179Smrg 156f46a6179Smrgstatic int szMapOnly; 157f46a6179Smrgstatic int nMapOnly; 158f46a6179Smrgstatic char ** mapOnly; 159f46a6179Smrg 160f46a6179Smrgstatic Listing * list= NULL; 161f46a6179Smrg 162f46a6179Smrg/***====================================================================***/ 163f46a6179Smrg 164f46a6179Smrgint 165f46a6179SmrgAddMapOnly(char *map) 166f46a6179Smrg{ 167f46a6179Smrg if (nMapOnly>=szMapOnly) { 168f46a6179Smrg if (szMapOnly<1) szMapOnly= 5; 169f46a6179Smrg else szMapOnly*= 2; 170f46a6179Smrg mapOnly= uTypedRealloc(list,szMapOnly,char *); 171f46a6179Smrg if (!mapOnly) { 172f46a6179Smrg WSGO("Couldn't allocate list of maps\n"); 173f46a6179Smrg return 0; 174f46a6179Smrg } 175f46a6179Smrg } 176f46a6179Smrg mapOnly[nMapOnly++]= map; 177f46a6179Smrg return 1; 178f46a6179Smrg} 179f46a6179Smrg 180f46a6179Smrgint 181f46a6179SmrgAddListing(char *file,char *map) 182f46a6179Smrg{ 183f46a6179Smrg if (nListed>=szListing) { 184f46a6179Smrg if (szListing<1) szListing= 10; 185f46a6179Smrg else szListing*= 2; 186f46a6179Smrg list= uTypedRealloc(list,szListing,Listing); 187f46a6179Smrg if (!list) { 188f46a6179Smrg WSGO("Couldn't allocate list of files and maps\n"); 189f46a6179Smrg ACTION("Exiting\n"); 190f46a6179Smrg exit(1); 191f46a6179Smrg } 192f46a6179Smrg } 193f46a6179Smrg 194f46a6179Smrg list[nListed].file= file; 195f46a6179Smrg list[nListed].map= map; 196f46a6179Smrg nListed++; 197f46a6179Smrg if (file!=NULL) 198f46a6179Smrg nFilesListed++; 199f46a6179Smrg return 1; 200f46a6179Smrg} 201f46a6179Smrg 202f46a6179Smrg/***====================================================================***/ 203f46a6179Smrg 204f46a6179Smrgstatic void 205f46a6179SmrgListFile(FILE *outFile,char *fileName,XkbFile *map) 206f46a6179Smrg{ 207f46a6179Smrgregister unsigned flags; 208f46a6179Smrgchar * mapName; 209f46a6179Smrg 210f46a6179Smrg flags= map->flags; 211f46a6179Smrg if ((flags&XkbLC_Hidden)&&(!(verboseLevel&WantHiddenMaps))) 212f46a6179Smrg return; 213f46a6179Smrg if ((flags&XkbLC_Partial)&&(!(verboseLevel&WantPartialMaps))) 214f46a6179Smrg return; 215f46a6179Smrg if (verboseLevel&WantLongListing) { 216f46a6179Smrg fprintf(outFile,(flags&XkbLC_Hidden)?"h":"-"); 217f46a6179Smrg fprintf(outFile,(flags&XkbLC_Default)?"d":"-"); 218f46a6179Smrg fprintf(outFile,(flags&XkbLC_Partial)?"p":"-"); 219f46a6179Smrg fprintf(outFile,"----- "); 220f46a6179Smrg if (map->type==XkmSymbolsIndex) { 221f46a6179Smrg fprintf(outFile,(flags&XkbLC_AlphanumericKeys)?"a":"-"); 222f46a6179Smrg fprintf(outFile,(flags&XkbLC_ModifierKeys)?"m":"-"); 223f46a6179Smrg fprintf(outFile,(flags&XkbLC_KeypadKeys)?"k":"-"); 224f46a6179Smrg fprintf(outFile,(flags&XkbLC_FunctionKeys)?"f":"-"); 225f46a6179Smrg fprintf(outFile,(flags&XkbLC_AlternateGroup)?"g":"-"); 226f46a6179Smrg fprintf(outFile,"--- "); 227f46a6179Smrg } 228f46a6179Smrg else fprintf(outFile,"-------- "); 229f46a6179Smrg } 230f46a6179Smrg mapName= map->name; 231f46a6179Smrg if ((!(verboseLevel&WantFullNames))&&((flags&XkbLC_Default)!=0)) 232f46a6179Smrg mapName= NULL; 233f46a6179Smrg if (dirsToStrip>0) { 234f46a6179Smrg char *tmp,*last; 235f46a6179Smrg int i; 236f46a6179Smrg for (i=0,tmp=last=fileName;(i<dirsToStrip)&&tmp;i++) { 237f46a6179Smrg last= tmp; 238f46a6179Smrg tmp= strchr(tmp,'/'); 239f46a6179Smrg if (tmp!=NULL) 240f46a6179Smrg tmp++; 241f46a6179Smrg } 242f46a6179Smrg fileName= (tmp?tmp:last); 243f46a6179Smrg } 244f46a6179Smrg if (mapName) 245f46a6179Smrg fprintf(outFile,"%s(%s)\n",fileName,mapName); 246f46a6179Smrg else fprintf(outFile,"%s\n",fileName); 247f46a6179Smrg return; 248f46a6179Smrg} 249f46a6179Smrg 250f46a6179Smrg/***====================================================================***/ 251f46a6179Smrg 252f46a6179Smrgstatic int 253f46a6179SmrgAddDirectory(char *head,char *ptrn,char *rest,char *map) 254f46a6179Smrg{ 255f46a6179Smrg#ifdef WIN32 256f46a6179Smrg HANDLE dirh; 257f46a6179Smrg WIN32_FIND_DATA file; 258f46a6179Smrg#else 259f46a6179Smrg DIR *dirp; 260f46a6179Smrg struct dirent *file; 261f46a6179Smrg#endif 262f46a6179Smrg int nMatch; 263f46a6179Smrg 264f46a6179Smrg if (map==NULL) { 265f46a6179Smrg char *tmp = ptrn; 266f46a6179Smrg if ((rest==NULL)&&(ptrn!=NULL)&&(strchr(ptrn,'/')==NULL)) { 267f46a6179Smrg tmp= ptrn; 268f46a6179Smrg map= strchr(ptrn,'('); 269f46a6179Smrg } 270f46a6179Smrg else if ((rest==NULL)&&(ptrn==NULL)&& 271f46a6179Smrg (head!=NULL)&&(strchr(head,'/')==NULL)) { 272f46a6179Smrg tmp= head; 273f46a6179Smrg map= strchr(head,'('); 274f46a6179Smrg } 275f46a6179Smrg if (map!=NULL) { 276f46a6179Smrg tmp= strchr(tmp,')'); 277f46a6179Smrg if ((tmp==NULL)||(tmp[1]!='\0')) { 278f46a6179Smrg ERROR1("File and map must have the format file(map)\n"); 279f46a6179Smrg return 0; 280f46a6179Smrg } 281f46a6179Smrg *map= '\0'; map++; 282f46a6179Smrg *tmp= '\0'; 283f46a6179Smrg } 284f46a6179Smrg } 285f46a6179Smrg#ifdef WIN32 286f46a6179Smrg if ((dirh = FindFirstFile("*.*", &file)) == INVALID_HANDLE_VALUE) 287f46a6179Smrg return 0; 288f46a6179Smrg#else 289f46a6179Smrg if ((dirp = opendir ((head?head:"."))) == NULL) 290f46a6179Smrg return 0; 291f46a6179Smrg nMatch= 0; 292f46a6179Smrg#endif 293f46a6179Smrg#ifdef WIN32 294f46a6179Smrg do 295f46a6179Smrg#else 296f46a6179Smrg while ((file = readdir (dirp)) != NULL) 297f46a6179Smrg#endif 298f46a6179Smrg { 299f46a6179Smrg char *tmp,*filename; 300f46a6179Smrg struct stat sbuf; 301f46a6179Smrg 302f46a6179Smrg filename= FileName(file); 303f46a6179Smrg if (!filename || filename[0]=='.') 304f46a6179Smrg continue; 305f46a6179Smrg if (ptrn && (!XkbNameMatchesPattern(filename,ptrn))) 306f46a6179Smrg continue; 307f46a6179Smrg tmp= (char *)uAlloc((head?strlen(head):0)+strlen(filename)+2); 308f46a6179Smrg if (!tmp) 309f46a6179Smrg continue; 310f46a6179Smrg sprintf(tmp,"%s%s%s",(head?head:""),(head?"/":""),filename); 311f46a6179Smrg if (stat(tmp,&sbuf)<0) { 312f46a6179Smrg uFree(tmp); 313f46a6179Smrg continue; 314f46a6179Smrg } 315f46a6179Smrg if (((rest!=NULL)&&(!S_ISDIR(sbuf.st_mode)))|| 316f46a6179Smrg ((map!=NULL)&&(S_ISDIR(sbuf.st_mode)))) { 317f46a6179Smrg uFree(tmp); 318f46a6179Smrg continue; 319f46a6179Smrg } 320f46a6179Smrg if (S_ISDIR(sbuf.st_mode)) { 321f46a6179Smrg if ((rest!=NULL)||(verboseLevel&ListRecursive)) 322f46a6179Smrg nMatch+= AddDirectory(tmp,rest,NULL,map); 323f46a6179Smrg } 324f46a6179Smrg else nMatch+= AddListing(tmp,map); 325f46a6179Smrg } 326f46a6179Smrg#ifdef WIN32 327f46a6179Smrg while (FindNextFile(dirh, &file)); 328f46a6179Smrg#endif 329f46a6179Smrg return nMatch; 330f46a6179Smrg} 331f46a6179Smrg 332f46a6179Smrg/***====================================================================***/ 333f46a6179Smrg 334f46a6179SmrgBool 335f46a6179SmrgAddMatchingFiles(char *head_in) 336f46a6179Smrg{ 337f46a6179Smrgchar *str,*head,*ptrn,*rest= NULL; 338f46a6179Smrg 339f46a6179Smrg if (head_in==NULL) 340f46a6179Smrg return 0; 341f46a6179Smrg ptrn= NULL; 342f46a6179Smrg for (str=head_in;(*str!='\0')&&(*str!='?')&&(*str!='*');str++) { 343f46a6179Smrg if ((str!=head_in)&&(*str=='/')) 344f46a6179Smrg ptrn= str; 345f46a6179Smrg } 346f46a6179Smrg if (*str=='\0') { /* no wildcards */ 347f46a6179Smrg head= head_in; 348f46a6179Smrg ptrn= NULL; 349f46a6179Smrg rest= NULL; 350f46a6179Smrg } 351f46a6179Smrg else if (ptrn==NULL) { /* no slash before the first wildcard */ 352f46a6179Smrg head= NULL; 353f46a6179Smrg ptrn= head_in; 354f46a6179Smrg } 355f46a6179Smrg else { /* slash followed by wildcard */ 356f46a6179Smrg head= head_in; 357f46a6179Smrg *ptrn= '\0'; ptrn++; 358f46a6179Smrg } 359f46a6179Smrg if (ptrn) { 360f46a6179Smrg rest= strchr(ptrn,'/'); 361f46a6179Smrg if (rest!=NULL) { 362f46a6179Smrg *rest= '\0'; 363f46a6179Smrg rest++; 364f46a6179Smrg } 365f46a6179Smrg } 366f46a6179Smrg if(((rest && ptrn)&&((strchr(ptrn,'(')!=NULL)||(strchr(ptrn,')')!=NULL)))|| 367f46a6179Smrg (head && ((strchr(head,'(')!=NULL)||(strchr(head,')')!=NULL)))) { 368f46a6179Smrg ERROR1("Files/maps to list must have the form file(map)\n"); 369f46a6179Smrg ACTION("Illegal specifier ignored\n"); 370f46a6179Smrg return 0; 371f46a6179Smrg } 372f46a6179Smrg return AddDirectory(head,ptrn,rest,NULL); 373f46a6179Smrg} 374f46a6179Smrg 375f46a6179Smrg/***====================================================================***/ 376f46a6179Smrg 377f46a6179Smrgstatic Bool 378f46a6179SmrgMapMatches(char *mapToConsider, char *ptrn) 379f46a6179Smrg{ 380f46a6179Smrgint i; 381f46a6179Smrg 382f46a6179Smrg if (ptrn!=NULL) 383f46a6179Smrg return XkbNameMatchesPattern(mapToConsider,ptrn); 384f46a6179Smrg if (nMapOnly<1) 385f46a6179Smrg return True; 386f46a6179Smrg for (i=0;i<nMapOnly;i++) { 387f46a6179Smrg if (XkbNameMatchesPattern(mapToConsider,mapOnly[i])) 388f46a6179Smrg return True; 389f46a6179Smrg } 390f46a6179Smrg return False; 391f46a6179Smrg} 392f46a6179Smrg 393f46a6179Smrgint 394f46a6179SmrgGenerateListing(char *out_name) 395f46a6179Smrg{ 396f46a6179Smrgint i; 397f46a6179SmrgFILE * inputFile,*outFile; 398f46a6179SmrgXkbFile * rtrn,*mapToUse; 399f46a6179Smrgunsigned oldWarningLevel; 400f46a6179Smrgchar * mapName; 401f46a6179Smrg 402f46a6179Smrg if (nFilesListed<1) { 403f46a6179Smrg ERROR1("Must specify at least one file or pattern to list\n"); 404f46a6179Smrg return 0; 405f46a6179Smrg } 406f46a6179Smrg if ((!out_name)||((out_name[0]=='-')&&(out_name[1]=='\0'))) 407f46a6179Smrg outFile= stdout; 408f46a6179Smrg else if ((outFile=fopen(out_name,"w"))==NULL) { 409f46a6179Smrg ERROR1("Cannot open \"%s\" to write keyboard description\n",out_name); 410f46a6179Smrg ACTION("Exiting\n"); 411f46a6179Smrg return 0; 412f46a6179Smrg } 413f46a6179Smrg#ifdef DEBUG 414f46a6179Smrg if (warningLevel>9) 415f46a6179Smrg fprintf(stderr,"should list:\n"); 416f46a6179Smrg#endif 417f46a6179Smrg for (i=0;i<nListed;i++) { 418f46a6179Smrg#ifdef DEBUG 419f46a6179Smrg if (warningLevel>9) { 420f46a6179Smrg fprintf(stderr,"%s(%s)\n",(list[i].file?list[i].file:"*"), 421f46a6179Smrg (list[i].map?list[i].map:"*")); 422f46a6179Smrg } 423f46a6179Smrg#endif 424f46a6179Smrg oldWarningLevel= warningLevel; 425f46a6179Smrg warningLevel= 0; 426f46a6179Smrg if (list[i].file) { 427f46a6179Smrg struct stat sbuf; 428f46a6179Smrg 429f46a6179Smrg if (stat(list[i].file,&sbuf)<0) { 430f46a6179Smrg if (oldWarningLevel>5) 431f46a6179Smrg WARN1("Couldn't open \"%s\"\n",list[i].file); 432f46a6179Smrg continue; 433f46a6179Smrg } 434f46a6179Smrg if (S_ISDIR(sbuf.st_mode)) { 435f46a6179Smrg if (verboseLevel&ListRecursive) 436f46a6179Smrg AddDirectory(list[i].file,NULL,NULL,NULL); 437f46a6179Smrg continue; 438f46a6179Smrg } 439f46a6179Smrg 440f46a6179Smrg inputFile= fopen(list[i].file,"r"); 441f46a6179Smrg if (!inputFile) { 442f46a6179Smrg if (oldWarningLevel>5) 443f46a6179Smrg WARN1("Couldn't open \"%s\"\n",list[i].file); 444f46a6179Smrg continue; 445f46a6179Smrg } 446f46a6179Smrg setScanState(list[i].file, 1); 447f46a6179Smrg if (XKBParseFile(inputFile,&rtrn)&&(rtrn!=NULL)) { 448f46a6179Smrg mapName= list[i].map; 449f46a6179Smrg mapToUse= rtrn; 450f46a6179Smrg for (;mapToUse;mapToUse= (XkbFile *)mapToUse->common.next) { 451f46a6179Smrg if (!MapMatches(mapToUse->name,mapName)) 452f46a6179Smrg continue; 453f46a6179Smrg ListFile(outFile,list[i].file,mapToUse); 454f46a6179Smrg } 455f46a6179Smrg } 456f46a6179Smrg fclose(inputFile); 457f46a6179Smrg } 458f46a6179Smrg warningLevel= oldWarningLevel; 459f46a6179Smrg } 460f46a6179Smrg return 1; 461f46a6179Smrg} 462f46a6179Smrg 463