MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / PltMakeFNValid

Function PltMakeFNValid

Descent3/pilot.cpp:1978–2009  ·  view source on GitHub ↗

/////////////////////////////////////////////////////// given a name, it will create a valid filename

Source from the content-addressed store, hash-verified

1976////////////////////////////////////////////////////////////
1977// given a name, it will create a valid filename
1978void PltMakeFNValid(char *name) {
1979 int whiteindex;
1980 int end = strlen(name);
1981
1982 for (whiteindex = 0; whiteindex < end; whiteindex++) {
1983 // remove illegal character (sub _ in place)
1984 switch (name[whiteindex]) {
1985 case '?':
1986 case '*':
1987 case '\\':
1988 case '/':
1989 case '|':
1990 case '<':
1991 case '>':
1992 case ':':
1993 case '"':
1994 name[whiteindex] = '_';
1995 break;
1996 default:
1997 break;
1998 }
1999 }
2000
2001 // remove leading whitespace
2002 whiteindex = 0;
2003 while (name[whiteindex] == ' ')
2004 whiteindex++;
2005
2006 char temp[PLTFILELEN];
2007 strcpy(temp, &name[whiteindex]);
2008 strcpy(name, temp);
2009}
2010
2011////////////////////////////////////////////////////////
2012// Copies the key/joy config of a pilot to another (src must exist!) (Keep up to date with Read/Write file)

Callers 2

PilotCreateFunction · 0.85
PltDeleteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected