MCPcopy Create free account
hub / github.com/assaultcube/AC / cleancubescript

Function cleancubescript

source/src/command.cpp:929–951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

927#endif
928
929void cleancubescript(char *buf) // drop easy to spot surplus whitespace and comments
930{
931 if(!buf || !*buf) return;
932 char *src = buf, c;
933 bool quot = false;
934 for(char l = 0; (c = *src++); l = c)
935 {
936 if(c == '\r') c = '\n';
937 if(quot)
938 {
939 if((c == '"' && l != '\\') || c == '\n') quot = false;
940 }
941 else
942 {
943 if(c == l && isspace(c)) continue;
944 if(c == ' ' && l == '\n') continue;
945 if(c == '/' && *src == '/') { src += strcspn(src, "\n\r\0"); continue; }
946 if(c == '"') quot = true;
947 }
948 *buf++ = c;
949 }
950 *buf = '\0';
951}
952
953bool execfile(const char *cfgfile)
954{

Callers 1

execfileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected