~ubuntu-branches/ubuntu/breezy/fortunes-es/breezy

« back to all changes in this revision

Viewing changes to util/rot.c

  • Committer: Bazaar Package Importer
  • Author(s): Javier Fernandez-Sanguino Pen~a
  • Date: 2005-04-24 01:52:04 UTC
  • mfrom: (1.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050424015204-ndov9cxtiho7l0jf
Tags: 1.24
Added feminist fortunes provided by Miriam Ruiz to the -off package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * An extremely simpleminded function. Read characters from stdin,
 
3
 * rot13 them, and put them on stdout.  Totally unnecessary, of course.
 
4
 */
 
5
 
 
6
#include <stdio.h>
 
7
#include <ctype.h>
 
8
 
 
9
int main(void)
 
10
{
 
11
    char a, b;
 
12
 
 
13
    while ((a = getchar()) != EOF)
 
14
    {
 
15
        if (isupper(a))
 
16
            b = 'A' + (a - 'A' + 13) % 26;
 
17
        else if (islower(a))
 
18
            b = 'a' + (a - 'a' + 13) % 26;
 
19
        else
 
20
            b = a;
 
21
        putchar(b);
 
22
    }
 
23
    exit(0);
 
24
}