summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/PrintHelpers/rot13.c
blob: 053bebdbe700c823303e5236b424574634717ee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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;
    }
  }
}