| 1097 | } |
| 1098 | |
| 1099 | char * |
| 1100 | get_savefield(NHFILE *nhfp, char *inbuf, size_t inbufsz) |
| 1101 | { |
| 1102 | char *ep, *sep; |
| 1103 | char *res = 0; |
| 1104 | |
| 1105 | if ((res =fgets(inbuf, (int) inbufsz, nhfp->fpdef)) != 0) { |
| 1106 | nhfp->rcount++; |
| 1107 | ep = strchr(inbuf, '\n'); |
| 1108 | if (!ep) { /* newline missing */ |
| 1109 | if (strlen(inbuf) < (inbufsz - 2)) { |
| 1110 | /* likely the last line of file is just |
| 1111 | missing a newline; process it anyway */ |
| 1112 | ep = eos(inbuf); |
| 1113 | } |
| 1114 | } |
| 1115 | if (ep) |
| 1116 | *ep = '\0'; /* remove newline */ |
| 1117 | sep = strchr(inbuf, '|'); |
| 1118 | if (sep) |
| 1119 | sep++; |
| 1120 | |
| 1121 | return sep; |
| 1122 | } |
| 1123 | inbuf[0] = '\0'; |
| 1124 | nhfp->eof = TRUE; |
| 1125 | return inbuf; |
| 1126 | } |
| 1127 | |
| 1128 | #ifdef SAVEFILE_DEBUGGING |
| 1129 | void |
no test coverage detected