summaryrefslogtreecommitdiff
path: root/frontends/calculator/CEdev/examples/fileio_rename/src
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2019-04-13 12:40:52 -0400
committerAndrew Opalach <andrew@akon.city> 2019-04-13 12:40:52 -0400
commit55bfff7cf6541caac172b43186cf14405185b14d (patch)
treec1ae99d2b39f8df8933d81ec2e61e81050bdb410 /frontends/calculator/CEdev/examples/fileio_rename/src
parent761462861fc1228e65546c4e0f877d5212320082 (diff)
downloadcetris-55bfff7cf6541caac172b43186cf14405185b14d.tar.gz
cetris-55bfff7cf6541caac172b43186cf14405185b14d.tar.bz2
cetris-55bfff7cf6541caac172b43186cf14405185b14d.zip
fix curses on linux
Diffstat (limited to 'frontends/calculator/CEdev/examples/fileio_rename/src')
-rw-r--r--frontends/calculator/CEdev/examples/fileio_rename/src/main.c154
1 files changed, 77 insertions, 77 deletions
diff --git a/frontends/calculator/CEdev/examples/fileio_rename/src/main.c b/frontends/calculator/CEdev/examples/fileio_rename/src/main.c
index 6f046bb..49793a9 100644
--- a/frontends/calculator/CEdev/examples/fileio_rename/src/main.c
+++ b/frontends/calculator/CEdev/examples/fileio_rename/src/main.c
@@ -1,77 +1,77 @@
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <tice.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <fileioc.h>
-
-/* Function prototypes */
-void printText(int8_t xpos, int8_t ypos, const char *text);
-
-/* Main Function */
-void main(void) {
- /* Declare some variables */
- const char *oldName = "OldFile";
- const char *newName = "NewFile";
- char nameBuffer[10];
- ti_var_t file;
- bool err = true;
-
- /* Clear the homescreen */
- os_ClrHome();
-
- /* Close any previously open files */
- ti_CloseAll();
-
- /* Delete both the new and old files if they already exist */
- ti_Delete(oldName);
- ti_Delete(newName);
-
- do {
- /* Create a file with the old name */
- file = ti_Open(oldName, "w");
- if (!file) break;
-
- ti_GetName(nameBuffer, file);
- printText(0, 0, "Old Name: ");
- printText(10, 0, nameBuffer);
-
- /* Close the old file */
- ti_CloseAll();
-
- /* Rename the old file to the new file name */
- ti_Rename(oldName, newName);
-
- /* Ensure the new name of the file is correct */
- file = ti_Open(newName, "r");
- if (!file) break;
-
- ti_GetName(nameBuffer, file);
- printText(0, 1, "New Name: ");
- printText(10, 1, nameBuffer);
-
- err = false;
- } while (0);
-
- /* Close all open files */
- ti_CloseAll();
-
- /* If an error occured, inform the user */
- if (err == true) {
- printText(0, 2, "An error occured");
- }
-
- /* Wait for a keypress */
- while (!os_GetCSC());
-}
-
-/* Draw text on the homescreen at the given X/Y location */
-void printText(int8_t xpos, int8_t ypos, const char *text) {
- os_SetCursorPos(ypos, xpos);
- os_PutStrFull(text);
-}
-
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <tice.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <fileioc.h>
+
+/* Function prototypes */
+void printText(int8_t xpos, int8_t ypos, const char *text);
+
+/* Main Function */
+void main(void) {
+ /* Declare some variables */
+ const char *oldName = "OldFile";
+ const char *newName = "NewFile";
+ char nameBuffer[10];
+ ti_var_t file;
+ bool err = true;
+
+ /* Clear the homescreen */
+ os_ClrHome();
+
+ /* Close any previously open files */
+ ti_CloseAll();
+
+ /* Delete both the new and old files if they already exist */
+ ti_Delete(oldName);
+ ti_Delete(newName);
+
+ do {
+ /* Create a file with the old name */
+ file = ti_Open(oldName, "w");
+ if (!file) break;
+
+ ti_GetName(nameBuffer, file);
+ printText(0, 0, "Old Name: ");
+ printText(10, 0, nameBuffer);
+
+ /* Close the old file */
+ ti_CloseAll();
+
+ /* Rename the old file to the new file name */
+ ti_Rename(oldName, newName);
+
+ /* Ensure the new name of the file is correct */
+ file = ti_Open(newName, "r");
+ if (!file) break;
+
+ ti_GetName(nameBuffer, file);
+ printText(0, 1, "New Name: ");
+ printText(10, 1, nameBuffer);
+
+ err = false;
+ } while (0);
+
+ /* Close all open files */
+ ti_CloseAll();
+
+ /* If an error occured, inform the user */
+ if (err == true) {
+ printText(0, 2, "An error occured");
+ }
+
+ /* Wait for a keypress */
+ while (!os_GetCSC());
+}
+
+/* Draw text on the homescreen at the given X/Y location */
+void printText(int8_t xpos, int8_t ypos, const char *text) {
+ os_SetCursorPos(ypos, xpos);
+ os_PutStrFull(text);
+}
+