MCPcopy Create free account
hub / github.com/NetHack/NetHack / get_savefield

Function get_savefield

util/sfexpasc.c:1099–1126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1097}
1098
1099char *
1100get_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
1129void

Callers 15

exportascii_sfi_anyFunction · 0.85
exportascii_sfi_aligntypFunction · 0.85
exportascii_sfi_bitfieldFunction · 0.85
exportascii_sfi_booleanFunction · 0.85
exportascii_sfi_int32Function · 0.85
exportascii_sfi_intFunction · 0.85
exportascii_sfi_longFunction · 0.85
exportascii_sfi_scharFunction · 0.85
exportascii_sfi_int16Function · 0.85
exportascii_sfi_int64Function · 0.85
exportascii_sfi_size_tFunction · 0.85

Calls 2

fgetsFunction · 0.85
eosFunction · 0.85

Tested by

no test coverage detected