diff options
Diffstat (limited to 'board/MAI/bios_emulator/scitech/src/pm/tests/save.c')
-rw-r--r-- | board/MAI/bios_emulator/scitech/src/pm/tests/save.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/save.c b/board/MAI/bios_emulator/scitech/src/pm/tests/save.c index be96968..f732456 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/save.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/save.c @@ -37,7 +37,7 @@ int main(void) { PM_HWND hwndConsole; - ulong stateSize; + ulong stateSize; void *stateBuf; FILE *f; @@ -45,26 +45,25 @@ int main(void) hwndConsole = PM_openConsole(0,0,0,0,0,true); stateSize = PM_getConsoleStateSize(); if ((stateBuf = PM_malloc(stateSize)) == NULL) { - PM_closeConsole(hwndConsole); - printf("Unable to allocate console state buffer!\n"); - return -1; - } + PM_closeConsole(hwndConsole); + printf("Unable to allocate console state buffer!\n"); + return -1; + } PM_saveConsoleState(stateBuf,0); - + /* Restore the console state on exit */ PM_restoreConsoleState(stateBuf,0); PM_closeConsole(hwndConsole); - + /* Write the saved console state buffer to disk */ if ((f = fopen("/etc/pmsave.dat","wb")) == NULL) - printf("Unable to open /etc/pmsave/dat for writing!\n"); + printf("Unable to open /etc/pmsave/dat for writing!\n"); else { - fwrite(&stateSize,1,sizeof(stateSize),f); - fwrite(stateBuf,1,stateSize,f); - fclose(f); - printf("Console state successfully saved to /etc/pmsave.dat\n"); - } + fwrite(&stateSize,1,sizeof(stateSize),f); + fwrite(stateBuf,1,stateSize,f); + fclose(f); + printf("Console state successfully saved to /etc/pmsave.dat\n"); + } PM_free(stateBuf); return 0; } - |