| 860 | */ |
| 861 | |
| 862 | static struct message *parse_message_string(struct message *new_message, |
| 863 | char *str) |
| 864 | { |
| 865 | char *start; |
| 866 | |
| 867 | DBUG_ENTER("parse_message_string"); |
| 868 | DBUG_PRINT("enter", ("str: %s", str)); |
| 869 | |
| 870 | /*skip space(s) and/or tabs in the beginning */ |
| 871 | while (*str == ' ' || *str == '\t' || *str == '\n') |
| 872 | str++; |
| 873 | |
| 874 | if (!*str) |
| 875 | { |
| 876 | /* It was not a message line, but an empty line. */ |
| 877 | DBUG_PRINT("info", ("str: %s", str)); |
| 878 | DBUG_RETURN(0); |
| 879 | } |
| 880 | |
| 881 | /* reading the short lang */ |
| 882 | start= str; |
| 883 | while (*str != ' ' && *str != '\t' && *str) |
| 884 | str++; |
| 885 | if (!(new_message->lang_short_name= |
| 886 | my_strndup(start, (uint) (str - start), |
| 887 | MYF(MY_WME | MY_FAE)))) |
| 888 | DBUG_RETURN(0); /* Fatal error */ |
| 889 | DBUG_PRINT("info", ("msg_slang: %s", new_message->lang_short_name)); |
| 890 | |
| 891 | /*skip space(s) and/or tabs after the lang */ |
| 892 | while (*str == ' ' || *str == '\t' || *str == '\n') |
| 893 | str++; |
| 894 | |
| 895 | if (*str != '"') |
| 896 | { |
| 897 | fprintf(stderr, "Unexpected EOL"); |
| 898 | DBUG_PRINT("info", ("str: %s", str)); |
| 899 | DBUG_RETURN(0); |
| 900 | } |
| 901 | |
| 902 | /* reading the text */ |
| 903 | start= str + 1; |
| 904 | str= parse_text_line(start); |
| 905 | |
| 906 | if (!(new_message->text= my_strndup(start, (uint) (str - start), |
| 907 | MYF(MY_WME | MY_FAE)))) |
| 908 | DBUG_RETURN(0); /* Fatal error */ |
| 909 | DBUG_PRINT("info", ("msg_text: %s", new_message->text)); |
| 910 | |
| 911 | DBUG_RETURN(new_message); |
| 912 | } |
| 913 | |
| 914 | static struct errors* create_new_error(my_bool is_padding, char *er_name, int d_code, const char *sql_code1, const char *sql_code2) |
| 915 | { |
no test coverage detected