Hi, This little patch makes caesar(6) useful at both encrypting and decrypting texts by allowing a negative rotation.
Example: $ echo Ceci est un test | caesar 10 Moms ocd ex docd $ echo Ceci est un test | caesar 10 | caesar -10 Ceci est un test A similar patch was proposed by Dieter Rauschenberger in 2008 with little response so perhaps explaining why this is useful will help. Without spoiling too much: one of the puzzle in the Infocom game Leather Goddesses of Phobos requires to decipher such a text. I did not touch the man page as it was unclear about rotation boundaries anyway. Regards. Index: caesar.c =================================================================== RCS file: /cvs/src/games/caesar/caesar.c,v retrieving revision 1.20 diff -u -p -u -p -r1.20 caesar.c --- caesar.c 10 Aug 2017 17:24:30 -0000 1.20 +++ caesar.c 15 May 2019 14:34:49 -0000 @@ -80,7 +80,7 @@ main(int argc, char *argv[]) printit(13); if (argc > 1) { - i = strtonum(argv[1], 0, 25, &errstr); + i = strtonum(argv[1], -25, 25, &errstr); if (errstr) errx(1, "rotation is %s: %s", errstr, argv[1]); else @@ -134,7 +134,9 @@ void printit(int rot) { int ch; - + + if (rot < 0) + rot = rot + 26; while ((ch = getchar()) != EOF) putchar(ROTATE(ch, rot)); exit(0);