MCPcopy Index your code
hub / github.com/NetHack/NetHack / fqname

Function fqname

src/files.c:353–389  ·  view source on GitHub ↗

ARGSUSED*/

Source from the content-addressed store, hash-verified

351
352/*ARGSUSED*/
353const char *
354fqname(const char *basenam,
355 int whichprefix UNUSED_if_not_PREFIXES_IN_USE,
356 int buffnum UNUSED_if_not_PREFIXES_IN_USE)
357{
358#ifdef PREFIXES_IN_USE
359 char *bufptr;
360#endif
361#ifdef WIN32
362 char tmpbuf[BUFSZ];
363#endif
364
365#ifndef PREFIXES_IN_USE
366 return basenam;
367#else
368 if (!basenam || whichprefix < 0 || whichprefix >= PREFIX_COUNT)
369 return basenam;
370 if (!gf.fqn_prefix[whichprefix])
371 return basenam;
372 if (buffnum < 0 || buffnum >= FQN_NUMBUF) {
373 impossible("Invalid fqn_filename_buffer specified: %d", buffnum);
374 buffnum = 0;
375 }
376 bufptr = gf.fqn_prefix[whichprefix];
377#ifdef WIN32
378 if (strchr(gf.fqn_prefix[whichprefix], '%')
379 || strchr(gf.fqn_prefix[whichprefix], '~'))
380 bufptr = translate_path_variables(gf.fqn_prefix[whichprefix], tmpbuf);
381#endif
382 if (strlen(bufptr) + strlen(basenam) >= FQN_MAX_FILENAME) {
383 impossible("fqname too long: %s + %s", bufptr, basenam);
384 return basenam; /* XXX */
385 }
386 Strcpy(fqn_filename_buffer[buffnum], bufptr);
387 return strcat(fqn_filename_buffer[buffnum], basenam);
388#endif /* !PREFIXES_IN_USE */
389}
390
391#ifndef SFCTOOL
392/* reasonbuf must be at least BUFSZ, supplied by caller */

Callers 15

trace_procs_initFunction · 0.85
mainFunction · 0.85
eraseoldlocksFunction · 0.85
getlockFunction · 0.85
libnhmain.cFile · 0.85
MAINFunction · 0.85
eraseoldlocksFunction · 0.85
getlockFunction · 0.85
mainFunction · 0.85
eraseoldlocksFunction · 0.85
getlockFunction · 0.85
pcmainFunction · 0.85

Calls 2

translate_path_variablesFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected