static char *parse_default_language(char *str) { char *slang; DBUG_ENTER("parse_default_language"); /* skipping the "default-language" keyword */ str= find_end_of_word(str); /* skipping space(s) and/or tabs after the keyword */ str= skip_delimiters(str); if (!*str) { fprintf(stderr, "Unexpected EOL: No short language name after the keyword\n"); DBUG_RETURN(0); } /* reading the short language tag */ if (!(slang= get_word(&str))) DBUG_RETURN(0); /* OOM: Fatal error */ DBUG_PRINT("info", ("default_slang: %s", slang)); str= skip_delimiters(str); DBUG_PRINT("info", ("str: %s", str)); if (*str) { fprintf(stderr, "The default language line does not end with short language " "name\n"); DBUG_RETURN(0); } DBUG_PRINT("info", ("str: %s", str)); DBUG_RETURN(slang); }
static uint parse_error_offset(char *str) { char *soffset, *end; int error; uint ioffset; DBUG_ENTER("parse_error_offset"); /* skipping the "start-error-number" keyword and spaces after it */ str= find_end_of_word(str); str= skip_delimiters(str); if (!*str) DBUG_RETURN(0); /* Unexpected EOL: No error number after the keyword */ /* reading the error offset */ if (!(soffset= get_word(&str))) DBUG_RETURN(0); /* OOM: Fatal error */ DBUG_PRINT("info", ("default_error_offset: %s", soffset)); /* skipping space(s) and/or tabs after the error offset */ str= skip_delimiters(str); DBUG_PRINT("info", ("str: %s", str)); if (*str) { /* The line does not end with the error offset -> error! */ fprintf(stderr, "The error offset line does not end with an error offset"); DBUG_RETURN(0); } DBUG_PRINT("info", ("str: %s", str)); end= 0; ioffset= (uint) my_strtoll10(soffset, &end, &error); my_free(soffset); DBUG_RETURN(ioffset); }
static struct languages *parse_charset_string(char *str) { struct languages *head=0, *new_lang; DBUG_ENTER("parse_charset_string"); DBUG_PRINT("enter", ("str: %s", str)); /* skip over keyword */ str= find_end_of_word(str); if (!*str) { /* unexpected EOL */ DBUG_PRINT("info", ("str: %s", str)); DBUG_RETURN(0); } str= skip_delimiters(str); if (!(*str != ';' && *str)) DBUG_RETURN(0); do { /*creating new element of the linked list */ new_lang= (struct languages *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*new_lang), MYF(MY_WME)); new_lang->next_lang= head; head= new_lang; /* get the full language name */ if (!(new_lang->lang_long_name= get_word(&str))) DBUG_RETURN(0); /* OOM: Fatal error */ DBUG_PRINT("info", ("long_name: %s", new_lang->lang_long_name)); /* getting the short name for language */ str= skip_delimiters(str); if (!*str) DBUG_RETURN(0); /* Error: No space or tab */ if (!(new_lang->lang_short_name= get_word(&str))) DBUG_RETURN(0); /* OOM: Fatal error */ DBUG_PRINT("info", ("short_name: %s", new_lang->lang_short_name)); /* getting the charset name */ str= skip_delimiters(str); if (!(new_lang->charset= get_word(&str))) DBUG_RETURN(0); /* Fatal error */ DBUG_PRINT("info", ("charset: %s", new_lang->charset)); /* skipping space, tab or "," */ str= skip_delimiters(str); } while (*str != ';' && *str); DBUG_PRINT("info", ("long name: %s", new_lang->lang_long_name)); DBUG_RETURN(head); }
Abonent* parse_abonent(TCHAR** pos, TCHAR* max_pos) { DWORD id; TCHAR phone_no[256]; TCHAR family_name[256]; TCHAR name[256]; TCHAR middle_name[256]; TCHAR street[256]; TCHAR house[256]; TCHAR building[256]; TCHAR flat[256]; TCHAR tmp[256]; get_next_el(pos, tmp, max_pos); id = _ttoi(tmp); read_field(phone_no); read_field(family_name); read_field(name); read_field(middle_name); read_field(street); read_field(house); read_field(building); read_field(flat); skip_delimiters(pos, max_pos); (*pos)++; Abonent* abonent = create_abonent(id, phone_no, family_name, name, middle_name, street, house, building, flat); return abonent; }
static struct errors *parse_error_string(char *str, int er_count) { struct errors *new_error; DBUG_ENTER("parse_error_string"); DBUG_PRINT("enter", ("str: %s", str)); /* create a new element */ new_error= (struct errors *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*new_error), MYF(MY_WME)); if (my_init_dynamic_array(&new_error->msg, PSI_NOT_INSTRUMENTED, sizeof(struct message), NULL, 0, 0)) DBUG_RETURN(0); /* OOM: Fatal error */ /* getting the error name */ str= skip_delimiters(str); if (!(new_error->er_name= get_word(&str))) DBUG_RETURN(0); /* OOM: Fatal error */ DBUG_PRINT("info", ("er_name: %s", new_error->er_name)); str= skip_delimiters(str); /* getting the code1 */ new_error->d_code= er_offset + er_count; DBUG_PRINT("info", ("d_code: %d", new_error->d_code)); str= skip_delimiters(str); /* if we reached EOL => no more codes, but this can happen */ if (!*str) { new_error->sql_code1= empty_string; new_error->sql_code2= empty_string; DBUG_PRINT("info", ("str: %s", str)); DBUG_RETURN(new_error); } /* getting the sql_code 1 */ if (!(new_error->sql_code1= get_word(&str))) DBUG_RETURN(0); /* OOM: Fatal error */ DBUG_PRINT("info", ("sql_code1: %s", new_error->sql_code1)); str= skip_delimiters(str); /* if we reached EOL => no more codes, but this can happen */ if (!*str) { new_error->sql_code2= empty_string; DBUG_PRINT("info", ("str: %s", str)); DBUG_RETURN(new_error); } /* getting the sql_code 2 */ if (!(new_error->sql_code2= get_word(&str))) DBUG_RETURN(0); /* OOM: Fatal error */ DBUG_PRINT("info", ("sql_code2: %s", new_error->sql_code2)); str= skip_delimiters(str); if (*str) { fprintf(stderr, "The error line did not end with sql/odbc code: '%s'\n", str); DBUG_RETURN(0); } DBUG_RETURN(new_error); }