summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/PrintHelpers/rot13.c
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/PrintHelpers/rot13.c')
-rw-r--r--Tests/RunCMake/PrintHelpers/rot13.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Tests/RunCMake/PrintHelpers/rot13.c b/Tests/RunCMake/PrintHelpers/rot13.c
new file mode 100644
index 0000000..053bebd
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/rot13.c
@@ -0,0 +1,15 @@
+#include "rot13.h"
+
+void rot13(char* in)
+{
+ char* end = in + strlen(in);
+ for (char* c = in; c < end; c++) {
+ if (*c >= 'a' && *c <= 'z') {
+ *c += (*c < 'n') ? 13 : -13;
+ continue;
+ }
+ if (*c >= 'A' && *c <= 'Z') {
+ *c += (*c < 'N') ? 13 : -13;
+ }
+ }
+}