| 905 | | if (gb_tmp) { |
| 906 | | const char *name = "<unknown>"; |
| 907 | | GBDATA *gb_name = GB_search(gb_parent, "name", GB_FIND); |
| 908 | | if (gb_name) name = GB_read_char_pntr(gb_name); |
| 909 | | error2 = GBS_global_string("field 'tmp' already exists for %s '%s'", gene_flag ? "gene" : "species", name); |
| 910 | | gb_tmp = 0; // don't overwrite |
| | 908 | if (!gb_tmp) { |
| | 909 | append = false; |
| | 910 | gb_tmp = GB_search(gb_parent, "tmp", GB_STRING); |
| | 911 | if (!gb_tmp) error2 = GB_await_error(); |
| | 912 | } |
| | 913 | } |
| | 914 | |
| | 915 | if (!error2) { |
| | 916 | pd_assert(gb_tmp); |
| | 917 | if (append) { |
| | 918 | char *prevContent = GB_read_string(gb_tmp); |
| | 919 | if (!prevContent) { |
| | 920 | error2 = GB_await_error(); |
| | 921 | } |
| | 922 | else { |
| | 923 | char *concatenatedContent = (char *)malloc(strlen(prevContent)+1+strlen(match_info)+1); |
| | 924 | sprintf(concatenatedContent, "%s\n%s", prevContent, match_info); |
| | 925 | error2 = GB_write_string(gb_tmp, concatenatedContent); |
| | 926 | free(concatenatedContent); |
| | 927 | free(prevContent); |
| | 928 | } |