unsigned char *_nl_normalize_codeset( unsigned char *codeset, size_t name_len ) { int ecx; int edx; int dh; int len; int only_digit; unsigned char *wp; size_t cnt; if ( name_len ) { only_digit = 1; len = 0; cnt = 0; codeset[0] = codeset[0]; do { cnt++; } while ( cnt + 1 < name_len ); if ( malloc( len + 1 + 1 ) ) { wp[0] = malloc( len + 1 + 1 ); if ( only_digit ) { *(int*)(malloc( len )) = 0x6f7369; wp[0] = wp[3]; } if ( name_len ) { cnt = 0; do { if ( ( *(char*)(*(int*)(__ctype_b_loc( )) + ( *(char*)(codeset[0] + cnt) * 2 ) + 1) & 4 ) & 255 ) { wp[0] = c_tolower( *(char*)(codeset[0] + cnt) ); wp[0] = wp[1]; cnt++; } else { if ( __ctype_b_loc( ) - 48 >= 9 ) { wp[0] = __ctype_b_loc( ); wp[0] = wp[1]; } cnt++; if ( name_len <= cnt + 1 ) break; } } while ( cnt < name_len ); wp[0] = wp[0]; } wp[0] = 0; } return ebp_32; } only_digit = 1; }
static void softboundcets_init_ctype(){ #if defined(__linux__) char* ptr; char* base_ptr; ptr = (void*) __ctype_b_loc(); base_ptr = (void*) (*(__ctype_b_loc())); __softboundcets_allocation_secondary_trie_allocate(base_ptr); #ifdef __SOFTBOUNDCETS_SPATIAL __softboundcets_metadata_store(ptr, ((char*) base_ptr - 129), ((char*) base_ptr + 256)); #elif __SOFTBOUNDCETS_TEMPORAL __softboundcets_metadata_store(ptr, 1, __softboundcets_global_lock); #elif __SOFTBOUNDCETS_SPATIAL_TEMPORAL __softboundcets_metadata_store(ptr, ((char*) base_ptr - 129), ((char*) base_ptr + 256), 1, __softboundcets_global_lock); #else __softboundcets_metadata_store(ptr, ((char*) base_ptr - 129), ((char*) base_ptr + 256), 1, __softboundcets_global_lock); #endif #endif // __linux ends }
static void softboundmpx_init_ctype(){ #if defined(__linux__) char* ptr; char* base_ptr; ptr = (void*) __ctype_b_loc(); base_ptr = (void*) (*(__ctype_b_loc())); __softboundmpx_metadata_store(ptr, ((char*) base_ptr - 129), ((char*) base_ptr + 256), base_ptr); #endif // __linux ends }
int LYLoadKeymap( char *arg, HTParentAnchor *anAnchor, HTFormat format_out, HTStream *sink ) { HTFormat format_in = HTAtom_for( "text/html" ); HTStream *target; char *buf = 0; int i; target = HTStreamStack( format_in, format_out, &sink[0]._HTStream, anAnchor ); if ( target == 0 || target == 0 ) { HTSprintf0( &buf, gettext( "Sorry, no known way of converting %s to %s." ), format_in->name, format_out->name ); HTAlert( buf ); if ( buf ) { free( buf ); buf = 0; } return -29999; } else { anAnchor->no_cache = 1; HTSprintf0( &buf, "<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n", gettext( "Current Key Map" ) ); ebx( target, buf, strlen( buf ) ); HTSprintf0( &buf, "<pre>\n" ); ebx( target, buf, strlen( buf ) ); i = 98; for ( ; i <= 123; i++ ) { print_binding( target, i, 1 ); // i++; } i = 1; for ( ; i <= 660; i++ ) { if ( ( i > 127 || i <= 32 || !( *(short*)(*(int*)(__ctype_b_loc( )) + ( ( i + -1 ) * 2 )) & 1024 ) ) && ( LYUseMouse || keymap[ i ] != 84 ) ) print_binding( target, i, 0 ); // i++; } HTSprintf0( &buf, "</pre>\n</body>\n</html>\n" ); ebx( target, buf, strlen( buf ) ); ; } }
int lkcstring_to_lkc( char *src ) { int ah; int c = -1; if ( strlen( src ) == 1 ) c = src[0]; else { if ( strlen( src ) == 2 && src[0] == '^' ) c = src[1] & 31; else { if ( strlen( src ) > 1 && ( *(short*)(*(int*)(__ctype_b_loc( )) + ( src[0] * 2 )) & 2048 ) ) { if ( sscanf( src, "%i", &c ) != 1 ) { return -1; } } else { map_string_to_keysym( src, &c ); if ( c >= 0 ) { if ( ( c & 2047 ) > 255 && ( c & 1024 ) == 0 ) { return -1; } } } } } if ( c == 27 ) escape_bound = 1; if ( c < -1 ) { return -1; } return c; }
void ctSetup() { __ctype_b = *(__ctype_b_loc()); __ctype_toupper = *(__ctype_toupper_loc()); __ctype_tolower = *(__ctype_tolower_loc()); }
static _Bool set_fields(char const *fieldstr ) { size_t initial ; size_t value ; _Bool lhs_specified ; _Bool rhs_specified ; _Bool dash_found ; _Bool field_found ; struct range_pair *rp ; size_t n_rp ; size_t n_rp_allocated ; size_t i ; _Bool in_digits ; char *tmp ; char *tmp___0 ; char *tmp___1 ; char *tmp___2 ; void *tmp___3 ; char *tmp___4 ; void *tmp___5 ; char *tmp___6 ; void *tmp___7 ; size_t len ; size_t tmp___8 ; char *bad_num ; char *tmp___9 ; char const *tmp___10 ; char *tmp___11 ; char const *tmp___12 ; char *tmp___13 ; int tmp___14 ; char *tmp___15 ; unsigned short const **tmp___16 ; unsigned char tmp___17 ; void *tmp___18 ; size_t j ; size_t rsi_candidate ; _Bool tmp___19 ; _Bool tmp___20 ; { initial = 1UL; value = 0UL; lhs_specified = (_Bool)0; rhs_specified = (_Bool)0; dash_found = (_Bool)0; field_found = (_Bool)0; rp = (struct range_pair *)((void *)0); n_rp = 0UL; n_rp_allocated = 0UL; in_digits = (_Bool)0; while (1) { __repair_app_270__3a5: /* CIL Label */ { if ((int const )*fieldstr == 45) { in_digits = (_Bool)0; if (dash_found) { while (1) { tmp = gettext("invalid byte or field list"); error(0, 0, (char const *)tmp); usage(1); break; } } else { } dash_found = (_Bool)1; fieldstr ++; if (lhs_specified) { initial = value; } else { initial = 1UL; } value = 0UL; } else { if ((int const )*fieldstr == 44) { goto _L___2; } else { tmp___16 = __ctype_b_loc(); tmp___17 = to_uchar((char )*fieldstr); if ((int const )*(*tmp___16 + (int )tmp___17) & 1) { goto _L___2; } else { if ((int const )*fieldstr == 0) { _L___2: in_digits = (_Bool)0; if (dash_found) { dash_found = (_Bool)0; if (! lhs_specified) { if (! rhs_specified) { while (1) { tmp___0 = gettext("invalid range with no endpoint: -"); error(0, 0, (char const *)tmp___0); usage(1); break; } } else { } } else { } if (! rhs_specified) { eol_range_start = initial; field_found = (_Bool)1; } else { if (value < initial) { while (1) { tmp___1 = gettext("invalid decreasing range"); error(0, 0, (char const *)tmp___1); usage(1); break; } } else { } if (eol_range_start != 0UL) { if (initial < eol_range_start) { if (eol_range_start <= value) { eol_range_start = initial; } else { while (1) { if (initial == 0UL) { goto _L; } else { if (value == 0UL) { _L: while (1) { tmp___2 = gettext("fields and positions are numbered from 1"); error(0, 0, (char const *)tmp___2); usage(1); break; } } else { } } if (n_rp >= n_rp_allocated) { rp = (struct range_pair *)tmp___3; } else { } (rp + n_rp)->lo = initial; (rp + n_rp)->hi = value; n_rp ++; break; } } field_found = (_Bool)1; } else { } } else { while (1) { if (initial == 0UL) { goto _L___0; } else { if (value == 0UL) { _L___0: while (1) { tmp___4 = gettext("fields and positions are numbered from 1"); error(0, 0, (char const *)tmp___4); usage(1); break; } } else { } } if (n_rp >= n_rp_allocated) { rp = (struct range_pair *)tmp___5; } else { } (rp + n_rp)->lo = initial; (rp + n_rp)->hi = value; n_rp ++; break; } field_found = (_Bool)1; } value = 0UL; } } else { while (1) { if (value == 0UL) { goto _L___1; } else { if (value == 0UL) { _L___1: while (1) { tmp___6 = gettext("fields and positions are numbered from 1"); error(0, 0, (char const *)tmp___6); usage(1); break; } } else { } } if (n_rp >= n_rp_allocated) { rp = (struct range_pair *)tmp___7; } else { } (rp + n_rp)->lo = value; (rp + n_rp)->hi = value; n_rp ++; break; } value = 0UL; field_found = (_Bool)1; } if ((int const )*fieldstr == 0) { break; } else { } fieldstr ++; lhs_specified = (_Bool)0; rhs_specified = (_Bool)0; } else { if ((unsigned int )*fieldstr - 48U <= 9U) { if (! in_digits) { num_start = fieldstr; } else { if (! num_start) { num_start = fieldstr; } else { } } in_digits = (_Bool)1; if (dash_found) { rhs_specified = (_Bool)1; } else { lhs_specified = (_Bool)1; } if (0UL < value) { tmp___14 = 0; } else { if (value * 10UL + (unsigned long )((int const )*fieldstr - 48) < value) { tmp___14 = 0; } else { value = value * 10UL + (unsigned long )((int const )*fieldstr - 48); tmp___14 = 1; } } if (! tmp___14) { tmp___8 = strspn(num_start, "0123456789"); len = tmp___8; tmp___9 = xstrndup(num_start, len); bad_num = tmp___9; if ((unsigned int )operating_mode == 1U) { tmp___10 = quote((char const *)bad_num); tmp___11 = gettext("byte offset %s is too large"); error(0, 0, (char const *)tmp___11, tmp___10); } else { tmp___12 = quote((char const *)bad_num); tmp___13 = gettext("field number %s is too large"); error(0, 0, (char const *)tmp___13, tmp___12); } free((void *)bad_num); exit(1); } else { } fieldstr ++; } else { while (1) { tmp___15 = gettext("invalid byte or field list"); error(0, 0, (char const *)tmp___15); usage(1); break; } } } } } } value = 0UL; } } max_range_endpoint = 0UL; i = 0UL; while (i < n_rp) { if ((rp + i)->hi > max_range_endpoint) { max_range_endpoint = (rp + i)->hi; } else { } i ++; } tmp___18 = xzalloc(max_range_endpoint / 8UL + 1UL); printable_field = (unsigned char *)tmp___18; qsort((void *)rp, n_rp, sizeof(*(rp + 0)), & compare_ranges); i = 0UL; while (i < n_rp) { if (complement) { rsi_candidate = (rp + i)->hi + 1UL; } else { rsi_candidate = (rp + i)->lo; } if (output_delimiter_specified) { tmp___19 = is_printable_field(rsi_candidate); if (! tmp___19) { mark_range_start(rsi_candidate); } else { } } else { } j = (rp + i)->lo; while (j <= (rp + i)->hi) { mark_printable_field(j); j ++; } i ++; } if (output_delimiter_specified) { if (! complement) { if (eol_range_start) { tmp___20 = is_printable_field(eol_range_start); if (! tmp___20) { mark_range_start(eol_range_start); } else { } } else { } } else { } } else { } free((void *)rp); return (field_found); } }
int html_src_parse_tagspec( char *ts, HTlexeme lexeme, BOOLEAN checkonly, BOOLEAN isstart ) { BOOLEAN stop = 0; BOOLEAN code = 0; char *p = ts; char *tagstart = 0; char *tagend = 0; char *classstart; char *classend; char save, save1; char after_excl = 0; html_src_check_state state = HTSRC_CK_normal; HT_tagspec *head = 0; HT_tagspec *tail = 0; HT_tagspec **slot = lexeme_end; for ( ; stop == 0; p++ ) { if ( state == HTSRC_CK_after_tagname ) { switch ( p[0] ) { case 0: stop = 1; code = 1; save = tagend[0]; tagend[0] = 0; classstart = 0; if ( checkonly ) { int idx = html_src_tag_index( tagstart ); if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) ) { fprintf( TraceFP( ), "tag index(%s) = %d\n", tagstart, idx ); } tagend[0] = save; if ( idx == -1 ) stop = 1; } else if ( after_excl ) append_close_tag( tagstart, &head, &tail ); else append_open_tag( tagstart, 0, &head, &tail ); state = HTSRC_CK_normal; after_excl = 0; break; case 9: case 32: save = tagend[0]; tagend[0] = 0; classstart = 0; break; case 46: if ( after_excl ) { if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) ) { fprintf( TraceFP( ), "dot after '!' at column %d:\n\t%s\n", p[1] - ts, ts ); } stop = 1; } else state = HTSRC_CK_seen_dot; break; default: if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) ) { fprintf( TraceFP( ), "unexpected char '%c' after tagname at column %d:\n\t%s\n", p[0], p[1] - ts, ts ); } stop = 1; break; } } else { if ( state >= 2 ) { if ( state == HTSRC_CK_seen_dot && p[0] != 9 && p[0] != 32 ) { if ( p[0] == 0 ) { if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) ) { fprintf( TraceFP( ), "expected text after dot at column %d:\n\t%s\n", p[1] - ts, ts ); } stop = 1; } else { if ( !( *(short*)(*(int*)(__ctype_b_loc( )) + ( p[0] * 2 )) & 1024 ) && p[0] != '_' ) { if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) ) { fprintf( TraceFP( ), "no name starting at column %d:\n\t%s\n", p[1] - ts, ts ); } stop = 1; } else { classstart = p; for ( ; p[0] && ( ( *(short*)(*(int*)(__ctype_b_loc( )) + ( p[0] * 2 )) & 8 ) || p[0] == '_' ); p++ ) { // p++; } classend = p; p = &p[ -1 ]; save = classend[0]; classend[0] = 0; save1 = tagend[0]; tagend[0] = 0; if ( checkonly ) { int idx = html_src_tag_index( tagstart ); tagend[0] = save1; classend[0] = save; if ( idx == -1 ) { return 0; } } else append_open_tag( tagstart, classstart, &head, &tail ); state = HTSRC_CK_normal; after_excl = 0; } } } } else { switch ( p[0] ) { case 0: stop = 1; code = 1; break; case 33: if ( state == HTSRC_CK_seen_excl ) { if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) ) { fprintf( TraceFP( ), "second '!' at column %d:\n\t%s\n", p[1] - ts, ts ); } stop = 1; } else { state = HTSRC_CK_seen_excl; after_excl = 1; } break; default: if ( !( *(short*)(*(int*)(__ctype_b_loc( )) + ( p[0] * 2 )) & 1024 ) && p[0] != '_' ) { if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) ) { fprintf( TraceFP( ), "no name starting at column %d:\n\t%s\n", p[1] - ts, ts ); } stop = 1; } else { tagstart = p; for ( ; p[0] && ( ( *(short*)(*(int*)(__ctype_b_loc( )) + ( p[0] * 2 )) & 8 ) || p[0] == '_' ); p++ ) { // p++; } tagend = p; p = &p[ -1 ]; state = HTSRC_CK_after_tagname; } break; } } } // p++; } if ( code && checkonly == 0 ) slot[0] = head; return code; }
int remote_session( char *acc_method, char *host ) { char *program; char *user = host; char *password = 0; char *cp; char *hostname; char *port; char *command = 0; enum _login_protocol login_protocol = rlogin; cp = host; for ( ; cp[0]; cp++ ) { if ( !( *(short*)(*(int*)(__ctype_b_loc( )) + ( cp[0] * 2 )) & 8 ) && cp[0] != '_' && cp[0] != '-' && cp[0] != ':' && cp[0] != '.' && cp[0] != '@' ) { cp[0] = 0; break; } else { // cp++; } } hostname = strchr( host, '@' ); if ( hostname ) { hostname[0] = 0; hostname++; } else { hostname = host; user = 0; } port = strchr( hostname, ':' ); if ( port ) { port[0] = 0; port++; } if ( hostname == 0 || hostname[0] == 0 ) { if ( WWW_TraceFlag ) { fprintf( TraceFP( ), "HTTelnet: No host specified!\n" ); } return -204; } else { if ( ( valid_hostname( hostname ) & 255 ) == 0 ) { char *prefix = 0; char *line = 0; if ( WWW_TraceFlag ) { fprintf( TraceFP( ), "HTTelnet: Invalid hostname %s!\n", host ); } HTSprintf0( &prefix, gettext( "remote %s session:" ), acc_method ); HTSprintf0( &line, gettext( "Invalid hostname %s" ), host ); HTAlwaysAlert( prefix, line ); if ( prefix ) { free( prefix ); prefix = 0; } if ( line ) { free( line ); line = 0; } return -204; } else { if ( user ) { password = strchr( user, ':' ); if ( password ) { password[0] = 0; password++; } } if ( HTSecure ) { puts( "\n\nSorry, but the service you have selected is one" ); puts( "to which you have to log in. If you were running www" ); puts( "on your own computer, you would be automatically connected." ); puts( "For security reasons, this is not allowed when" ); puts( "you log in to this information service remotely.\n" ); printf( "You can manually connect to this service using %s\n", acc_method ); printf( "to host %s", hostname ); if ( user ) printf( ", user name %s", user ); if ( password ) printf( ", password %s", password ); if ( port ) printf( ", port %s", port ); puts( ".\n" ); return -204; } else { if ( user && login_protocol != rlogin ) printf( "When you are connected, log in as: %s\n", user ); if ( password && login_protocol != rlogin ) printf( " The password is: %s\n", password ); fflush( stdout ); switch ( login_protocol ) { case rlogin: program = HTGetProgramPath( 11 ); if ( program == 0 ) { LYSystem( command ); return -204; } HTAddParam( &command, "%s %s%s%s", 1, program ); HTAddParam( &command, "%s %s%s%s", 2, hostname ); HTSACat( &command, "" ); HTAddParam( &command, "%s %s%s%s", 4, user ); HTEndParam( &command, "%s %s%s%s", 4 ); break; case tn3270: program = HTGetProgramPath( 17 ); if ( program == 0 ) { LYSystem( command ); return -204; } HTAddParam( &command, "%s %s %s", 1, program ); HTAddParam( &command, "%s %s %s", 2, hostname ); HTAddParam( &command, "%s %s %s", 3, port ); HTEndParam( &command, "%s %s %s", 3 ); break; case telnet: program = HTGetProgramPath( 16 ); if ( program == 0 ) { LYSystem( command ); return -204; } HTAddParam( &command, "%s %s %s", 1, program ); HTAddParam( &command, "%s %s %s", 2, hostname ); HTAddParam( &command, "%s %s %s", 3, port ); HTEndParam( &command, "%s %s %s", 3 ); break; } } } } }
void read_rc( FILE *fp ) { char *buffer = 0; char rcfile[256]; char MBM_line[256]; int n; if ( fp == 0 ) { LYAddPathToHome( rcfile, 256, ".lynxrc" ); fp = fopen64( rcfile, "r" ); if ( fp ) { if ( WWW_TraceFlag ) { fprintf( TraceFP( ), "read_rc opened %s\n", rcfile ); while ( LYSafeGets( &buffer, fp ) == 0 ) { char *name, *value, *notes; Config_Type *tbl; ParseUnion *q; LYTrimTrailing( buffer ); name = LYSkipBlanks( buffer ); if ( !( *(short*)(*(int*)(__ctype_b_loc( )) + ( name[0] * 2 )) & 4 ) && name[0] ) { value = strchr( name, '=' ); if ( value == 0 ) { if ( WWW_TraceFlag ) { fprintf( TraceFP( ), "LYrcFile: missing '=' %s\n", name ); } } else { value[0] = 0; value++; LYTrimTrailing( name ); value = LYSkipBlanks( value ); if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) ) { fprintf( TraceFP( ), "LYrcFile %s:%s\n", name, value ); } tbl = lookup_config( name ); if ( tbl->name[0] == 0 ) { char *special = "multi_bookmark"; if ( strncasecomp( name, special, strlen( special ) ) == 0 ) { tbl = lookup_config( special ); } if ( tbl->name[0] == 0 ) { if ( WWW_TraceFlag ) { fprintf( TraceFP( ), "LYrcFile: ignored %s=%s\n", name, value ); } } } q = &tbl->value; switch ( tbl->type ) { case 0: break; case 2: if ( q->add_value[0] ) { q->override_primary_action = getBool( value ); } break; case 3: if ( q->add_value[0] ) { ; } break; case 1: n = 0; for ( ; tbl->strings[ n ]; n++ ) { if ( strcasecomp( value, &tbl->strings[ n ] ) == 0 ) { q->add_value = &n; } else { // n++; } } break; case 5: if ( tbl->table ) { LYgetEnum( &tbl->table, value, (int*)q->add_value[0] ); } break; case 4: if ( q->add_value[0] && sscanf( value, value, "%d", ival ) == 1 ) { q->add_value = &ival; } break; case 6: if ( q->add_value[0] ) { if ( q->add_value ) HTSACat( (int)( &q->add_value[0]->next ), "," ); HTSACat( (int)( &q->add_value[0]->next ), value ); } break; case 7: n = 1; for ( ; n <= 25; n++ ) { sprintf( MBM_line, "multi_bookmark%c", LYindex2MBM( n ) ); if ( strcasecomp( name, MBM_line ) == 0 ) { notes = strchr( value, ',' ); if ( notes ) { notes = 0; notes++; LYTrimTrailing( value ); notes = LYSkipBlanks( notes ); } else { notes = value + strlen( value ); } HTSACopy( &MBM_A_subbookmark[ n ], value ); HTSACopy( &MBM_A_subdescript[ n ], notes ); } else { // n++; } } break; case 8: if ( q->add_value[0] ) { HTSACopy( (int)( &q->add_value[0]->next ), value ); } break; } } } } } } } else if ( WWW_TraceFlag ) { fprintf( TraceFP( ), "read_rc used passed-in stream\n" ); } return; }
void glibc_compat5() { __ctype_b = *(unsigned short int**)__ctype_b_loc(); __ctype_tolower = *(__int32_t**)__ctype_tolower_loc(); __ctype_toupper = *(__int32_t**)__ctype_toupper_loc(); }