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

Function make_compressed_name

src/files.c:1804–1833  ·  view source on GitHub ↗

RLC 09 Mar 1999: Support internal ZLIB */

Source from the content-addressed store, hash-verified

1802
1803#ifdef ZLIB_COMP /* RLC 09 Mar 1999: Support internal ZLIB */
1804staticfn boolean
1805make_compressed_name(const char *filename, char *cfn)
1806{
1807#ifndef SHORT_FILENAMES
1808 /* Assume free-form filename with no 8.3 restrictions */
1809 strcpy(cfn, filename);
1810 strcat(cfn, COMPRESS_EXTENSION);
1811 return TRUE;
1812#else
1813#ifdef SAVE_EXTENSION
1814 char *bp = (char *) 0;
1815
1816 strcpy(cfn, filename);
1817 if ((bp = strstri(cfn, SAVE_EXTENSION))) {
1818 strsubst(bp, SAVE_EXTENSION, ".saz");
1819 return TRUE;
1820 } else {
1821 /* find last occurrence of bon */
1822 bp = eos(cfn);
1823 while (bp-- > cfn) {
1824 if (strstri(bp, "bon")) {
1825 strsubst(bp, "bon", "boz");
1826 return TRUE;
1827 }
1828 }
1829 }
1830#endif /* SAVE_EXTENSION */
1831 return FALSE;
1832#endif /* SHORT_FILENAMES */
1833}
1834
1835staticfn void
1836docompress_file(const char *filename, boolean uncomp)

Callers 1

docompress_fileFunction · 0.85

Calls 3

strstriFunction · 0.85
strsubstFunction · 0.85
eosFunction · 0.85

Tested by

no test coverage detected