DENX . Training2 . LddRot13ProcIrq

5.8.1. Proc, workqueue, Irq

Task:

Write a small module that creates a proc entry that can be read or written. Text written is rot13 scrambled and can be read back with the same proc entry.

Tips:

static void rot_buf(char *buf, int rotate)
{
        int x;

        for (x=0; buf[x] != '\0'; x++) {
                if (islower (buf[x]))
                        buf[x] = ((buf[x] + rotate - 'a') % 26) + 'a';
                else if (isupper (buf[x]))
                        buf[x] = ((buf[x] + rotate - 'A') % 26) + 'A';
                else if (isdigit (buf[x]))
                        buf[x] = ((buf[x] + rotate - '0') % 10) + '0';
        }
}

----- Revision r1.2 - 10 Apr 2008 - 12:46 - MarkusKlotzbuecher
Copyright © 2002-2020 by DENX Software Engineering