//-------------------------------------------------------------- CC_Boolean CC_Tokenizer::operator()() { if ( !touched ) { current_ptr = _XStrtok(str_, " \t\n", strtok_buf); touched = TRUE; } else { current_ptr = _XStrtok(NULL, " \t\n", strtok_buf); } return ( current_ptr != NULL ); }
/****************************************************************************** * * _DtEnvMapIt() * * Fill out a map cache for a single environment variable. */ static void _DtEnvMapIt( char *envVar, cachedEnvVar *envVarCache, char *targetHost) { char *separator, *tmpPtr, *tmpPtr2, swapout, *netpath; char *prePend, *postPend, *newPrePend; char **pathList; int availPathListSize, pathListCount, availEnvStrSize, len, tmpi, i; int considerMapping; _Xstrtokparams strtok_buf; /* * Information Layout: * * localEnvVarPtr = ptr to original "PATH=/users/foo:/users/bar" * localEnvVarCopy = copy of original "/users/foo:/users/bar" * mappedEnvVarPtr = mapped "PATH=/nfs/.../users/foo:/nfs/.../users/bar" */ if ( (envVarCache->localEnvVarPtr = getenv( envVar )) ) { envVarCache->localEnvVarCopy = strdup( envVarCache->localEnvVarPtr ); /* sneak back past "NAME=" portion. */ envVarCache->localEnvVarPtr -= strlen( envVar ) + 1; } else { /* * Nothing to map. Punt. */ envVarCache->localEnvVarCopy = (char *) NULL; envVarCache->localEnvVarPtr = (char *) NULL; return; } #ifdef _DTENV_SUPPORT_COMMA_SEPARATED /* * Pick between colon-separated and comma-separated host-qualified * mapping code. */ if ( !strcmp(envVar, "DTDATABASESEARCHPATH") ) { /* * comma-separated and host-qualified mapping. */ separator = ","; } else { /* * colon-separated mapping. */ separator = ":"; } #else separator = ":"; #endif /* _DTENV_SUPPORT_COMMA_SEPARATED */ /* * Break path list into elements */ availPathListSize = MALLOC_BUMP_SIZE; pathListCount = 0; pathList = (char **) malloc( sizeof(char *) * availPathListSize ); /* * Break up path list into an array of path elements. */ tmpPtr = strdup( envVarCache->localEnvVarCopy ); /* work copy */ while (1) { if (!pathListCount) tmpPtr2 = _XStrtok( tmpPtr, separator, strtok_buf ); else tmpPtr2 = _XStrtok( (char *) NULL, separator, strtok_buf ); if (tmpPtr2) { pathListCount++; if (pathListCount > availPathListSize) { availPathListSize += MALLOC_BUMP_SIZE; pathList = (char **) realloc( (char *) pathList, sizeof(char *) * availPathListSize ); } pathList[pathListCount-1] = strdup( tmpPtr2 ); } else { break; } } free( tmpPtr ); /* * Setup new "NAME=....." string. */ availEnvStrSize = strlen( envVar ) + 64; envVarCache->mappedEnvVarPtr = (char *) calloc( availEnvStrSize, sizeof(char) ); strcpy( envVarCache->mappedEnvVarPtr, envVar ); strcat( envVarCache->mappedEnvVarPtr, "=" ); /* * Start mapping each path element. */ for ( i = 0; i < pathListCount; i++ ) { prePend = pathList[i]; postPend = (char *) NULL; newPrePend = (char *) NULL; /* * Assume we need to map this path element. */ considerMapping = 1; #ifdef _DTENV_SUPPORT_COMMA_SEPARATED if ( !strcmp( separator, "," ) ) { if ( DtStrchr(prePend, ':' ) ) { /* * Host qualified elements in a comma separated list * will NOT be mapped. */ considerMapping = 0; } } #endif /* _DTENV_SUPPORT_COMMA_SEPARATED */ if (considerMapping) { /* * Tear apart and check for so called substitution characters. */ if (( tmpPtr = DtStrchr(prePend, '%') )) { /* * Temporarly shorten path up to substitution character. */ swapout = *tmpPtr; *tmpPtr = '\0'; /* * Move the dividing point back to a directory element. */ tmpPtr2 = DtStrrchr( prePend, '/' ); /* * Restore the send half of the string. */ *tmpPtr = swapout; if (tmpPtr2) { /* * Can do a split around the "/". * * Will have "<prePath>/" and "/<postPath>". */ postPend = strdup( tmpPtr2 ); *(tmpPtr2 + mblen(tmpPtr2, MB_CUR_MAX)) = '\0'; } } #ifdef DTENV_PERF_HOOK { int tpi; extern unsigned long stopwatch_tt_file_netfile; extern int stopwatch_repeat_rate; struct timeval start, stop; struct timezone junk; gettimeofday( &start, &junk ); for ( tpi = 0; tpi < stopwatch_repeat_rate-1; tpi++ ) { netpath = _DtEnv_tt_file_netfile( prePend ); if ( tt_ptr_error(netpath) == TT_OK ) ttfreeAndNull( netpath ); } netpath = _DtEnv_tt_file_netfile( prePend ); gettimeofday( &stop, &junk ); if (start.tv_usec > stop.tv_usec) { stop.tv_usec += 1000000; stop.tv_sec--; } stopwatch_tt_file_netfile += (stop.tv_usec - start.tv_usec); stopwatch_tt_file_netfile += (stop.tv_sec - start.tv_sec) * 1000000; } #else netpath = _DtEnv_tt_file_netfile( prePend ); #endif /* DTENV_PERF_HOOK */ if ( tt_ptr_error(netpath) != TT_OK ) { newPrePend = (char *) NULL; } else { #ifdef DTENV_PERF_HOOK { int tpi; extern unsigned long stopwatch_tt_netfile_file; extern int stopwatch_repeat_rate; struct timeval start, stop; struct timezone junk; gettimeofday( &start, &junk ); for ( tpi = 0; tpi < stopwatch_repeat_rate-1; tpi++ ) { newPrePend = _DtEnv_tt_host_netfile_file (targetHost, netpath); if ( tt_ptr_error(newPrePend) == TT_OK ) ttfreeAndNull( newPrePend ); } newPrePend = _DtEnv_tt_host_netfile_file (targetHost, netpath); gettimeofday( &stop, &junk ); if (start.tv_usec > stop.tv_usec) { stop.tv_usec += 1000000; stop.tv_sec--; } stopwatch_tt_netfile_file += (stop.tv_usec - start.tv_usec); stopwatch_tt_netfile_file += (stop.tv_sec - start.tv_sec) * 1000000; } #else newPrePend = _DtEnv_tt_host_netfile_file (targetHost, netpath); #endif /* DTENV_PERF_HOOK */ if ( tt_ptr_error(newPrePend) != TT_OK ) { newPrePend = (char *) NULL; } ttfreeAndNull( netpath ); } } /* * Calculate length of the new path element to the new path list. */ tmpi = strlen(envVarCache->mappedEnvVarPtr)+1; /* current list + ... */ if ( i != 0 ) tmpi += 1; /* separator */ if (newPrePend) tmpi += strlen(newPrePend); /* new prePend or ... */ else tmpi += strlen(prePend); /* ... old prePend */ if (postPend) tmpi += strlen(postPend); /* new postPend */ if ( tmpi > availEnvStrSize ) { /* * Grow new mappedEnvVar space. */ availEnvStrSize = tmpi + 64; envVarCache->mappedEnvVarPtr = (char *) realloc( (char *) envVarCache->mappedEnvVarPtr, availEnvStrSize ); } /* * Add the new path element. */ if ( i != 0 ) strcat( envVarCache->mappedEnvVarPtr, separator ); if (newPrePend) strcat( envVarCache->mappedEnvVarPtr, newPrePend ); else strcat( envVarCache->mappedEnvVarPtr, prePend ); if (postPend) strcat( envVarCache->mappedEnvVarPtr, postPend ); freeAndNull( prePend ); /* aka pathList[i] */ ttfreeAndNull( newPrePend ); freeAndNull( postPend ); } freeAndNull( pathList ); }
void hc_decode ( UCHAR *bitstring, /* input: compressed data */ UCHAR *charbuf, /* output: uncompressed data */ int charcount, /* input: length uncompressed data */ time_t encode_id) { /* input: compression table to use */ #ifdef DEBUG_DECODE static int first_time = TRUE; #endif register int bitreg; int i; int bitcount; int tree_index; TREENODE *tree_addr; #ifdef EXTERNAL_TREE char *ptr; char *hdecode_filebuf; FILE *hdecode_file; _Xstrtokparams strtok_buf; #endif #ifdef EXTERNAL_TREE /* Create hctree from external file? */ if (hctree == NULL) { if ((hdecode_filebuf = malloc (HDEC_FBUFSZ)) == NULL) { fprintf (aa_stderr, catgets(dtsearch_catd, MS_huff, 10, "%s Out of Memory.\n"), PROGNAME"076"); DtSearchExit (2); } if ((hdecode_file = fopen (hctree_name, "r")) == NULL) { fprintf (aa_stderr, catgets(dtsearch_catd, MS_huff, 11, "%s Cannot open tree file '%s': %s\n"), PROGNAME"082", hctree_name, strerror (errno)); DtSearchExit (2); } /* read first few lines to load global variables */ for (i = 0; i < 3; i++) fgets (hdecode_filebuf, HDEC_FBUFSZ, hdecode_file); ptr = strchr (hdecode_filebuf, '='); hctree_id = atol (ptr + 1); fgets (hdecode_filebuf, HDEC_FBUFSZ, hdecode_file); ptr = strchr (hdecode_filebuf, '='); hctree_root = atoi (ptr + 1); fgets (hdecode_filebuf, HDEC_FBUFSZ, hdecode_file); /* throwaway */ /* allocate space for the hctree and read in the values */ if ((hctree = (int *) malloc ( sizeof (int) * 2 * (hctree_root + 2))) == NULL) { fprintf (aa_stderr, "\n" PROGNAME "100 Out of Memory.\7\n"); DtSearchExit (2); } for (i = 0; i <= hctree_root; i++) { if ((fgets (hdecode_filebuf, HDEC_FBUFSZ, hdecode_file)) == NULL) { fprintf (aa_stderr, catgets(dtsearch_catd, MS_huff, 12, "%s Invalid format hctree '%s'.\n"), PROGNAME"106", hctree_name); DtSearchExit (2); } hctree[2 * i] = atoi (_XStrtok (hdecode_filebuf, " \t,", strtok_buf)); hctree[2 * i + 1] = atoi (_XStrtok (NULL, " \t,", strtok_buf)); } free (hdecode_filebuf); fclose (hdecode_file); } /* endif where hctree created from external file */ #endif /* for EXTERNAL_TREE */ #ifdef DEBUG_DECODE if (first_time) { first_time = FALSE; printf ("\n***** created hctree from '%s' ******\n" "hctree_id = %ld\nhctree_root = %d\n", hctree_name, hctree_id, hctree_root); } #endif if (encode_id != hctree_id) { fprintf (aa_stderr, catgets(dtsearch_catd, MS_huff, 13, "%s Incompatible hctree_ids.\n"), PROGNAME"118"); DtSearchExit (2); } tree_addr = (TREENODE *) hctree; bitcount = 0; while (charcount-- > 0) { /****** MAIN OUTPUT CHARACTER LOOP ******/ tree_index = hctree_root; while (tree_index >= 0) { /****** TREE TRAVERSAL LOOP ******/ /* retrieve next bit */ if (bitcount <= 0) { /* read next input char? */ bitcount = 8; bitreg = *bitstring++; } bitreg <<= 1; bitcount--; if (bitreg & 0x0100) tree_index = tree_addr[tree_index].branch1; else tree_index = tree_addr[tree_index].branch0; } /* end tree traversal loop */ /******** DECODE CHARACTER ********/ /* if literal code, retrieve next 8 bits as char itself */ if ((tree_index += 257) == 256) { tree_index = 0; for (i = 8; i > 0; i--) { if (bitcount <= 0) { /* read next input char? */ bitcount = 8; bitreg = *bitstring++; } bitreg <<= 1; bitcount--; tree_index <<= 1; if (bitreg & 0x0100) tree_index |= 1; } /* end 8-bit for loop */ } /* endif to process literal coding */ *charbuf = tree_index; charbuf++; } /* end main output character loop */ return; } /* end of function hc_decode */
static Bool CheckLine( InputLine * line, RemapSpec * remap, XkbRF_RulePtr rule, XkbRF_GroupPtr group) { char * str,*tok; register int nread, i; FileSpec tmp; _Xstrtokparams strtok_buf; Bool append = FALSE; if (line->line[0]=='!') { if (line->line[1] == '$' || (line->line[1] == ' ' && line->line[2] == '$')) { char *gname = strchr(line->line, '$'); char *words = strchr(gname, ' '); if(!words) return FALSE; *words++ = '\0'; for (; *words; words++) { if (*words != '=' && *words != ' ') break; } if (*words == '\0') return FALSE; group->name = _XkbDupString(gname); group->words = _XkbDupString(words); for (i = 1, words = group->words; *words; words++) { if ( *words == ' ') { *words++ = '\0'; i++; } } group->number = i; return TRUE; } else { SetUpRemap(line,remap); return FALSE; } } if (remap->num_remap==0) { DebugF("Must have a mapping before first line of data\n"); DebugF("Illegal line of data ignored\n"); return FALSE; } bzero((char *)&tmp,sizeof(FileSpec)); str= line->line; for (nread= 0;(tok=_XStrtok(str," ",strtok_buf))!=NULL;nread++) { str= NULL; if (strcmp(tok,"=")==0) { nread--; continue; } if (nread>remap->num_remap) { DebugF("Too many words on a line\n"); DebugF("Extra word \"%s\" ignored\n",tok); continue; } tmp.name[remap->remap[nread].word]= tok; if (*tok == '+' || *tok == '|') append = TRUE; } if (nread<remap->num_remap) { DebugF("Too few words on a line: %s\n", line->line); DebugF("line ignored\n"); return FALSE; } rule->flags= 0; rule->number = remap->number; if (tmp.name[OPTION]) rule->flags|= XkbRF_Option; else if (append) rule->flags|= XkbRF_Append; else rule->flags|= XkbRF_Normal; rule->model= _XkbDupString(tmp.name[MODEL]); rule->layout= _XkbDupString(tmp.name[LAYOUT]); rule->variant= _XkbDupString(tmp.name[VARIANT]); rule->option= _XkbDupString(tmp.name[OPTION]); rule->keycodes= _XkbDupString(tmp.name[KEYCODES]); rule->symbols= _XkbDupString(tmp.name[SYMBOLS]); rule->types= _XkbDupString(tmp.name[TYPES]); rule->compat= _XkbDupString(tmp.name[COMPAT]); rule->geometry= _XkbDupString(tmp.name[GEOMETRY]); rule->layout_num = rule->variant_num = 0; for (i = 0; i < nread; i++) { if (remap->remap[i].index) { if (remap->remap[i].word == LAYOUT) rule->layout_num = remap->remap[i].index; if (remap->remap[i].word == VARIANT) rule->variant_num = remap->remap[i].index; } } return TRUE; }
static void SetUpRemap(InputLine *line,RemapSpec *remap) { char * tok,*str; unsigned present, l_ndx_present, v_ndx_present; register int i; int len, ndx; _Xstrtokparams strtok_buf; Bool found; l_ndx_present = v_ndx_present = present= 0; str= &line->line[1]; len = remap->number; bzero((char *)remap,sizeof(RemapSpec)); remap->number = len; while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) { found= FALSE; str= NULL; if (strcmp(tok,"=")==0) continue; for (i=0;i<MAX_WORDS;i++) { len = strlen(cname[i]); if (strncmp(cname[i],tok,len)==0) { if(strlen(tok) > len) { char *end = get_index(tok+len, &ndx); if ((i != LAYOUT && i != VARIANT) || *end != '\0' || ndx == -1) break; if (ndx < 1 || ndx > XkbNumKbdGroups) { DebugF("Illegal %s index: %d\n", cname[i], ndx); DebugF("Index must be in range 1..%d\n", XkbNumKbdGroups); break; } } else { ndx = 0; } found= TRUE; if (present&(1<<i)) { if ((i == LAYOUT && l_ndx_present&(1<<ndx)) || (i == VARIANT && v_ndx_present&(1<<ndx)) ) { DebugF("Component \"%s\" listed twice\n",tok); DebugF("Second definition ignored\n"); break; } } present |= (1<<i); if (i == LAYOUT) l_ndx_present |= 1 << ndx; if (i == VARIANT) v_ndx_present |= 1 << ndx; remap->remap[remap->num_remap].word= i; remap->remap[remap->num_remap++].index= ndx; break; } } if (!found) { fprintf(stderr,"Unknown component \"%s\" ignored\n",tok); } } if ((present&PART_MASK)==0) { unsigned mask= PART_MASK; ErrorF("Mapping needs at least one of "); for (i=0; (i<MAX_WORDS); i++) { if ((1L<<i)&mask) { mask&= ~(1L<<i); if (mask) DebugF("\"%s,\" ",cname[i]); else DebugF("or \"%s\"\n",cname[i]); } } DebugF("Illegal mapping ignored\n"); remap->num_remap= 0; return; } if ((present&COMPONENT_MASK)==0) { DebugF("Mapping needs at least one component\n"); DebugF("Illegal mapping ignored\n"); remap->num_remap= 0; return; } remap->number++; return; }
void gen_vec (char *fname_huffcode_tab) { char temp[40]; int i, j; char tab_filebuf[128]; unsigned char ch; FILE *tab_stream; _Xstrtokparams strtok_buf; if ((tab_stream = fopen (fname_huffcode_tab, "r")) == NULL) { printf (catgets(dtsearch_catd, MS_huff, 1, "%s: Cannot open huffman encode file '%s':\n" " %s\n Exit Code = 2\n"), PROGNAME"222", fname_huffcode_tab, strerror (errno)); DtSearchExit (2); } memset (huff_code, 0, sizeof(huff_code)); memset (code_length, 0, sizeof(code_length)); /* * First line in the file contains time stamp. We have to read * it separately. First token on first line is hufid. Save it * in a global for optional use by caller. */ fgets (tab_filebuf, sizeof (tab_filebuf) - 1, tab_stream); gen_vec_hufid = atol (tab_filebuf); /*-------------- READ IN HUFFMAN FILE ------------*/ /* * We are only interested in the character itself (index) and * its Huffman Code */ while (fgets (tab_filebuf, sizeof (tab_filebuf) - 1, tab_stream) != NULL) { i = atoi (_XStrtok (tab_filebuf, DELIMITERS, strtok_buf)); /* char */ /* read current huff code */ strcpy (temp, _XStrtok (NULL, DELIMITERS, strtok_buf)); if (temp[0] == ' ') { /* Empty huffcode associated with LITERAL CODE. * Either this is literal char itself and literal * encodeing has been turned off, or this char is * so rare that it is coded using the literal char. */ if (i == 256) continue; /* current character has LITERAL CODE */ strcpy (temp, huff_code[LITERAL_NUM]); *(code_length + i) = *(code_length + LITERAL_NUM) + 8; ch = (unsigned char) i; for (j = 0; j < 8; j++) { if (ch & 0x80) { temp[*(code_length + LITERAL_NUM) + j] = '1'; } else { temp[*(code_length + LITERAL_NUM) + j] = '0'; } ch = ch << 1; } temp[*(code_length + LITERAL_NUM) + 8] = '\0'; huff_code[i] = (char *) malloc (*(code_length + i) + 1); strcpy (huff_code[i], temp); } else { /* regular HUFFMAN code */ *(code_length + i) = strlen (temp); huff_code[i] = (char *) malloc (*(code_length + i) + 1); strcpy (huff_code[i], temp); } } fclose (tab_stream); } /* end of function gen_vec */
/* Converts OBJDATESTR formatted string as found in .fzk files * to DtSrObjdate long integer if string is valid. * Returns TRUE if passed string is correctly formatted * and conversion successful. Returns FALSE and * does not alter passed objdate if string is not valid. * String format is: "yy/mm/dd~hh:mm[\n]" (see OBJDATESTR in SearchP.h). * The slashes and tilde are mandatory, the final \n is optional. * Each field maps to an objdate bitfield; bitfields map * to struct tm fields (see fuzzy.h). * Can be used merely to test for valid string format by * passing NULL for objdate pointer. */ int is_objdatestr (char *string, DtSrObjdate *objdptr) { static char parsebuf[24]; int i; char *token; DtSrObjdate myobjdate = 0L; _Xstrtokparams strtok_buf; /* Test for "null" objdate (which is valid) */ if (strncmp (string, NULLDATESTR, 9) == 0) { if (string[9] == 0 || string[9] == '\n') { if (objdptr) *objdptr = 0L; return TRUE; } } strncpy (parsebuf, string, sizeof (parsebuf)); parsebuf[sizeof (parsebuf) - 1] = '\0'; if ((token = _XStrtok(parsebuf, "/", strtok_buf)) == NULL) return FALSE; i = atoi (token); if (i < 1 || i > 4095) /* yy */ return FALSE; else myobjdate |= (i << 20); if ((token = _XStrtok(NULL, "/", strtok_buf)) == NULL) return FALSE; i = atoi (token); if (i < 1 || i > 12) /* mm */ return FALSE; else myobjdate |= (--i << 16); if ((token = _XStrtok(NULL, "~", strtok_buf)) == NULL) return FALSE; i = atoi (token); if (i < 1 || i > 31) /* dd */ return FALSE; else myobjdate |= (i << 11); if ((token = _XStrtok(NULL, ":", strtok_buf)) == NULL) return FALSE; i = atoi (token); if (i < 0 || i > 23) /* hh */ return FALSE; else myobjdate |= (i << 6); if ((token = _XStrtok(NULL, "\n", strtok_buf)) == NULL) return FALSE; i = atoi (token); if (i < 0 || i > 59) /* mm */ return FALSE; else myobjdate |= i; if (objdptr) *objdptr = myobjdate; return TRUE; } /* is_objdatestr() */
static void SetUpRemap(InputLine *line,RemapSpec *remap) { char * tok,*str; unsigned present, l_ndx_present, v_ndx_present; register int i; int len, ndx; _Xstrtokparams strtok_buf; #ifdef DEBUG Bool found; #endif l_ndx_present = v_ndx_present = present= 0; str= &line->line[1]; len = remap->number; bzero((char *)remap,sizeof(RemapSpec)); remap->number = len; while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) { #ifdef DEBUG found= False; #endif str= NULL; if (strcmp(tok,"=")==0) continue; for (i=0;i<MAX_WORDS;i++) { len = strlen(cname[i]); if (strncmp(cname[i],tok,len)==0) { if(strlen(tok) > len) { char *end = get_index(tok+len, &ndx); if ((i != LAYOUT && i != VARIANT) || *end != '\0' || ndx == -1) break; if (ndx < 1 || ndx > XkbNumKbdGroups) { PR_DEBUG2("Illegal %s index: %d\n", cname[i], ndx); PR_DEBUG1("Index must be in range 1..%d\n", XkbNumKbdGroups); break; } } else { ndx = 0; } #ifdef DEBUG found= True; #endif if (present&(1<<i)) { if ((i == LAYOUT && l_ndx_present&(1<<ndx)) || (i == VARIANT && v_ndx_present&(1<<ndx)) ) { PR_DEBUG1("Component \"%s\" listed twice\n",tok); PR_DEBUG("Second definition ignored\n"); break; } } present |= (1<<i); if (i == LAYOUT) l_ndx_present |= 1 << ndx; if (i == VARIANT) v_ndx_present |= 1 << ndx; remap->remap[remap->num_remap].word= i; remap->remap[remap->num_remap++].index= ndx; break; } } #ifdef DEBUG if (!found) { fprintf(stderr,"Unknown component \"%s\" ignored\n",tok); } #endif } if ((present&PART_MASK)==0) { #ifdef DEBUG unsigned mask= PART_MASK; fprintf(stderr,"Mapping needs at least one of "); for (i=0; (i<MAX_WORDS); i++) { if ((1L<<i)&mask) { mask&= ~(1L<<i); if (mask) fprintf(stderr,"\"%s,\" ",cname[i]); else fprintf(stderr,"or \"%s\"\n",cname[i]); } } fprintf(stderr,"Illegal mapping ignored\n"); #endif remap->num_remap= 0; return; } if ((present&COMPONENT_MASK)==0) { PR_DEBUG("Mapping needs at least one component\n"); PR_DEBUG("Illegal mapping ignored\n"); remap->num_remap= 0; return; } if (((present&PART_MASK)&(1<<OPTION))&& ((present&PART_MASK)!=(1<<OPTION))) { PR_DEBUG("Options cannot appear with other parts\n"); PR_DEBUG("Illegal mapping ignored\n"); remap->num_remap= 0; return; } if (((present&COMPONENT_MASK)&(1<<KEYMAP))&& ((present&COMPONENT_MASK)!=(1<<KEYMAP))) { PR_DEBUG("Keymap cannot appear with other components\n"); PR_DEBUG("Illegal mapping ignored\n"); remap->num_remap= 0; return; } remap->number++; return; }