diff --git a/MAKE.bat b/MAKE.bat index e486994..82cb030 100644 --- a/MAKE.bat +++ b/MAKE.bat @@ -472,7 +472,8 @@ if "%1"=="fwk" ( set "filename=%%~nxf" if /i not "!filename:~0,4!"=="3rd_" ( echo Processing: %%f - powershell -command "(Get-Content '%%f') -creplace 'v4k', 'fwk' -creplace 'V4K', 'FWK' | Set-Content '%%f'" + rem powershell -command "(Get-Content '%%f') -creplace 'v4k', 'fwk' -creplace 'V4K', 'FWK' | Set-Content '%%f'" + tools\fwkren.exe %%f from ) else ( echo Skipping %%f ) @@ -495,7 +496,8 @@ if "%1"=="back" ( set "filename=%%~nxf" if /i not "!filename:~0,4!"=="3rd_" ( echo Processing: %%f - powershell -command "(Get-Content '%%f') -creplace 'fwk', 'v4k' -creplace 'FWK', 'V4K' | Set-Content '%%f'" + rem powershell -command "(Get-Content '%%f') -creplace 'fwk', 'v4k' -creplace 'FWK', 'V4K' | Set-Content '%%f'" + tools\fwkren.exe %%f to ) else ( echo Skipping %%f ) diff --git a/tools/fwkren.c b/tools/fwkren.c new file mode 100644 index 0000000..d9e03c4 --- /dev/null +++ b/tools/fwkren.c @@ -0,0 +1,30 @@ +#include "v4k.h" + +int main(int argc, char **argv) { + if (argc != 3) { + fprintf(stderr, "usage: %s [file] [mode]\n", argv[0]); + fprintf(stderr, "file: %s\n", "source file to process"); + fprintf(stderr, "mode: %s\n", "to|from"); + return 1; + } + + char *buf = file_read(argv[1]); + if (!buf) { + fprintf(stderr, "error: %s\n", "file does not exist!"); + return 2; + } + + char mode = !strcmp(argv[2], "from"); + + if (!mode) { + buf = strswap(buf, "v4k", "fwk"); + buf = strswap(buf, "V4K", "FWK"); + } else { + buf = strswap(buf, "fwk", "v4k"); + buf = strswap(buf, "FWK", "V4K"); + } + + file_write(argv[1], buf, strlen(buf)); + + return 0; +} diff --git a/tools/fwkren.exe b/tools/fwkren.exe new file mode 100644 index 0000000..7bb2062 Binary files /dev/null and b/tools/fwkren.exe differ