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

Function regularize

sys/unix/unixunix.c:296–325  ·  view source on GitHub ↗

normalize file name - we don't like .'s, /'s, spaces */

Source from the content-addressed store, hash-verified

294
295/* normalize file name - we don't like .'s, /'s, spaces */
296void
297regularize(char *s)
298{
299 char *lp;
300
301 while ((lp = strchr(s, '.')) != 0 || (lp = strchr(s, '/')) != 0
302 || (lp = strchr(s, ' ')) != 0)
303 *lp = '_';
304#if defined(SYSV) && !defined(AIX_31) && !defined(SVR4) && !defined(LINUX) \
305 && !defined(__APPLE__)
306/* avoid problems with 14 character file name limit */
307#ifdef COMPRESS
308 /* leave room for .e from error and .Z from compress appended to
309 * save files */
310 {
311#ifdef COMPRESS_EXTENSION
312 int i = 12 - strlen(COMPRESS_EXTENSION);
313#else
314 int i = 10; /* should never happen... */
315#endif
316 if (strlen(s) > i)
317 s[i] = '\0';
318 }
319#else
320 if (strlen(s) > 11)
321 /* leave room for .nn appended to level files */
322 s[11] = '\0';
323#endif
324#endif
325}
326
327#if defined(TIMED_DELAY) && !defined(msleep) && defined(SYSV)
328#include <poll.h>

Callers 1

getlockFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected