| 1041 | |
| 1042 | |
| 1043 | void |
| 1044 | exportascii_sfi_char(NHFILE *nhfp, char *d_char, const char *myname UNUSED, int cnt) |
| 1045 | { |
| 1046 | int i, j, sval; |
| 1047 | char n[4], *rstr; |
| 1048 | char *src, *dest; |
| 1049 | |
| 1050 | /* cnt is the length of the string */ |
| 1051 | rstr = get_savefield(nhfp, strbuf, sizeof strbuf); |
| 1052 | if (!rstr) { |
| 1053 | nhfp->eof = TRUE; |
| 1054 | return; |
| 1055 | } |
| 1056 | src = rstr; |
| 1057 | dest = |
| 1058 | #ifdef SAVEFILE_DEBUGGING |
| 1059 | testbuf; |
| 1060 | #else |
| 1061 | d_char; |
| 1062 | #endif |
| 1063 | |
| 1064 | for (i = 0; i < cnt; ++i) { |
| 1065 | if (*src == '\\') { |
| 1066 | src++; |
| 1067 | for (j = 0; j < 4; ++j) { |
| 1068 | if (j < 3) |
| 1069 | n[j] = *src++; |
| 1070 | else |
| 1071 | n[j] = '\0'; |
| 1072 | } |
| 1073 | sval = atoi(n); |
| 1074 | *dest++ = (char) sval; |
| 1075 | } else |
| 1076 | *dest++ = *src++; |
| 1077 | } |
| 1078 | #ifdef SAVEFILE_DEBUGGING |
| 1079 | if (nhfp->structlevel) { |
| 1080 | src = testbuf; |
| 1081 | dest = d_char; |
| 1082 | match = TRUE; |
| 1083 | for (i = 0; i < cnt; ++i) { |
| 1084 | if (*src++ != *dest++) |
| 1085 | match = FALSE; |
| 1086 | } |
| 1087 | if (!match) |
| 1088 | report_problem_ascii(nhfp, myparent, myname, parent); |
| 1089 | else { |
| 1090 | src = testbuf; |
| 1091 | dest = d_char; |
| 1092 | for (i = 0; i < cnt; ++i) |
| 1093 | *dest++ = *src++; |
| 1094 | } |
| 1095 | } |
| 1096 | #endif |
| 1097 | } |
| 1098 | |
| 1099 | char * |
| 1100 | get_savefield(NHFILE *nhfp, char *inbuf, size_t inbufsz) |
nothing calls this directly
no test coverage detected