| 927 | #endif |
| 928 | |
| 929 | void 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 | |
| 953 | bool execfile(const char *cfgfile) |
| 954 | { |